From 607827292053aa25d0f0300add0798dd085a9131 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 15 Mar 2015 20:46:36 -0400 Subject: compiler building blocks: add support for custom build variables. feature detection: set a fallback value of 'yes' to modern assembler presence, PE dward support, libc-provided stack protector, and dynamic-loader header iteration. signed-off by Z. Gilboa; see copying.midipix (9cd0746c) for additional information. --- gcc/Makefile.in | 20 ++++++++++++++++++-- gcc/configure | 14 ++++++++++---- gcc/configure.ac | 6 +++--- 3 files changed, 31 insertions(+), 9 deletions(-) (limited to 'gcc') diff --git a/gcc/Makefile.in b/gcc/Makefile.in index e0b952ffd..c5ac57225 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -373,6 +373,22 @@ UNWIND_H = $(srcdir)/unwind-generic.h # Don't use this as a dependency--use $(GCC_PASSES). GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./xgcc -B./ -B$(build_tooldir)/bin/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include -L$(objdir)/../ld +# cbb: cbb_xgcc_for_specs (aka the key to paradise) +# if the CC compiler or its flags involve a custom specs file, +# then that specs file will become part of STAGE_CC_WRAPPER, +# which will then interfere with the bootstrapping process. +# we sidestep the problem by using a designated variable for +# the -dumpspecs step. this variable (cbb_xgcc_for_specs) +# is optional; to use it, set it prior to calling the +# top-level configure. + +cbb_xgcc_for_specs = @cbb_xgcc_for_specs@ + +ifeq ($(cbb_xgcc_for_specs),) +cbb_xgcc_for_specs = $(STAGE_CC_WRAPPER) +endif + + # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET. # It specifies -B./. # It also specifies -isystem ./include to find, e.g., stddef.h. @@ -1083,7 +1099,7 @@ BUILD_ERRORS = build/errors.o # libintl.h will be found in ../intl if we are using the included libintl. INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ -I$(srcdir)/../include @INCINTL@ \ - $(CPPINC) $(GMPINC) $(DECNUMINC) \ + $(CPPINC) $(DECNUMINC) \ $(PPLINC) $(CLOOGINC) .c.o: @@ -1843,7 +1859,7 @@ cpp$(exeext): $(GCC_OBJS) cppspec.o version.o intl.o prefix.o \ # Dump a specs file to make -B./ read these specs over installed ones. $(SPECS): xgcc$(exeext) - $(GCC_FOR_TARGET) -dumpspecs > tmp-specs + $(cbb_xgcc_for_specs) -dumpspecs > tmp-specs mv tmp-specs $(SPECS) # We do want to create an executable named `xgcc', so we can use it to diff --git a/gcc/configure b/gcc/configure index c8caff252..278554119 100755 --- a/gcc/configure +++ b/gcc/configure @@ -22101,7 +22101,7 @@ $as_echo_n "checking assembler for cfi sections directive... " >&6; } if test "${gcc_cv_as_cfi_sections_directive+set}" = set; then : $as_echo_n "(cached) " >&6 else - gcc_cv_as_cfi_sections_directive=no + gcc_cv_as_cfi_sections_directive=yes if test x$gcc_cv_as != x; then echo ' .text .cfi_sections .debug_frame, .eh_frame @@ -23609,7 +23609,7 @@ $as_echo_n "checking assembler for .secrel32 relocs... " >&6; } if test "${gcc_cv_as_ix86_pe_secrel32+set}" = set; then : $as_echo_n "(cached) " >&6 else - gcc_cv_as_ix86_pe_secrel32=no + gcc_cv_as_ix86_pe_secrel32=yes if test $in_tree_gas = yes; then if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 15 \) \* 1000 + 91` then gcc_cv_as_ix86_pe_secrel32=yes @@ -25774,7 +25774,7 @@ $as_echo_n "checking __stack_chk_fail in target C library... " >&6; } if test "${gcc_cv_libc_provides_ssp+set}" = set; then : $as_echo_n "(cached) " >&6 else - gcc_cv_libc_provides_ssp=no + gcc_cv_libc_provides_ssp=yes case "$target" in *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) # glibc 2.4 and later provides __stack_chk_fail and @@ -25857,7 +25857,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking dl_iterate_phdr in target C library" >&5 $as_echo_n "checking dl_iterate_phdr in target C library... " >&6; } -gcc_cv_target_dl_iterate_phdr=unknown +if [ "$gcc_cv_target_dl_iterate_phdr"x = x ]; then gcc_cv_target_dl_iterate_phdr=yes; fi case "$target" in *-*-solaris2*) # needs both a dl_iterate_phdr declaration and support for @@ -27792,3 +27792,9 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi +# Compiler Building Blocks variables +sed -i -e 's#@cbb_xgcc_for_specs@#'"$cbb_xgcc_for_specs"'#g' \ + -e 's#@cbb_ldflags_for_target@#'"$cbb_ldflags_for_target"'#g' \ + -e 's#@cbb_sysroot_for_libgcc@#'"$cbb_sysroot_for_libgcc"'#g' \ + Makefile || exit 2 + diff --git a/gcc/configure.ac b/gcc/configure.ac index 48605c851..07a0c7837 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2465,7 +2465,7 @@ gcc_GAS_CHECK_FEATURE([cfi sections directive], win32 | pe | cygwin* | mingw32* | uwin*) # Need to check that we generated the correct relocation for the # .debug_frame section. This was fixed for binutils 2.21. - gcc_cv_as_cfi_sections_directive=no + gcc_cv_as_cfi_sections_directive=yes if test "x$gcc_cv_objdump" != x; then if $gcc_cv_objdump -j .debug_frame -r conftest.o 2>/dev/null | \ grep secrel > /dev/null; then @@ -4362,7 +4362,7 @@ fi # Test for stack protector support in target C library. AC_CACHE_CHECK(__stack_chk_fail in target C library, gcc_cv_libc_provides_ssp, - [gcc_cv_libc_provides_ssp=no + [gcc_cv_libc_provides_ssp=yes case "$target" in *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) [# glibc 2.4 and later provides __stack_chk_fail and @@ -4430,7 +4430,7 @@ if test x$gcc_cv_target_ldbl128 = xyes; then fi AC_MSG_CHECKING(dl_iterate_phdr in target C library) -gcc_cv_target_dl_iterate_phdr=unknown +gcc_cv_target_dl_iterate_phdr=yes case "$target" in *-*-solaris2*) # needs both a dl_iterate_phdr declaration and support for -- cgit v1.2.3