* configure.ac: Run linker tests without -Werror.

Define TARGET_LDFLAGS_STATIC_LIBGCC and TARGET_LIBGCC.
	Change all occurences of -static-libgcc resp -lgcc to
	TARGET_LDFLAGS_STATIC_LIBGCC resp TARGET_LIBGCC.
This commit is contained in:
Vladimir Serbinenko 2013-11-07 18:21:22 +01:00
parent 390cd7ca90
commit d5524ca87b
4 changed files with 71 additions and 70 deletions

View file

@ -1,3 +1,10 @@
2013-11-07 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Run linker tests without -Werror.
Define TARGET_LDFLAGS_STATIC_LIBGCC and TARGET_LIBGCC.
Change all occurences of -static-libgcc resp -lgcc to
TARGET_LDFLAGS_STATIC_LIBGCC resp TARGET_LIBGCC.
2013-11-07 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Don't add -no-itegrated-as on clang on non-x86.

View file

@ -37,26 +37,10 @@ CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/
CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
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
LDADD_KERNEL = $(TARGET_LIBGCC)
CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -static-libgcc
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC)
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
if COND_CYGWIN

View file

@ -796,47 +796,6 @@ if test "$target_cpu" = arm; then
fi
fi
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--disable-werror],
[do not use -Werror when building GRUB])])
if test x"$enable_werror" != xno ; then
TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
HOST_CFLAGS="$HOST_CFLAGS -Werror"
fi
TARGET_CPP="$TARGET_CC -E"
TARGET_CCAS=$TARGET_CC
GRUB_TARGET_CPU="${target_cpu}"
GRUB_PLATFORM="${platform}"
AC_SUBST(GRUB_TARGET_CPU)
AC_SUBST(GRUB_PLATFORM)
AC_SUBST(TARGET_OBJCONV)
AC_SUBST(TARGET_CPP)
AC_SUBST(TARGET_CCAS)
AC_SUBST(TARGET_OBJ2ELF)
AC_SUBST(TARGET_APPLE_CC)
AC_SUBST(TARGET_MODULE_FORMAT)
AC_SUBST(TARGET_CFLAGS)
AC_SUBST(TARGET_LDFLAGS)
AC_SUBST(TARGET_CPPFLAGS)
AC_SUBST(TARGET_CCASFLAGS)
AC_SUBST(TARGET_IMG_LDSCRIPT)
AC_SUBST(TARGET_IMG_LDFLAGS)
AC_SUBST(TARGET_IMG_CFLAGS)
AC_SUBST(TARGET_IMG_BASE_LDOPT)
AC_SUBST(HOST_CFLAGS)
AC_SUBST(HOST_LDFLAGS)
AC_SUBST(HOST_CPPFLAGS)
AC_SUBST(HOST_CCASFLAGS)
AC_SUBST(BUILD_LIBM)
# Set them to their new values for the tests below.
CC="$TARGET_CC"
if test "x$TARGET_APPLE_CC" = x1 ; then
@ -845,12 +804,14 @@ else
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
fi
CPPFLAGS="$TARGET_CPPFLAGS"
if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
LIBS=
if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
TARGET_LIBGCC=
else
LIBS=-lgcc
TARGET_LIBGCC=-lgcc
fi
LIBS="$TARGET_LIBGCC"
grub_ASM_USCORE
if test x$grub_cv_asm_uscore = xyes; then
CFLAGS="$TARGET_CFLAGS -Wl,--defsym,_abort=_main"
@ -1356,6 +1317,55 @@ AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(NEED_REGISTER_FRAME_INFO)
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--disable-werror],
[do not use -Werror when building GRUB])])
if test x"$enable_werror" != xno ; then
TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
HOST_CFLAGS="$HOST_CFLAGS -Werror"
fi
if test "x$grub_cv_cc_target_clang" = xno; then
TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
else
TARGET_LDFLAGS_STATIC_LIBGCC=
fi
TARGET_CPP="$TARGET_CC -E"
TARGET_CCAS=$TARGET_CC
GRUB_TARGET_CPU="${target_cpu}"
GRUB_PLATFORM="${platform}"
AC_SUBST(GRUB_TARGET_CPU)
AC_SUBST(GRUB_PLATFORM)
AC_SUBST(TARGET_OBJCONV)
AC_SUBST(TARGET_LIBGCC)
AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC)
AC_SUBST(TARGET_CPP)
AC_SUBST(TARGET_CCAS)
AC_SUBST(TARGET_OBJ2ELF)
AC_SUBST(TARGET_APPLE_CC)
AC_SUBST(TARGET_MODULE_FORMAT)
AC_SUBST(TARGET_CFLAGS)
AC_SUBST(TARGET_LDFLAGS)
AC_SUBST(TARGET_CPPFLAGS)
AC_SUBST(TARGET_CCASFLAGS)
AC_SUBST(TARGET_IMG_LDSCRIPT)
AC_SUBST(TARGET_IMG_LDFLAGS)
AC_SUBST(TARGET_IMG_CFLAGS)
AC_SUBST(TARGET_IMG_BASE_LDOPT)
AC_SUBST(HOST_CFLAGS)
AC_SUBST(HOST_LDFLAGS)
AC_SUBST(HOST_CPPFLAGS)
AC_SUBST(HOST_CCASFLAGS)
AC_SUBST(BUILD_LIBM)
#
# Automake conditionals
#

View file

@ -409,9 +409,9 @@ image = {
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1';
objcopyflags = '-O binary';
mips_ldflags = '-static-libgcc -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
ldadd = '-lgcc';
cflags = '-Wno-unreachable-code -static-libgcc';
mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
ldadd = '$(TARGET_LIBGCC)';
cflags = '-Wno-unreachable-code $(TARGET_LDFLAGS_STATIC_LIBGCC)';
enable = mips;
};
@ -423,9 +423,9 @@ image = {
cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1';
objcopyflags = '-O binary';
mips_ldflags = '-static-libgcc -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
ldadd = '-lgcc';
cflags = '-static-libgcc';
mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
ldadd = '$(TARGET_LIBGCC)';
cflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC)';
enable = mips;
};
@ -443,7 +443,7 @@ image = {
name = fwstart;
mips_loongson = boot/mips/loongson/fwstart.S;
objcopyflags = '-O binary';
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
enable = mips_loongson;
};
@ -451,7 +451,7 @@ image = {
name = fwstart_fuloong2f;
mips_loongson = boot/mips/loongson/fuloong2f.S;
objcopyflags = '-O binary';
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
enable = mips_loongson;
};