aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2020-05-22 09:36:52 +0200
committerPaolo Bonzini <bonzini@gnu.org>2020-05-22 09:51:42 +0200
commita5300c4949b8d4de2d34bedfaed66793f48ec948 (patch)
tree9ce60214f4b98422c2051405d5ab7744aea1db47 /main.c
parentde50b5931c08f5fba7039ddccfb249a5b3b0b18d (diff)
downloadqboot-a5300c4949b8d4de2d34bedfaed66793f48ec948.zip
qboot-a5300c4949b8d4de2d34bedfaed66793f48ec948.tar.gz
qboot-a5300c4949b8d4de2d34bedfaed66793f48ec948.tar.bz2
qboot: Disable PIE for ELF binary build step
The switch to meson in commit fd2aada36b98 ("Add meson build") had two major behavior changes for the ELF binary build step: * ELF binary is no longer build as x86_64 on x86_64 * ELF binary is build as position independent executable on systems with a "--enable-default-pie" gcc The latter will create a slightly larger than 64KB bios.bin which causes an error when Qemu tries to load it: qemu: could not load PC BIOS 'qboot/build/bios.bin' This behavior change was introduced because the elf linker step was changed from using ld directly to using cc. Basically something like following Makefile change: bios.bin.elf: $(obj-y) flat.lds - $(LD) -T flat.lds -o bios.bin.elf $(obj-y) + $(CC) -o bios.bin.elf $(obj-y) -Wl,--no-undefined -Wl,--as-needed -nostdlib -m32 -Wl,--build-id=none -Wl,-Tflat.lds GCC will then take care of calling ld with the appropriate arguments. And one of these arguments for the "--enable-default-pie" gcc is "-pie": $(LD) --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o bios.bin.elf $(obj-y) --no-undefined --as-needed --build-id=none -Tflat.lds This default behavior of gcc must be suppressed by adding -no-pie to the arguments when linking the object files. Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'main.c')
0 files changed, 0 insertions, 0 deletions