From 03f80960cfbba5373b6fbecb3fa65387cfc24f25 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Nov 2010 23:36:20 +0100 Subject: [PATCH] Don't add -lgcc on i386 and x86_64. * configure.ac (LIBS): Don't add -lgcc on i386 and x86_64. * conf/Makefile.common (LDADD_KERNEL): Likewise. * grub-core/Makefile.core.def (kernel): Use LDADD_KERNEL. --- ChangeLog | 8 ++++++++ conf/Makefile.common | 19 ++++++++++++++++++- configure.ac | 5 ++++- grub-core/Makefile.core.def | 6 ++---- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c282b309c..19b6631fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-11-14 Vladimir Serbinenko + + Don't add -lgcc on i386 and x86_64. + + * configure.ac (LIBS): Don't add -lgcc on i386 and x86_64. + * conf/Makefile.common (LDADD_KERNEL): Likewise. + * grub-core/Makefile.core.def (kernel): Use LDADD_KERNEL. + 2010-11-14 Vladimir Serbinenko * configure.ac: Add -Wno-trampolines when supported. diff --git a/conf/Makefile.common b/conf/Makefile.common index a3ccebcc5..73b3d819b 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -45,7 +45,24 @@ CPPFLAGS_DEFAULT += -I$(top_srcdir)/include CPPFLAGS_DEFAULT += -I$(top_builddir)/include CCASFLAGS_DEFAULT = -DASM_FILE=1 -LDADD_KERNEL = -lgcc +LDADD_KERNEL = + +if ! COND_i386_pc +if ! COND_i386_efi +if ! COND_i386_qemu +if ! COND_i386_coreboot +if ! COND_i386_multiboot +if ! COND_i386_ieee1275 +if ! COND_x86_64_efi +LDADD_KERNEL += -lgcc +endif +endif +endif +endif +endif +endif +endif + CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) diff --git a/configure.ac b/configure.ac index a576d1c83..2b75883bc 100644 --- a/configure.ac +++ b/configure.ac @@ -579,8 +579,11 @@ else CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error" fi CPPFLAGS="$TARGET_CPPFLAGS" -LDFLAGS="$TARGET_LDFLAGS" +if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then +LIBS= +else LIBS=-lgcc +fi grub_ASM_USCORE if test x$grub_cv_asm_uscore = xyes; then diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 8845c26ea..46c65adac 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -27,6 +27,8 @@ kernel = { i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8200'; + ldadd = '$(LDADD_KERNEL)'; + i386_coreboot_ldflags = '-Wl,-Ttext=0x8200'; i386_multiboot_ldflags = '-Wl,-Ttext=0x8200'; i386_ieee1275_ldflags = '-Wl,-Ttext=0x10000'; @@ -39,10 +41,6 @@ kernel = { emu_cflags = '$(CFLAGS_GNULIB)'; emu_cppflags = '$(CPPFLAGS_GNULIB)'; - mips_ldadd = '-lgcc'; - powerpc_ldadd = '-lgcc'; - sparc64_ldadd = '-lgcc'; - i386_pc_startup = kern/i386/pc/startup.S; i386_efi_startup = kern/i386/efi/startup.S; x86_64_efi_startup = kern/x86_64/efi/startup.S;