diff --git a/Makefile.in b/Makefile.in index 7af2df1f0..c4059e58e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -84,8 +84,8 @@ LDFLAGS = @LDFLAGS@ $(LIBS) CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \ -DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\" TARGET_CC = @TARGET_CC@ -TARGET_CFLAGS = @TARGET_CFLAGS@ -TARGET_ASFLAGS = @TARGET_ASFLAGS@ +TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@ +TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@ TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@ TARGET_APPLE_CC = @TARGET_APPLE_CC@ OBJCONV = @OBJCONV@ @@ -93,9 +93,9 @@ TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(buildd ifneq ($(platform), emu) TARGET_CPPFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) endif -TARGET_LDFLAGS = @TARGET_LDFLAGS@ +TARGET_LDFLAGS = -nostdlib @TARGET_LDFLAGS@ TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@ -TARGET_IMG_LDFLAGS = @TARGET_IMG_LDFLAGS@ +TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@ TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@ TARGET_OBJ2ELF = @TARGET_OBJ2ELF@ EXEEXT = @EXEEXT@ diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index 95f44844c..c06e7758a 100644 --- a/conf/any-emu.rmk +++ b/conf/any-emu.rmk @@ -1,6 +1,5 @@ # -*- makefile -*- -COMMON_LDFLAGS += -nostdlib COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) -fno-builtin util/grub-emu.c_DEPENDENCIES = grub_emu_init.h diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk index 048356a53..3cef9313f 100644 --- a/conf/i386-coreboot.rmk +++ b/conf/i386-coreboot.rmk @@ -1,8 +1,6 @@ # -*- makefile -*- -COMMON_ASFLAGS = -nostdinc -fno-builtin -m32 -COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32 -COMMON_LDFLAGS = -m32 -nostdlib +COMMON_CFLAGS = -mrtd -mregparm=3 # Images. diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk index b6e6821f4..a92cff224 100644 --- a/conf/i386-efi.rmk +++ b/conf/i386-efi.rmk @@ -1,7 +1,5 @@ # -*- makefile -*- -COMMON_ASFLAGS = -nostdinc -fno-builtin -m32 -COMMON_CFLAGS = -fno-builtin -m32 -COMMON_LDFLAGS = -melf_i386 -nostdlib +COMMON_LDFLAGS = -melf_i386 include $(srcdir)/conf/x86-efi.mk \ No newline at end of file diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk index c65e2f7de..d4a459b3e 100644 --- a/conf/i386-ieee1275.rmk +++ b/conf/i386-ieee1275.rmk @@ -1,8 +1,6 @@ # -*- makefile -*- -COMMON_ASFLAGS = -m32 -nostdinc -fno-builtin -COMMON_CFLAGS = -ffreestanding -mrtd -mregparm=3 -COMMON_LDFLAGS = -nostdlib +COMMON_CFLAGS = -mrtd -mregparm=3 # Images. pkglib_PROGRAMS = kernel.img diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index 57904b265..19c996543 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -2,9 +2,7 @@ GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200 -COMMON_ASFLAGS = -nostdinc -fno-builtin -m32 -COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32 -COMMON_LDFLAGS = -m32 -nostdlib +COMMON_CFLAGS = -mrtd -mregparm=3 # Images. pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \ diff --git a/conf/i386-qemu.rmk b/conf/i386-qemu.rmk index c7209f348..97273e1ce 100644 --- a/conf/i386-qemu.rmk +++ b/conf/i386-qemu.rmk @@ -1,8 +1,6 @@ # -*- makefile -*- -COMMON_ASFLAGS = -nostdinc -fno-builtin -m32 -COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32 -COMMON_LDFLAGS = -m32 -nostdlib +COMMON_CFLAGS = -mrtd -mregparm=3 # Images. diff --git a/conf/mips.rmk b/conf/mips.rmk index 84eed8805..b43edbf69 100644 --- a/conf/mips.rmk +++ b/conf/mips.rmk @@ -1,9 +1,7 @@ # -*- makefile -*- -COMMON_ASFLAGS += -nostdinc -COMMON_CFLAGS += -ffreestanding -mexplicit-relocs -mflush-func=grub_cpu_flush_cache -COMMON_LDFLAGS += -nostdlib +COMMON_CFLAGS += -mexplicit-relocs -mflush-func=grub_cpu_flush_cache # Images. kernel_img_HEADERS += cpu/libgcc.h cpu/cache.h diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index e7668fc5d..86f6ddcb3 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -1,10 +1,6 @@ # -*- makefile -*- -COMMON_ASFLAGS = -nostdinc -COMMON_CFLAGS = -ffreestanding -COMMON_LDFLAGS += -nostdlib - # Images. kernel_img_HEADERS += cpu/libgcc.h ieee1275/ieee1275.h diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index ffa8c1e7c..507a05ab9 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -1,9 +1,8 @@ # -*- makefile -*- -COMMON_ASFLAGS = -nostdinc -m64 -COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs -COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax +COMMON_CFLAGS = -mno-app-regs +COMMON_LDFLAGS = -melf64_sparc -mno-relax # Images. pkglib_IMAGES = boot.img diskboot.img kernel.img @@ -37,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,0x200000,-Bstatic,-melf64_sparc -static-libgcc -lgcc +kernel_img_LDFLAGS = -Wl,-N,-Ttext,0x200000,-Bstatic,-melf64_sparc -static-libgcc -lgcc kernel_img_FORMAT = binary # Utilities. diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk index 816cce34e..200621280 100644 --- a/conf/x86_64-efi.rmk +++ b/conf/x86_64-efi.rmk @@ -1,7 +1,5 @@ # -*- makefile -*- -COMMON_ASFLAGS = -nostdinc -fno-builtin -m64 -COMMON_CFLAGS = -fno-builtin -m64 -COMMON_LDFLAGS = -melf_x86_64 -nostdlib +COMMON_LDFLAGS = -melf_x86_64 include $(srcdir)/conf/x86-efi.mk diff --git a/configure.ac b/configure.ac index f3fcd8c48..462fca225 100644 --- a/configure.ac +++ b/configure.ac @@ -353,6 +353,7 @@ AC_MSG_RESULT([$TARGET_OBJ2ELF]) if test "x$target_m32" = x1; then # Force 32-bit mode. TARGET_CFLAGS="$TARGET_CFLAGS -m32" + TARGET_ASFLAGS="$TARGET_CFLAGS -m32" TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" TARGET_MODULE_FORMAT="elf32" fi @@ -360,6 +361,7 @@ fi if test "x$target_m64" = x1; then # Force 64-bit mode. TARGET_CFLAGS="$TARGET_CFLAGS -m64" + TARGET_ASFLAGS="$TARGET_ASFLAGS -m64" TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" TARGET_MODULE_FORMAT="elf64" fi