No description
ebc825b549
Some versions of gcc include a plugin called "annobin", and in some build systems this is enabled by default. This plugin creates special ELF note sections to track which ABI-breaking features are used by a binary, as well as a series of relocations to annotate where. If grub is compiled with this feature, then when grub-mkimage translates the binary to another file format which does not strongly associate relocation data with sections (i.e. when platform is *-efi), these relocations appear to be against the .text section rather than the original note section. When the binary is loaded by the PE runtime loader, hilarity ensues. This issue is not necessarily limited to the annobin, but could arise any time there are relocations in sections that are not represented in grub-mkimage's output. This patch seeks to avoid this issue by only including relocations that refer to sections which will be included in the final binary. As an aside, this should also obviate the need to avoid -funwind-tables, -fasynchronous-unwind-tables, and any sections similar to .eh_frame in the future. I've tested it on x86-64-efi with the following gcc command line options (as recorded by -grecord-gcc-flags), but I still need to test the result on some other platforms that have been problematic in the past (especially ARM Aarch64) before I feel comfortable making changes to the configure.ac bits: GNU C11 7.2.1 20180116 (Red Hat 7.2.1-7) -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -mno-stack-arg-probe -mcmodel=large -mno-red-zone -m64 -mtune=generic -march=x86-64 -g3 -Os -freg-struct-return -fno-stack-protector -ffreestanding -funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing -fstack-clash-protection -fno-ident -fplugin=annobin Signed-off-by: Peter Jones <pjones@redhat.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> |
||
---|---|---|
asm-tests | ||
build-aux | ||
conf | ||
docs | ||
grub-core | ||
include | ||
m4 | ||
po | ||
tests | ||
themes/starfield | ||
unicode | ||
util | ||
.gitignore | ||
ABOUT-NLS | ||
acinclude.m4 | ||
AUTHORS | ||
autogen.sh | ||
BUGS | ||
ChangeLog-2015 | ||
config.h.in | ||
configure.ac | ||
COPYING | ||
coreboot.cfg | ||
geninit.sh | ||
gentpl.py | ||
INSTALL | ||
linguas.sh | ||
Makefile.am | ||
Makefile.util.def | ||
NEWS | ||
README | ||
THANKS | ||
TODO |
This is GRUB 2, the second version of the GRand Unified Bootloader. GRUB 2 is rewritten from scratch to make GNU GRUB cleaner, safer, more robust, more powerful, and more portable. See the file NEWS for a description of recent changes to GRUB 2. See the file INSTALL for instructions on how to build and install the GRUB 2 data and program files. Please visit the official web page of GRUB 2, for more information. The URL is <http://www.gnu.org/software/grub/grub.html>. More extensive documentation is available in the Info manual, accessible using 'info grub' after building and installing GRUB 2. There are a number of important user-visible differences from the first version of GRUB, now known as GRUB Legacy. For a summary, please see: info grub Introduction 'Changes from GRUB Legacy'