diff --git a/ChangeLog b/ChangeLog index 91115c2ce..ec4766d44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2010-04-11 Vladimir Serbinenko + + Unify libgcc processing. + + * Makefile.in (kernel_img_LDFLAGS): New variable. + * conf/common.rmk (kernel_img_HEADERS): Add libgcc.h. + * conf/i386-coreboot.rmk (kernel_img_LDFLAGS): Append instead of + overwriting. + * conf/i386-ieee1275.rmk (kernel_img_LDFLAGS): Likewise. + * conf/i386-pc.rmk (kernel_img_LDFLAGS): Likewise. + * conf/i386-qemu.rmk (kernel_img_LDFLAGS): Likewise. + * conf/x86-efi.rmk (kernel_img_LDFLAGS): Likewise. + * conf/mips-qemu-mips.rmk (kernel_img_LDFLAGS): Append instead of + overwriting. Remove -lgcc and -static-libgcc + * conf/mips-yeeloong.rmk (kernel_img_LDFLAGS): Likewise. + * conf/mips.rmk (kernel_img_HEADERS): Remove cpu/libgcc.h + * conf/powerpc-ieee1275.rmk (kernel_img_HEADERS): Remove cpu/libgcc.h + (kernel_img_LDFLAGS): Append instead of overwriting. + Remove -lgcc and -static-libgcc + * conf/sparc64-ieee1275.rmk: Likewise. + * include/grub/powerpc/libgcc.h: Move to ... + * include/grub/libgcc.h: .. this. + * include/grub/libgcc.h: Don't export most of the function on x86. + (__bswapsi2): New export. + (__bswapdi2): Likewise. + * include/grub/mips/libgcc.h: Removed. + * include/grub/sparc64/libgcc.h: Likewise. + 2010-04-10 Vladimir Serbinenko * util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Remove diff --git a/Makefile.in b/Makefile.in index 08c25971f..e253af6c9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -103,6 +103,7 @@ TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@ TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@ TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@ TARGET_OBJ2ELF = @TARGET_OBJ2ELF@ +kernel_img_LDFLAGS = -static-libgcc -lgcc EXEEXT = @EXEEXT@ OBJCOPY = @OBJCOPY@ STRIP = @STRIP@ diff --git a/conf/common.rmk b/conf/common.rmk index 952be558c..8df232a0b 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -116,7 +116,7 @@ DEFSYMFILES += kernel_syms.lst kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \ env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \ partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \ - list.h handler.h command.h i18n.h env_private.h + list.h handler.h command.h i18n.h env_private.h libgcc.h ifneq ($(platform), emu) kernel_img_HEADERS += machine/memory.h machine/loader.h machine/kernel.h diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk index 3cef9313f..69b8e9a48 100644 --- a/conf/i386-coreboot.rmk +++ b/conf/i386-coreboot.rmk @@ -26,7 +26,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \ symlist.c kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic +kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic sbin_SCRIPTS += grub-install grub_install_SOURCES = util/grub-install.in diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk index d4a459b3e..05ba38a65 100644 --- a/conf/i386-ieee1275.rmk +++ b/conf/i386-ieee1275.rmk @@ -27,7 +27,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \ kernel_img_HEADERS += ieee1275/ieee1275.h kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic +kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic # Scripts. sbin_SCRIPTS = grub-install diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index c52f6fa45..eace1e2da 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -58,7 +58,7 @@ kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \ machine/pxe.h i386/pit.h kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS) +kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS) kernel_img_FORMAT = binary # Utilities. diff --git a/conf/i386-qemu.rmk b/conf/i386-qemu.rmk index 97273e1ce..664bef12a 100644 --- a/conf/i386-qemu.rmk +++ b/conf/i386-qemu.rmk @@ -39,7 +39,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \ symlist.c kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR) -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) +kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) kernel_img_FORMAT = binary sbin_SCRIPTS += grub-install diff --git a/conf/mips-qemu-mips.rmk b/conf/mips-qemu-mips.rmk index e06370122..af5b26bec 100644 --- a/conf/mips-qemu-mips.rmk +++ b/conf/mips-qemu-mips.rmk @@ -18,6 +18,5 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \ symlist.c kern/$(target_cpu)/cache.S kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \ - -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic +kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic kernel_img_FORMAT = binary diff --git a/conf/mips-yeeloong.rmk b/conf/mips-yeeloong.rmk index 35cd01b4b..6a96ddfaf 100644 --- a/conf/mips-yeeloong.rmk +++ b/conf/mips-yeeloong.rmk @@ -29,8 +29,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \ symlist.c kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \ - -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic +kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic kernel_img_FORMAT = binary # For ata.mod. diff --git a/conf/mips.rmk b/conf/mips.rmk index c9d94eb74..4603c219e 100644 --- a/conf/mips.rmk +++ b/conf/mips.rmk @@ -4,7 +4,7 @@ COMMON_CFLAGS += -mexplicit-relocs -mflush-func=grub_cpu_flush_cache # Images. -kernel_img_HEADERS += cpu/libgcc.h cpu/cache.h +kernel_img_HEADERS += cpu/cache.h # Scripts. sbin_SCRIPTS = diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index 86f6ddcb3..d5968ac8e 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -3,7 +3,7 @@ # Images. -kernel_img_HEADERS += cpu/libgcc.h ieee1275/ieee1275.h +kernel_img_HEADERS += ieee1275/ieee1275.h # Programs pkglib_PROGRAMS = kernel.img @@ -23,8 +23,7 @@ kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \ symlist.c kern/$(target_cpu)/cache.S kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \ - -Wl,-N,-S,-Ttext,0x200000,-Bstatic +kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x200000,-Bstatic # Scripts. sbin_SCRIPTS = grub-install diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index a387b8a96..72f947f6a 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -19,7 +19,7 @@ diskboot_img_ASFLAGS = $(COMMON_ASFLAGS) diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200 diskboot_img_FORMAT = binary -kernel_img_HEADERS += cpu/libgcc.h ieee1275/ieee1275.h cpu/ieee1275/ieee1275.h +kernel_img_HEADERS += ieee1275/ieee1275.h cpu/ieee1275/ieee1275.h kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \ kern/ieee1275/ieee1275.c kern/main.c kern/device.c \ kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \ @@ -36,7 +36,7 @@ kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \ symlist.c kern/$(target_cpu)/cache.S kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc -static-libgcc -lgcc +kernel_img_LDFLAGS += -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc kernel_img_FORMAT = binary # Utilities. diff --git a/conf/x86-efi.rmk b/conf/x86-efi.rmk index 5cb472168..46957d933 100644 --- a/conf/x86-efi.rmk +++ b/conf/x86-efi.rmk @@ -40,7 +40,7 @@ endif kernel_img_HEADERS += efi/efi.h efi/time.h efi/disk.h i386/pit.h kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) +kernel_img_LDFLAGS += $(COMMON_LDFLAGS) # For acpi.mod. acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c diff --git a/include/grub/powerpc/libgcc.h b/include/grub/libgcc.h similarity index 86% rename from include/grub/powerpc/libgcc.h rename to include/grub/libgcc.h index 6be122308..d0adae8c1 100644 --- a/include/grub/powerpc/libgcc.h +++ b/include/grub/libgcc.h @@ -18,21 +18,31 @@ #include -#ifdef HAVE___ASHLDI3 +/* On x86 these functions aren't really needed. Save some space. */ +#if !defined (__i386__) && !defined (__x86_64__) +# ifdef HAVE___ASHLDI3 void EXPORT_FUNC (__ashldi3) (void); -#endif -#ifdef HAVE___ASHRDI3 +# endif +# ifdef HAVE___ASHRDI3 void EXPORT_FUNC (__ashrdi3) (void); -#endif -#ifdef HAVE___LSHRDI3 +# endif +# ifdef HAVE___LSHRDI3 void EXPORT_FUNC (__lshrdi3) (void); +# endif +# ifdef HAVE___UCMPDI2 +void EXPORT_FUNC (__ucmpdi2) (void); +# endif +# ifdef HAVE___BSWAPSI2 +void EXPORT_FUNC (__bswapsi2) (void); +# endif +# ifdef HAVE___BSWAPDI2 +void EXPORT_FUNC (__bswapdi2) (void); +# endif #endif + #ifdef HAVE___TRAMPOLINE_SETUP void EXPORT_FUNC (__trampoline_setup) (void); #endif -#ifdef HAVE___UCMPDI2 -void EXPORT_FUNC (__ucmpdi2) (void); -#endif #ifdef HAVE__RESTGPR_14_X void EXPORT_FUNC (_restgpr_14_x) (void); diff --git a/include/grub/mips/libgcc.h b/include/grub/mips/libgcc.h deleted file mode 100644 index f06ea1c1c..000000000 --- a/include/grub/mips/libgcc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2007,2009 Free Software Foundation, Inc. - * - * GRUB is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GRUB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GRUB. If not, see . - */ - -#include - -#ifdef HAVE___ASHLDI3 -void EXPORT_FUNC (__ashldi3) (void); -#endif -#ifdef HAVE___ASHRDI3 -void EXPORT_FUNC (__ashrdi3) (void); -#endif -#ifdef HAVE___LSHRDI3 -void EXPORT_FUNC (__lshrdi3) (void); -#endif -#ifdef HAVE___UCMPDI2 -void EXPORT_FUNC (__ucmpdi2) (void); -#endif -#ifdef HAVE___BSWAPSI2 -void EXPORT_FUNC (__bswapsi2) (void); -#endif -#ifdef HAVE___BSWAPDI2 -void EXPORT_FUNC (__bswapdi2) (void); -#endif diff --git a/include/grub/sparc64/libgcc.h b/include/grub/sparc64/libgcc.h deleted file mode 100644 index e73abe29c..000000000 --- a/include/grub/sparc64/libgcc.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2007,2009 Free Software Foundation, Inc. - * - * GRUB is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GRUB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GRUB. If not, see . - */ - -#include - -#ifdef HAVE___BSWAPSI2 -typedef int SItype __attribute__ ((mode (SI))); -SItype EXPORT_FUNC (__bswapsi2) (SItype); -#endif - -#ifdef HAVE___BSWAPDI2 -typedef int DItype __attribute__ ((mode (DI))); -DItype EXPORT_FUNC (__bswapdi2) (DItype); -#endif