All of lore.kernel.org
 help / color / mirror / Atom feed
* Properly set linker flags
@ 2012-03-16  9:17 Andreas Jaeger
  0 siblings, 0 replies; only message in thread
From: Andreas Jaeger @ 2012-03-16  9:17 UTC (permalink / raw)
  To: grub-devel

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 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-16 14:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16  9:17 Properly set linker flags Andreas Jaeger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.