diff --git a/repos/ports/ports/gcc.mk b/repos/ports/ports/gcc.mk index 8a82a88e6..a0299773a 100644 --- a/repos/ports/ports/gcc.mk +++ b/repos/ports/ports/gcc.mk @@ -49,7 +49,10 @@ endif $(CONTRIB_DIR)/$(GCC): $(DOWNLOAD_DIR)/$(GCC_TGZ).verified $(VERBOSE)tar xfz $(<:.verified=) -C $(CONTRIB_DIR) -include ../../tool/tool_chain_gcc_patches.inc +# needed in 'tool_chain_gcc_patches.inc' +GENODE_DIR := $(abspath ../..) + +include $(GENODE_DIR)/tool/tool_chain_gcc_patches.inc $(CONTRIB_DIR)/$(GCC)/configure:: $(CONTRIB_DIR)/$(GCC) @# diff --git a/repos/ports/ports/gdb.mk b/repos/ports/ports/gdb.mk index 02a1f6519..ed78f5416 100644 --- a/repos/ports/ports/gdb.mk +++ b/repos/ports/ports/gdb.mk @@ -68,7 +68,10 @@ $(DOWNLOAD_DIR)/$(GDB_TBZ2).verified: $(DOWNLOAD_DIR)/$(GDB_TBZ2) \ $(CONTRIB_DIR)/$(GDB): $(DOWNLOAD_DIR)/$(GDB_TBZ2).verified $(VERBOSE)tar xfj $(<:.verified=) -C $(CONTRIB_DIR) -include ../../tool/tool_chain_gdb_patches.inc +# needed in 'tool_chain_gdb_patches.inc' +GENODE_DIR := $(abspath ../..) + +include $(GENODE_DIR)/tool/tool_chain_gdb_patches.inc $(CONTRIB_DIR)/$(GDB)/configure:: $(CONTRIB_DIR)/$(GDB) @# diff --git a/tool/patches/gcc-4.7.2/cpp_for_target.patch b/tool/patches/gcc-4.7.2/cpp_for_target.patch new file mode 100644 index 000000000..b55ff412f --- /dev/null +++ b/tool/patches/gcc-4.7.2/cpp_for_target.patch @@ -0,0 +1,65 @@ +cpp_for_target.patch + +From: Christian Prochaska + +Fix the handling of CPP_FOR_TARGET. Without the fix, the configure script +of libgcc tries to use the normal 'cpp' for executing preprocessor tests, +which produces bogus results. +--- + Makefile.def | 1 + + Makefile.tpl | 3 +++ + configure.ac | 1 + + 3 files changed, 5 insertions(+) + +diff --git a/Makefile.def b/Makefile.def +index 1838a21..ae2689d 100644 +--- a/Makefile.def ++++ b/Makefile.def +@@ -242,6 +242,7 @@ flags_to_pass = { flag= GNATMAKE ; }; + // Target tools + flags_to_pass = { flag= AR_FOR_TARGET ; }; + flags_to_pass = { flag= AS_FOR_TARGET ; }; ++flags_to_pass = { flag= CPP_FOR_TARGET ; }; + flags_to_pass = { flag= CC_FOR_TARGET ; }; + flags_to_pass = { flag= CFLAGS_FOR_TARGET ; }; + flags_to_pass = { flag= CPPFLAGS_FOR_TARGET ; }; +diff --git a/Makefile.tpl b/Makefile.tpl +index 5cbd6e6..685756c 100644 +--- a/Makefile.tpl ++++ b/Makefile.tpl +@@ -275,6 +275,7 @@ BASE_TARGET_EXPORTS = \ + $(BASE_EXPORTS) \ + AR="$(AR_FOR_TARGET)"; export AR; \ + AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \ ++ CPP="$(CPP_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CPP; \ + CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \ + CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ +@@ -478,6 +479,7 @@ do-compare3 = $(do-compare) + + AR_FOR_TARGET=@AR_FOR_TARGET@ + AS_FOR_TARGET=@AS_FOR_TARGET@ ++CPP_FOR_TARGET=$(STAGE_CC_WRAPPER) @CPP_FOR_TARGET@ + CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ + + # If GCC_FOR_TARGET is not overriden on the command line, then this +@@ -643,6 +645,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ + EXTRA_TARGET_FLAGS = \ + 'AR=$$(AR_FOR_TARGET)' \ + 'AS=$(COMPILER_AS_FOR_TARGET)' \ ++ 'CPP=$$(CPP_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \ + 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ +diff --git a/configure.ac b/configure.ac +index a44a000..b763e18 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3114,6 +3114,7 @@ RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" + + GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar]) + GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new]) ++GCC_TARGET_TOOL(cpp, CPP_FOR_TARGET, CPP, [gcc/cpp -B$$r/$(HOST_SUBDIR)/gcc/]) + GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/]) + dnl see comments for CXX_FOR_TARGET_FLAG_TO_PASS + GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX, diff --git a/tool/patches/gcc-4.7.2/cppflags_for_target.patch b/tool/patches/gcc-4.7.2/cppflags_for_target.patch new file mode 100644 index 000000000..4dda97877 --- /dev/null +++ b/tool/patches/gcc-4.7.2/cppflags_for_target.patch @@ -0,0 +1,35 @@ +cppflags_for_target.patch + +From: Christian Prochaska + +Allow customization of CPPFLAGS_FOR_TARGET, not supported by the original +GCC config and build system. +--- + Makefile.tpl | 1 + + configure.ac | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/Makefile.tpl b/Makefile.tpl +index 371c3b6..5cbd6e6 100644 +--- a/Makefile.tpl ++++ b/Makefile.tpl +@@ -507,6 +507,7 @@ COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@ + COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@ + + CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@ ++CPPFLAGS_FOR_TARGET = @CPPFLAGS_FOR_TARGET@ + CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@ + + LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) +diff --git a/configure.ac b/configure.ac +index 40aeeee..a44a000 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2142,6 +2142,7 @@ if test "x$CFLAGS_FOR_TARGET" = x; then + *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;; + esac + fi ++AC_SUBST(CPPFLAGS_FOR_TARGET) + AC_SUBST(CFLAGS_FOR_TARGET) + + if test "x$CXXFLAGS_FOR_TARGET" = x; then diff --git a/tool/patches/gcc-4.7.2/host_target_combination.patch b/tool/patches/gcc-4.7.2/host_target_combination.patch new file mode 100644 index 000000000..c6423c5c9 --- /dev/null +++ b/tool/patches/gcc-4.7.2/host_target_combination.patch @@ -0,0 +1,140 @@ +host_target_combination.patch + +From: Christian Prochaska + +Remove sanity check for host/target combination in configure script of +libstdc++. An alternative fix would be the addition of a new host or +the use of an existing one. However, adding a new host would require +us to maintain a larger patch to the GCC build system, and using an +existing host comes with all the (possibly unwanted) policies associated +with the respective host platform. We want to stick with the bare-bone +compiler as much as possible. +--- + libstdc++-v3/configure | 24 +++++++++++------------- + libstdc++-v3/crossconfig.m4 | 1 - + 2 files changed, 11 insertions(+), 14 deletions(-) + +diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure +index 0e9e28a..5a9f1ee 100755 +--- a/libstdc++-v3/configure ++++ b/libstdc++-v3/configure +@@ -3025,8 +3025,7 @@ test -n "$target_alias" && + target_alias=${target_alias-$host_alias} + + # Handy for debugging: +-{ $as_echo "$as_me:${as_lineno-$LINENO}: $build / $host / $target / $host_alias / $target_alias" >&5 +-$as_echo "$as_me: $build / $host / $target / $host_alias / $target_alias" >&6;}; sleep 5 ++#AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5 + + if test "$build" != "$host"; then + # We are being configured with some form of cross compiler. +@@ -11498,7 +11497,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 11501 "configure" ++#line 11500 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -11604,7 +11603,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 11607 "configure" ++#line 11606 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -14962,7 +14961,7 @@ fi + # + # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. + cat > conftest.$ac_ext << EOF +-#line 14965 "configure" ++#line 14964 "configure" + struct S { ~S(); }; + void bar(); + void foo() +@@ -15297,7 +15296,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } + # Fake what AC_TRY_COMPILE does. + + cat > conftest.$ac_ext << EOF +-#line 15300 "configure" ++#line 15299 "configure" + int main() + { + typedef bool atomic_type; +@@ -15332,7 +15331,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; } + rm -f conftest* + + cat > conftest.$ac_ext << EOF +-#line 15335 "configure" ++#line 15334 "configure" + int main() + { + typedef short atomic_type; +@@ -15367,7 +15366,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; } + rm -f conftest* + + cat > conftest.$ac_ext << EOF +-#line 15370 "configure" ++#line 15369 "configure" + int main() + { + // NB: _Atomic_word not necessarily int. +@@ -15403,7 +15402,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } + rm -f conftest* + + cat > conftest.$ac_ext << EOF +-#line 15406 "configure" ++#line 15405 "configure" + int main() + { + typedef long long atomic_type; +@@ -15482,7 +15481,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu + # unnecessary for this test. + + cat > conftest.$ac_ext << EOF +-#line 15485 "configure" ++#line 15484 "configure" + int main() + { + _Decimal32 d1; +@@ -15524,7 +15523,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + # unnecessary for this test. + + cat > conftest.$ac_ext << EOF +-#line 15527 "configure" ++#line 15526 "configure" + template + struct same + { typedef T2 type; }; +@@ -15558,7 +15557,7 @@ $as_echo "$enable_int128" >&6; } + rm -f conftest* + + cat > conftest.$ac_ext << EOF +-#line 15561 "configure" ++#line 15560 "configure" + template + struct same + { typedef T2 type; }; +@@ -64099,7 +64098,6 @@ $as_echo "$ac_ld_relro" >&6; } + + ;; + *) +- as_fn_error "No support for this host/target combination." "$LINENO" 5 + ;; + esac + +diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4 +index 361ed0b..98d68ec 100644 +--- a/libstdc++-v3/crossconfig.m4 ++++ b/libstdc++-v3/crossconfig.m4 +@@ -264,7 +264,6 @@ case "${host}" in + AC_DEFINE(HAVE_TANHF) + ;; + *) +- AC_MSG_ERROR([No support for this host/target combination.]) + ;; + esac + ]) diff --git a/tool/patches/gcc-4.7.2/inhibit_libc.patch b/tool/patches/gcc-4.7.2/inhibit_libc.patch new file mode 100644 index 000000000..8ffabcd81 --- /dev/null +++ b/tool/patches/gcc-4.7.2/inhibit_libc.patch @@ -0,0 +1,25 @@ +inhibit_libc.patch + +From: Christian Prochaska + +Make sure to disable the 'inhibit_libc' flag, which is evaluated when +compiling libgcc. When libc is inhibited, the 'unwind-dw2-fde-glibc.c' +is not using the "new" glibc exception handling mechanism. However, +Genode's dynamic linker relies on this mechanism. +--- + gcc/configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gcc/configure.ac b/gcc/configure.ac +index b7604d6..75bb2b5 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -1862,7 +1862,7 @@ fi + if { { test x$host != x$target && test "x$with_sysroot" = x ; } || + test x$with_newlib = xyes ; } && + { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then +- inhibit_libc=true ++ inhibit_libc=false # was true + fi + AC_SUBST(inhibit_libc) + diff --git a/tool/patches/gcc-4.7.2/link_spec.patch b/tool/patches/gcc-4.7.2/link_spec.patch new file mode 100644 index 000000000..e07fb825d --- /dev/null +++ b/tool/patches/gcc-4.7.2/link_spec.patch @@ -0,0 +1,29 @@ +link_spec.patch + +From: Christian Prochaska + +Enable LINK_SPEC customization via configure arguments + +We add a hook for sneaking our custom LINK_SPEC definition into the GCC +configure process by uncommentig the 'host_xm_include_list'. This enables us +to supply a custom header file to be included into 'gcc/config.h' defining +the 'LINK_SPEC' macro. This macro expresses the policy of how the GCC +frontend invokes 'ld' on multiarch platforms. I.e., on x86, we need to pass +'-melf_i386' to 'ld' when building in '-m32' mode. +--- + gcc/configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gcc/configure.ac b/gcc/configure.ac +index 2d1876f..b7604d6 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -1759,7 +1759,7 @@ for f in $xm_file; do + done + + host_xm_file_list= +-host_xm_include_list= ++#host_xm_include_list= + for f in $host_xm_file; do + case $f in + ansidecl.h ) diff --git a/tool/patches/gcc-4.7.2/misc.patch b/tool/patches/gcc-4.7.2/misc.patch new file mode 100644 index 000000000..2f70f3622 --- /dev/null +++ b/tool/patches/gcc-4.7.2/misc.patch @@ -0,0 +1,50 @@ +misc.patch + +From: Christian Prochaska + +Changes lacking documentation +--- + libgcc/Makefile.in | 2 +- + libgcc/config/t-libunwind-elf | 2 +- + libgcc/config/t-slibgcc | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in +index f38d5b4..d64c9e0 100644 +--- a/libgcc/Makefile.in ++++ b/libgcc/Makefile.in +@@ -858,7 +858,7 @@ LIBGCOV = _gcov _gcov_merge_add _gcov_merge_single _gcov_merge_delta \ + _gcov_indirect_call_profiler _gcov_average_profiler _gcov_ior_profiler \ + _gcov_merge_ior + +-libgcov-objects = $(patsubst %,%$(objext),$(LIBGCOV)) ++libgcov-objects = + + $(libgcov-objects): %$(objext): $(srcdir)/libgcov.c + $(gcc_compile) -DL$* -c $(srcdir)/libgcov.c +diff --git a/libgcc/config/t-libunwind-elf b/libgcc/config/t-libunwind-elf +index 47a460b..cd6e291 100644 +--- a/libgcc/config/t-libunwind-elf ++++ b/libgcc/config/t-libunwind-elf +@@ -32,7 +32,7 @@ SHLIBUNWIND_SONAME = @shlib_base_name@.so.$(SHLIBUNWIND_SOVERSION) + SHLIBUNWIND_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared \ + -nodefaultlibs -Wl,-h,$(SHLIBUNWIND_SONAME) \ + -Wl,-z,text -Wl,-z,defs -o $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME).tmp \ +- @multilib_flags@ $(SHLIB_OBJS) -lc && \ ++ @multilib_flags@ $(SHLIB_OBJS) && \ + rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \ + if [ -f $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) ]; then \ + mv -f $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) \ +diff --git a/libgcc/config/t-slibgcc b/libgcc/config/t-slibgcc +index 3727244..89c8e9b 100644 +--- a/libgcc/config/t-slibgcc ++++ b/libgcc/config/t-slibgcc +@@ -27,7 +27,7 @@ SHLIB_MAP = @shlib_map_file@ + SHLIB_OBJS = @shlib_objs@ + SHLIB_DIR = @multilib_dir@ + SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@ +-SHLIB_LC = -lc ++SHLIB_LC = + SHLIB_MAKE_SOLINK = $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK) + SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \ + $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK) diff --git a/tool/patches/gcc-4.7.2/no_short_enums.patch b/tool/patches/gcc-4.7.2/no_short_enums.patch new file mode 100644 index 000000000..e6d7768cb --- /dev/null +++ b/tool/patches/gcc-4.7.2/no_short_enums.patch @@ -0,0 +1,22 @@ +no_short_enums.patch + +From: Christian Prochaska + +Ensure -fno-short-enums as default. +--- + gcc/config/arm/arm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c +index 35b73c5..52370a8 100644 +--- a/gcc/config/arm/arm.c ++++ b/gcc/config/arm/arm.c +@@ -23384,7 +23384,7 @@ arm_promote_function_mode (const_tree type ATTRIBUTE_UNUSED, + static bool + arm_default_short_enums (void) + { +- return TARGET_AAPCS_BASED && arm_abi != ARM_ABI_AAPCS_LINUX; ++ return false; + } + + diff --git a/tool/patches/gcc-4.7.2/pic_cxxflags.patch b/tool/patches/gcc-4.7.2/pic_cxxflags.patch new file mode 100644 index 000000000..24001a151 --- /dev/null +++ b/tool/patches/gcc-4.7.2/pic_cxxflags.patch @@ -0,0 +1,28 @@ +pic_cxxflags.patch + +From: Christian Prochaska + +Allow passing of PIC_CXXFLAGS to the configure script of libstdc++. +Without this change, libsupc++ would be compiled w/o PICFLAGS, resulting +in text relocations. Because for base tool chains, no 'dynamic_linker' +is defined (see 'libtool.m4'), 'dynamic_linker' is set to 'no', which +results in 'can_build_shared = no', which, in turn , results +in 'enable_shared = no', which, in turn, sets 'PIC_CXXFLAGS' to +nothing rather then '-prefer-pic'. +--- + libstdc++-v3/configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac +index f04563e..238097d 100644 +--- a/libstdc++-v3/configure.ac ++++ b/libstdc++-v3/configure.ac +@@ -424,7 +424,7 @@ GLIBCXX_EXPORT_FLAGS + if test "$enable_shared" = yes; then + PIC_CXXFLAGS="-prefer-pic" + else +- PIC_CXXFLAGS= ++ __PIC_CXXFLAGS= + fi + AC_SUBST(PIC_CXXFLAGS) + diff --git a/tool/patches/gcc-4.7.2/series b/tool/patches/gcc-4.7.2/series new file mode 100644 index 000000000..619a0a2f2 --- /dev/null +++ b/tool/patches/gcc-4.7.2/series @@ -0,0 +1,10 @@ +tmake_file_extra_parts.patch +misc.patch +tmake_file_arm.patch +link_spec.patch +inhibit_libc.patch +cppflags_for_target.patch +cpp_for_target.patch +no_short_enums.patch +host_target_combination.patch +pic_cxxflags.patch diff --git a/tool/patches/gcc-4.7.2/tmake_file_arm.patch b/tool/patches/gcc-4.7.2/tmake_file_arm.patch new file mode 100644 index 000000000..b51246b61 --- /dev/null +++ b/tool/patches/gcc-4.7.2/tmake_file_arm.patch @@ -0,0 +1,62 @@ +tmake_file_arm.patch + +From: Christian Prochaska + +Let 'config.gcc' expand our already populated 'tmake_file' variable rather +than making a hard assignment. This is needed for the ARM platform because +the target 'arm-elf-eabi' actually matches the pattern 'arm-*-*-eabi' in +the 'config.gcc' file. +--- + gcc/config.gcc | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 653e5d9..9dacfd0 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -875,7 +875,7 @@ arm*-*-linux*) # ARM GNU/Linux with ELF + ;; + arm*-*-uclinux*) # ARM ucLinux + tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/uclinux-elf.h glibc-stdint.h" +- tmake_file="arm/t-arm arm/t-arm-elf" ++ tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf" + case ${target} in + arm*-*-uclinux*eabi) + tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h" +@@ -891,7 +891,7 @@ arm*-*-uclinux*) # ARM ucLinux + ;; + arm*-*-ecos-elf) + tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h" +- tmake_file="arm/t-arm arm/t-arm-elf" ++ tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf" + ;; + arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*) + # The BPABI long long divmod functions return a 128-bit value in +@@ -900,7 +900,7 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*) + need_64bit_hwint=yes + default_use_cxa_atexit=yes + tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h" +- tmake_file="arm/t-arm arm/t-arm-elf" ++ tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf" + case ${target} in + arm*-*-eabi*) + tm_file="$tm_file newlib-stdint.h" +@@ -922,15 +922,15 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*) + ;; + arm*-*-rtems*) + tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/rtems-elf.h rtems.h newlib-stdint.h" +- tmake_file="arm/t-arm arm/t-arm-elf t-rtems arm/t-rtems" ++ tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf t-rtems arm/t-rtems" + ;; + arm*-*-elf) + tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h" +- tmake_file="arm/t-arm arm/t-arm-elf" ++ tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf" + ;; + arm*-wince-pe*) + tm_file="arm/semi.h arm/aout.h arm/arm.h arm/coff.h dbxcoff.h arm/pe.h arm/wince-pe.h" +- tmake_file="arm/t-arm arm/t-wince-pe" ++ tmake_file="${tmake_file} arm/t-arm arm/t-wince-pe" + extra_options="${extra_options} arm/pe.opt" + extra_objs="pe.o" + ;; diff --git a/tool/patches/gcc-4.7.2/tmake_file_extra_parts.patch b/tool/patches/gcc-4.7.2/tmake_file_extra_parts.patch new file mode 100644 index 000000000..3304c2012 --- /dev/null +++ b/tool/patches/gcc-4.7.2/tmake_file_extra_parts.patch @@ -0,0 +1,212 @@ +tmake_file_extra_parts.patch + +From: Christian Prochaska + +Enable support for passing custom 'tmake_file' and 'extra_parts' to the +GCC configure process uncommenting the default initialization of the +respective variables. The 'extra_parts' variable is used to carry the +information about which crtN files are to be created. +--- + gcc/config.gcc | 2 +- + libgcc/config.host | 44 ++++++++++++++++++++++---------------------- + 2 files changed, 23 insertions(+), 23 deletions(-) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 5fcd192..653e5d9 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -204,7 +204,7 @@ + + out_file= + common_out_file= +-tmake_file= ++#tmake_file= + extra_headers= + user_headers_inc_next_pre= + user_headers_inc_next_post= +diff --git a/libgcc/config.host b/libgcc/config.host +index ef9791b..b11d221 100644 +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -69,8 +69,8 @@ + + asm_hidden_op=.hidden + enable_execute_stack= +-extra_parts= +-tmake_file= ++#extra_parts= ++#tmake_file= + tm_file= + tm_define= + md_unwind_header=no-unwind.h +@@ -172,14 +172,14 @@ case ${host} in + *-*-darwin*) + asm_hidden_op=.private_extern + tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin" +- extra_parts="crt3.o crttms.o crttme.o" ++# extra_parts="crt3.o crttms.o crttme.o" + ;; + *-*-freebsd*) + # This is the generic ELF configuration of FreeBSD. Later + # machine-specific sections may refine and add to this + # configuration. + tmake_file="$tmake_file t-freebsd t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" +- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" ++# extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" + case ${target_thread_file} in + posix) + tmake_file="${tmake_file} t-freebsd-thread" +@@ -195,11 +195,11 @@ case ${host} in + ;; + *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux" +- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" ++# extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" + ;; + *-*-lynxos*) + tmake_file="$tmake_file t-lynx $cpu_type/t-crtstuff t-crtstuff-pic t-libgcc-pic" +- extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ++# extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + ;; + *-*-netbsd*) + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" +@@ -208,7 +208,7 @@ case ${host} in + # a.out configurations. + case ${host} in + *-*-netbsd*1.[7-9]* | *-*-netbsd[2-9]* | *-*-netbsdelf[2-9]*) +- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o" ++# extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o" + ;; + esac + ;; +@@ -222,7 +222,7 @@ case ${host} in + ;; + *-*-rtems*) + tmake_file="$tmake_file t-rtems" +- extra_parts="crtbegin.o crtend.o" ++# extra_parts="crtbegin.o crtend.o" + ;; + *-*-solaris2*) + # Unless linker support and dl_iterate_phdr are present, +@@ -251,7 +251,7 @@ case ${host} in + esac + ;; + *-*-uclinux*) +- extra_parts="crtbegin.o crtend.o" ++# extra_parts="crtbegin.o crtend.o" + ;; + *-*-*vms*) + tmake_file="vms/t-vms" +@@ -261,7 +261,7 @@ case ${host} in + tmake_file=t-vxworks + ;; + *-*-elf) +- extra_parts="crtbegin.o crtend.o" ++# extra_parts="crtbegin.o crtend.o" + ;; + esac + +@@ -360,7 +360,7 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*) + case ${host} in + arm*-*-eabi* | arm*-*-rtemseabi*) + tmake_file="${tmake_file} arm/t-bpabi" +- extra_parts="crtbegin.o crtend.o crti.o crtn.o" ++# extra_parts="crtbegin.o crtend.o crti.o crtn.o" + ;; + arm*-*-symbianelf*) + tmake_file="${tmake_file} arm/t-symbian t-slibgcc-nolc-override" +@@ -409,7 +409,7 @@ bfin*-linux-uclibc*) + tmake_file="$tmake_file bfin/t-bfin bfin/t-crtstuff t-libgcc-pic t-fdpbit bfin/t-linux" + # No need to build crtbeginT.o on uClibc systems. Should probably + # be moved to the OS specific section above. +- extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ++# extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + md_unwind_header=bfin/linux-unwind.h + ;; + bfin*-rtems*) +@@ -418,7 +418,7 @@ bfin*-rtems*) + ;; + bfin*-*) + tmake_file="$tmake_file bfin/t-bfin t-fdpbit" +- extra_parts="crtbegin.o crtend.o crti.o crtn.o" ++# extra_parts="crtbegin.o crtend.o crti.o crtn.o" + ;; + cr16-*-elf) + tmake_file="${tmake_file} cr16/t-cr16 cr16/t-crtlibid t-fdpbit" +@@ -579,7 +579,7 @@ i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*) + i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae) + ;; + i[34567]86-*-cygwin*) +- extra_parts="crtbegin.o crtend.o crtfastmath.o" ++# extra_parts="crtbegin.o crtend.o crtfastmath.o" + # This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h + if test x$enable_sjlj_exceptions = xyes; then + tmake_eh_file="i386/t-sjlj-eh" +@@ -595,7 +595,7 @@ i[34567]86-*-cygwin*) + tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} i386/t-slibgcc-cygming i386/t-cygming i386/t-cygwin i386/t-crtfm i386/t-chkstk t-dfprules" + ;; + i[34567]86-*-mingw*) +- extra_parts="crtbegin.o crtend.o crtfastmath.o" ++# extra_parts="crtbegin.o crtend.o crtfastmath.o" + case ${target_thread_file} in + win32) + tmake_file="$tmake_file i386/t-gthr-win32" +@@ -656,7 +656,7 @@ ia64*-*-freebsd*) + ;; + ia64*-*-linux*) + # Don't use crtbeginT.o from *-*-linux* default. +- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o" ++# extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o" + tmake_file="$tmake_file ia64/t-ia64 ia64/t-ia64-elf t-crtfm t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat ia64/t-eh-ia64 t-libunwind ia64/t-linux" + if test x$with_system_libunwind != xyes ; then + tmake_file="${tmake_file} t-libunwind-elf ia64/t-linux-libunwind" +@@ -738,11 +738,11 @@ microblaze*-linux*) + ;; + microblaze*-*-*) + tmake_file="microblaze/t-microblaze t-fdpbit" +- extra_parts="crtbegin.o crtend.o crti.o crtn.o" ++# extra_parts="crtbegin.o crtend.o crti.o crtn.o" + ;; + mips-sgi-irix6.5*) + tmake_file="$tmake_file mips/t-irix6 t-crtfm mips/t-tpbit t-slibgcc mips/t-slibgcc-irix" +- extra_parts="crtbegin.o crtend.o crtfastmath.o irix-crti.o irix-crtn.o" ++# extra_parts="crtbegin.o crtend.o crtfastmath.o irix-crti.o irix-crtn.o" + md_unwind_header=mips/irix6-unwind.h + ;; + mips*-*-netbsd*) # NetBSD/mips, either endian. +@@ -811,7 +811,7 @@ mipstx39-*-elf* | mipstx39el-*-elf*) + tmake_file="$tmake_file mips/t-crtstuff mips/t-mips16" + ;; + mmix-knuth-mmixware) +- extra_parts="crti.o crtn.o crtbegin.o crtend.o" ++# extra_parts="crti.o crtn.o crtbegin.o crtend.o" + tmake_file="${tmake_file} ${cpu_type}/t-${cpu_type}" + ;; + mn10300-*-*) +@@ -946,7 +946,7 @@ s390x-*-linux*) + ;; + s390x-ibm-tpf*) + tmake_file="${tmake_file} s390/t-crtstuff t-libgcc-pic t-eh-dw2-dip" +- extra_parts="crtbeginS.o crtendS.o" ++# extra_parts="crtbeginS.o crtendS.o" + md_unwind_header=s390/tpf-unwind.h + ;; + score-*-elf) +@@ -1128,7 +1128,7 @@ xtensa*-*-linux*) + ;; + am33_2.0-*-linux*) + # Don't need crtbeginT.o from *-*-linux* default. +- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" ++# extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" + tmake_file="$tmake_file t-fdpbit" + ;; + m32c-*-elf*|m32c-*-rtems*) +@@ -1136,7 +1136,7 @@ m32c-*-elf*|m32c-*-rtems*) + ;; + mep*-*-*) + tmake_file="mep/t-mep t-fdpbit" +- extra_parts="crtbegin.o crtend.o" ++# extra_parts="crtbegin.o crtend.o" + ;; + *) + echo "*** Configuration ${host} not supported" 1>&2 diff --git a/tool/patches/gdb-7.3.1/arm_single_step.patch b/tool/patches/gdb-7.3.1/arm_single_step.patch new file mode 100644 index 000000000..cb5560d5a --- /dev/null +++ b/tool/patches/gdb-7.3.1/arm_single_step.patch @@ -0,0 +1,22 @@ +arm_single_step.patch + +From: Christian Prochaska + +Enable software single-stepping on ARM. +--- + gdb/arm-tdep.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c +index 155208e..91537d6 100644 +--- a/gdb/arm-tdep.c ++++ b/gdb/arm-tdep.c +@@ -8467,6 +8467,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + tdep = xcalloc (1, sizeof (struct gdbarch_tdep)); + gdbarch = gdbarch_alloc (&info, tdep); + ++ set_gdbarch_software_single_step(gdbarch, arm_software_single_step); ++ + set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets); + + /* Record additional information about the architecture we are defining. diff --git a/tool/patches/gdb-7.3.1/series b/tool/patches/gdb-7.3.1/series new file mode 100644 index 000000000..33f20803b --- /dev/null +++ b/tool/patches/gdb-7.3.1/series @@ -0,0 +1,2 @@ +shared_library.patch +arm_single_step.patch diff --git a/tool/patches/gdb-7.3.1/shared_library.patch b/tool/patches/gdb-7.3.1/shared_library.patch new file mode 100644 index 000000000..3a3683c12 --- /dev/null +++ b/tool/patches/gdb-7.3.1/shared_library.patch @@ -0,0 +1,101 @@ +shared_library.patch + +From: Christian Prochaska + +Enable shared library support. +--- + gdb/amd64-tdep.c | 4 ++++ + gdb/arm-tdep.c | 4 ++++ + gdb/configure.tgt | 5 ++++- + gdb/i386-tdep.c | 4 ++++ + 4 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c +index 9b5d5bb..db3821a 100644 +--- a/gdb/amd64-tdep.c ++++ b/gdb/amd64-tdep.c +@@ -45,6 +45,8 @@ + #include "features/i386/amd64.c" + #include "features/i386/amd64-avx.c" + ++#include "solib-svr4.h" ++ + /* Note that the AMD64 architecture was previously known as x86-64. + The latter is (forever) engraved into the canonical system name as + returned by config.guess, and used as the name for the AMD64 port +@@ -2465,6 +2467,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + const struct target_desc *tdesc = info.target_desc; + ++ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_lp64_fetch_link_map_offsets); ++ + /* AMD64 generally uses `fxsave' instead of `fsave' for saving its + floating-point registers. */ + tdep->sizeof_fpregset = I387_SIZEOF_FXSAVE; +diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c +index bb52ad4..155208e 100644 +--- a/gdb/arm-tdep.c ++++ b/gdb/arm-tdep.c +@@ -57,6 +57,8 @@ + + #include "features/arm-with-m.c" + ++#include "solib-svr4.h" ++ + static int arm_debug; + + /* Macros for setting and testing a bit in a minimal symbol that marks +@@ -8465,6 +8467,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + tdep = xcalloc (1, sizeof (struct gdbarch_tdep)); + gdbarch = gdbarch_alloc (&info, tdep); + ++ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets); ++ + /* Record additional information about the architecture we are defining. + These are gdbarch discriminators, like the OSABI. */ + tdep->arm_abi = arm_abi; +diff --git a/gdb/configure.tgt b/gdb/configure.tgt +index 5ab1554..ae57017 100644 +--- a/gdb/configure.tgt ++++ b/gdb/configure.tgt +@@ -96,7 +96,7 @@ arm*-*-symbianelf*) + ;; + arm*-*-* | thumb*-*-* | strongarm*-*-* | xscale-*-*) + # Target: ARM embedded system +- gdb_target_obs="arm-tdep.o" ++ gdb_target_obs="arm-tdep.o solib.o solib-svr4.o" + gdb_sim=../sim/arm/libsim.a + ;; + +@@ -623,6 +623,9 @@ x86_64-*-openbsd*) + i387-tdep.o i386bsd-tdep.o i386obsd-tdep.o \ + bsd-uthread.o corelow.o solib.o solib-svr4.o" + ;; ++x86_64-*-*) ++ gdb_target_obs="amd64-tdep.o i386-tdep.o i387-tdep.o solib.o solib-svr4.o" ++ ;; + xtensa*-*-linux*) gdb_target=linux + # Target: GNU/Linux Xtensa + gdb_target_obs="xtensa-tdep.o xtensa-config.o xtensa-linux-tdep.o \ +diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c +index 5f4089b..3c13bea 100644 +--- a/gdb/i386-tdep.c ++++ b/gdb/i386-tdep.c +@@ -60,6 +60,8 @@ + #include "features/i386/i386-avx.c" + #include "features/i386/i386-mmx.c" + ++#include "solib-svr4.h" ++ + /* Register names. */ + + static const char *i386_register_names[] = +@@ -7051,6 +7053,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + tdep = XCALLOC (1, struct gdbarch_tdep); + gdbarch = gdbarch_alloc (&info, tdep); + ++ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets); ++ + /* General-purpose registers. */ + tdep->gregset = NULL; + tdep->gregset_reg_offset = NULL; diff --git a/tool/tool_chain_gcc_patches.inc b/tool/tool_chain_gcc_patches.inc index 7ed81415c..e7bd7806e 100755 --- a/tool/tool_chain_gcc_patches.inc +++ b/tool/tool_chain_gcc_patches.inc @@ -1,93 +1,10 @@ +GCC_PATCHES_DIR = $(GENODE_DIR)/tool/patches/gcc-$(GCC_VERSION) +GCC_PATCHES = $(shell cat $(GCC_PATCHES_DIR)/series) + $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure:: $(CONTRIB_DIR)/gcc-$(GCC_VERSION) $(ECHO) "$(BRIGHT_COL)patching gcc build system...$(DEFAULT_COL)" - @# - @# Enable support for passing custom 'tmake_file' and 'extra_parts' to the - @# GCC configure process uncommenting the default initialization of the - @# respective variables. The 'extra_parts' variable is used to carry the - @# information about which crtN files are to be created. - @# - $(VERBOSE)sed -i "/^tmake_file=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config.gcc - $(VERBOSE)sed -i "/^extra_parts=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config.gcc - $(VERBOSE)sed -i "/^tmake_file=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc/config.host - $(VERBOSE)sed -i "/^extra_parts=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc/config.host - $(VERBOSE)sed -i "/extra_parts=\"crt.*\"/s/^/#/g" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc/config.host - @# - @# /* TODO: add documentation */ - @# - $(VERBOSE)sed -i "s/^libgcov-objects = .*/libgcov-objects = /" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc/Makefile.in - $(VERBOSE)sed -i "s/-lc//" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc/config/t-{libunwind-elf,slibgcc} - @# - @# Let 'config.gcc' expand our already populated 'tmake_file' variable rather - @# than making a hard assignment. This is needed for the ARM platform because - @# the target 'arm-elf-eabi' actually matches the pattern 'arm-*-*-eabi' in - @# the 'config.gcc' file. - @# - $(VERBOSE)sed -i "/tmake_file=\"arm/s/=\"/=\"\$${tmake_file} /" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config.gcc - @# - @# Enable LINK_SPEC customization via configure arguments - @# - @# We add a hook for sneaking our custom LINK_SPEC definition into the GCC - @# configure process by uncommentig the 'host_xm_include_list'. This enables us - @# to supply a custom header file to be included into 'gcc/config.h' defining - @# the 'LINK_SPEC' macro. This macro expresses the policy of how the GCC - @# frontend invokes 'ld' on multiarch platforms. I.e., on x86, we need to pass - @# '-melf_i386' to 'ld' when building in '-m32' mode. - @# - $(VERBOSE)sed -i "/^host_xm_include_list=$$/s/^/#/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/configure.ac - @# - @# Make sure to disable the 'inhibit_libc' flag, which is evaluated when - @# compiling libgcc. When libc is inhibited, the 'unwind-dw2-fde-glibc.c' - @# is not using the "new" glibc exception handling mechanism. However, - @# Genode's dynamic linker relies on this mechanism. - @# - $(VERBOSE)sed -i "/inhibit_libc=true/s/true/false # was true/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/configure.ac - @# - @# Accept prepopulation of 'host_configargs' and 'target_configargs' as - @# configure argument (only needed for gcc-4.4.5, fixed with later versions) - @# - $(VERBOSE)sed -i "/host_configargs=.--cache-file/s/=./=\"\$$host_configargs /" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac - $(VERBOSE)sed -i "/target_configargs=..baseargs/s/=.*/=\"\$$target_configargs \$${baseargs}\"/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac - @# - @# Allow customization of CPPFLAGS_FOR_TARGET, not supported by the original - @# GCC config and build system. - @# - $(VERBOSE)sed -i "/^CXXFLAGS_FOR_TARGET =/s/^/CPPFLAGS_FOR_TARGET = @CPPFLAGS_FOR_TARGET@\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl - $(VERBOSE)sed -i "/AC_SUBST(CFLAGS_FOR_TARGET)/s/^/AC_SUBST(CPPFLAGS_FOR_TARGET)\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac - @# - @# Fix the handling of CPP_FOR_TARGET. Without the fix, the configure script - @# of libgcc tries to use the normal 'cpp' for executing preprocessor tests, - @# which produces bogus results. - @# - $(VERBOSE)sed -i "/CC=.*XGCC.*export CC/s/^/ CPP=\"\$$(CPP_FOR_TARGET) \$$(XGCC_FLAGS_FOR_TARGET) \$$\$$TFLAGS\"; export CPP; \\\\\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl - $(VERBOSE)sed -i "/^CC_FOR_TARGET=/s/^/CPP_FOR_TARGET=\$$(STAGE_CC_WRAPPER) @CPP_FOR_TARGET@\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl - $(VERBOSE)sed -i "/CC=.*XGCC.*TFLAGS....$$/s/^/ 'CPP=\$$\$$(CPP_FOR_TARGET) \$$\$$(XGCC_FLAGS_FOR_TARGET) \$$\$$(TFLAGS)' \\\\\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.tpl - $(VERBOSE)sed -i "/flag= CC_FOR_TARGET/s/^/flags_to_pass = { flag= CPP_FOR_TARGET ; };\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/Makefile.def - $(VERBOSE)sed -i "/^GCC_TARGET_TOOL.cc,/s/^/GCC_TARGET_TOOL(cpp, CPP_FOR_TARGET, CPP, \[gcc\/cpp -B\$$\$$r\/\$$(HOST_SUBDIR)\/gcc\/\])\n/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure.ac - @# - @# Ensure -fno-short-enums as default. - @# - $(VERBOSE)sed -i "s/return TARGET_AAPCS_BASED && arm_abi != ARM_ABI_AAPCS_LINUX/return false/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc/config/arm/arm.c - @# - @# Remove sanity check for host/target combination in configure script of - @# libstdc++. An alternative fix would be the addition of a new host or - @# the use of an existing one. However, adding a new host would require - @# us to maintain a larger patch to the GCC build system, and using an - @# existing host comes with all the (possibly unwanted) policies associated - @# with the respective host platform. We want to stick with the bare-bone - @# compiler as much as possible. - @# - $(VERBOSE)sed -i "/No support for this host.target combination/d" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3/crossconfig.m4 - $(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3; $(AUTOCONF) - @# - @# Allow passing of PICFLAGS to the configure script of libstdc++. - @# Without this change, libsupc++ would be compiled w/o PICFLAGS, resulting - @# in text relocations. Because for base tool chains, no 'dynamic_linker' - @# is defined (see 'libtool.m4'), 'dynamic_linker' is set to 'no', which - @# results in 'can_build_shared = no', which, in turn , results - @# in 'enable_shared = no', which, in turn, sets 'PIC_CXXFLAGS' to - @# nothing rather then '-prefer-pic'. - @# - $(VERBOSE)sed -i "/PIC_CXXFLAGS=$$/s/PIC/__PIC/" $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3/configure.ac + $(VERBOSE)for p in $(GCC_PATCHES); do \ + patch -d $(CONTRIB_DIR)/gcc-$(GCC_VERSION) -p1 -i $(GCC_PATCHES_DIR)/$$p; done; @# @# Re-generate configure scripts @# @@ -96,6 +13,7 @@ $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure:: $(CONTRIB_DIR)/gcc-$(GCC_VERSION) $(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3; $(AUTOCONF) $(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc; $(AUTOCONF) $(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION); $(AUTOCONF) + $(VERBOSE)touch $@ @# @# Fix a bug in gcc 4.6.1 that causes compile errors when building Qt4 for ARM @# More detailed description at and solution from http://gcc.gnu.org/ml/gcc-patches/2010-11/msg02245.html diff --git a/tool/tool_chain_gdb_patches.inc b/tool/tool_chain_gdb_patches.inc index d17f47fb7..8fcb52b8a 100755 --- a/tool/tool_chain_gdb_patches.inc +++ b/tool/tool_chain_gdb_patches.inc @@ -1,23 +1,8 @@ +GDB_PATCHES_DIR = $(GENODE_DIR)/tool/patches/gdb-$(GDB_VERSION) +GDB_PATCHES = $(shell cat $(GDB_PATCHES_DIR)/series) + $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/configure:: $(CONTRIB_DIR)/gdb-$(GDB_VERSION) $(ECHO) "$(BRIGHT_COL)patching gdb...$(DEFAULT_COL)" - @# - @# Include 'solib.o' and 'solib-svr4.o' in arm*-*-* (non-OS) target configuration for shared library support - @# - $(VERBOSE)sed -i "s/gdb_target_obs=\"arm-tdep\.o\"$$/gdb_target_obs=\"arm-tdep.o solib.o solib-svr4.o\"/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/configure.tgt - @# - @# Add an x86_64-*-* (non-OS) target with shared library support - @# - $(VERBOSE)sed -i "/^xtensa\*-\*-linux\*/ s/^/x86_64-*-*)\n\tgdb_target_obs=\"amd64-tdep.o i386-tdep.o i387-tdep.o solib.o solib-svr4.o\"\n\t;;\n/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/configure.tgt - @# - @# Enable shared library support - @# - $(VERBOSE)sed -i "/^#include \"features\/i386\/amd64-avx\.c\"$$/ s/$$/\n\n#include \"solib-svr4\.h\"/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/amd64-tdep.c - $(VERBOSE)sed -i "/AMD64 generally uses/ s/^/ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_lp64_fetch_link_map_offsets);\n\n/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/amd64-tdep.c - $(VERBOSE)sed -i "/^#include \"features\/arm-with-m\.c\"$$/ s/$$/\n\n#include \"solib-svr4\.h\"/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/arm-tdep.c - $(VERBOSE)sed -i "/gdbarch = gdbarch_alloc (&info, tdep);/ s/$$/\n\n set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets);/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/arm-tdep.c - $(VERBOSE)sed -i "/^#include \"features\/i386\/i386-mmx\.c\"$$/ s/$$/\n\n#include \"solib-svr4\.h\"/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/i386-tdep.c - $(VERBOSE)sed -i "/gdbarch = gdbarch_alloc (&info, tdep);/ s/$$/\n\n set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets);/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/i386-tdep.c - @# - @# Enable software single-stepping on ARM - @# - $(VERBOSE)sed -i "/gdbarch = gdbarch_alloc (&info, tdep);/ s/$$/\n\n set_gdbarch_software_single_step(gdbarch, arm_software_single_step);/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/arm-tdep.c + $(VERBOSE)for p in $(GDB_PATCHES); do \ + patch -d $(CONTRIB_DIR)/gdb-$(GDB_VERSION) -p1 -i $(GDB_PATCHES_DIR)/$$p; done; + $(VERBOSE)touch $@