1 Star 0 Fork 50

山竹/grub2

forked from src-anolis-os/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0225-strip-R-.note.gnu.property-at-more-places.patch 3.87 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2022-04-13 15:15 . update to grub2-2.02-120.el8.src.rpm
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 3 Aug 2018 15:07:23 -0400
Subject: [PATCH] strip "-R .note.gnu.property" at more places.
For whatever reason, sometimes I see:
lzma_decompress.image: file format elf32-i386
lzma_decompress.image
architecture: i386, flags 0x00000012:
EXEC_P, HAS_SYMS
start address 0x00008200
Program Header:
LOAD off 0x000000c0 vaddr 0x00008200 paddr 0x00008200 align 2**5
filesz 0x00000b10 memsz 0x00000b10 flags rwx
LOAD off 0x00000bd0 vaddr 0x080480b4 paddr 0x080480b4 align 2**2
filesz 0x0000001c memsz 0x0000001c flags r--
NOTE off 0x00000bd0 vaddr 0x080480b4 paddr 0x080480b4 align 2**2
filesz 0x0000001c memsz 0x0000001c flags r--
STACK off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**4
filesz 0x00000000 memsz 0x00000000 flags rw-
Sections:
Idx Name Size VMA LMA File off Algn
0 .note.gnu.property 0000001c 080480b4 080480b4 00000bd0 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 00000b10 00008200 00008200 000000c0 2**5
CONTENTS, ALLOC, LOAD, CODE
SYMBOL TABLE:
080480b4 l d .note.gnu.property 00000000 .note.gnu.property
00008200 l d .text 00000000 .text
00000000 l df *ABS* 00000000 startup_raw.S
...
Which just looks wrong no matter what to my eyes (seriously it's at
128M? Why?), and when we fail to strip it, we get:
trillian:~/tmp/f29$ hexdump -C usr/lib/grub/i386-pc/lzma_decompress.img | tail -6
00000b00 ff 45 e8 5a 83 c2 02 89 d1 e9 df fe ff ff 66 90 |.E.Z..........f.|
00000b10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
0803feb0 00 00 00 00 04 00 00 00 0c 00 00 00 05 00 00 00 |................|
0803fec0 47 4e 55 00 02 00 00 c0 04 00 00 00 03 00 00 00 |GNU.............|
0803fed0
Which is very very much not what we want.
Cut it out.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
Makefile.am | 2 +-
gentpl.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index c7b0e6a9c..287fff66b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -209,7 +209,7 @@ pc-chainloader.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub-
$(TARGET_CC) -o $@ $< -static -DTARGET_CHAINLOADER=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x7c00 -m32
pc-chainloader.bin: pc-chainloader.elf
- $(TARGET_OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@;
+ $(TARGET_OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property $< $@;
ntldr.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -DTARGET_NTLDR=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -static -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0 -m32
diff --git a/gentpl.py b/gentpl.py
index 1e4635f44..d662c305f 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -776,7 +776,7 @@ def image(defn, platform):
if test x$(TARGET_APPLE_LINKER) = x1; then \
$(MACHO2IMG) $< $@; \
else \
- $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; \
+ $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx -R .note.gnu.property $< $@; \
fi
""")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangpingping000/grub2.git
git@gitee.com:wangpingping000/grub2.git
wangpingping000
grub2
grub2
a8

搜索帮助