From: Andreas Jaeger <aj@suse.de>
To: grub-devel@gnu.org
Subject: Properly set linker flags
Date: Fri, 16 Mar 2012 10:17:55 +0100 [thread overview]
Message-ID: <4F630543.1020703@suse.de> (raw)
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
reply other threads:[~2012-03-16 14:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F630543.1020703@suse.de \
--to=aj@suse.de \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.