Properly set linker flags
Compiling grub2 with gcc 4.7
gcc -Os -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g -fno-dwarf2-cfi-asm -m64 -mcmodel=large -mno-red-zone -fno-stack-protector -mno-stack-arg-probe -Werror -Wno-trampolines -DUSE_ASCII_FAILBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1
-ffreestanding -static -m64 -Wl,--build-id=none -melf_x86_64
-nostdlib -Wl,-N,-r,-d -o trig.module trig_module-trigtables.o
gcc -DHAVE_CONFIG_H -I. -I.. -Wall -W -I../include -I../include -DGRUB_MACHINE_EFI=1 -DGRUB_MACHINE=X86_64_EFI -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.7/include -DGRUB_FILE=\"bus/usb/usbtrans.c\" -I. -I. -I.. -I.. -I../include -I../include -Os -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g -fno-dwarf2-cfi-asm -m64 -mcmodel=large -mno-red-zone -fno-stack-protector -mno-stack-arg-probe -Werror -Wno-trampolines -DUSE_ASCII_FAILBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1 -ffreestanding -c -o bus/usb/usb_module-usbtrans.o test -f 'bus/usb/usbtrans.c' || echo './'bus/usb/usbtrans.c
gcc: error: unrecognized command line option '-melf_x86_64'
to pass linker flags to gcc, we should use -Wl,-melf_x86_64
Here's the obvious patch against 1.99 that should still apply to current head,
Andreas
conf/Makefile.common +2 -2
@@ -11,10 +11,10 @@ if COND_i386_pc CFLAGS_PLATFORM += -mrtd -mregparm=3 endif if COND_i386_efi - LDFLAGS_PLATFORM = -melf_i386 + LDFLAGS_PLATFORM = -Wl,-melf_i386 endif if COND_x86_64_efi - LDFLAGS_PLATFORM = -melf_x86_64 + LDFLAGS_PLATFORM = -Wl,-melf_x86_64 endif if COND_i386_qemu CFLAGS_PLATFORM += -mrtd -mregparm=3
Signature · 4 lines
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126