grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Properly set linker flags


From: Andreas Jaeger
Subject: Properly set linker flags
Date: Fri, 16 Mar 2012 10:17:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120312 Thunderbird/11.0

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

Index: grub-1.99/conf/Makefile.common
===================================================================
--- grub-1.99.orig/conf/Makefile.common
+++ grub-1.99/conf/Makefile.common
@@ -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

--
 Andreas Jaeger address@hidden,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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]