You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grub2/SOURCES/0225-strip-R-.note.gnu.prop...

83 lines
3.9 KiB

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
""")