From 68e158dffde328d5b961518fe23504cc534744ce Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Thu, 31 Dec 2015 18:13:59 +0100 Subject: [PATCH] Strip .ARM.exidx This section is generated by clang and is useful only for debugging. It contains exotic relocations, so strip them to avoid them interferring with module loading. --- conf/Makefile.common | 2 +- gentpl.py | 2 +- grub-core/genmod.sh.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/Makefile.common b/conf/Makefile.common index 5083d5f1e..11296b550 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) -STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags +STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d diff --git a/gentpl.py b/gentpl.py index 76971d3ce..0782e447d 100644 --- a/gentpl.py +++ b/gentpl.py @@ -759,7 +759,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 $< $@; \ + $(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 $< $@; \ fi """) diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in index 7dcafd9d3..005cb1985 100644 --- a/grub-core/genmod.sh.in +++ b/grub-core/genmod.sh.in @@ -58,7 +58,7 @@ if test x@TARGET_APPLE_LINKER@ != x1; then -K grub_mod_init -K grub_mod_fini \ -K _grub_mod_init -K _grub_mod_fini \ -R .note.gnu.gold-version -R .note.GNU-stack \ - -R .note -R .comment $tmpfile || exit 1 + -R .note -R .comment -R .ARM.exidx $tmpfile || exit 1 fi if ! test -z "${TARGET_OBJ2ELF}"; then "${TARGET_OBJ2ELF}" $tmpfile || exit 1