0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From 274a27da6fe355c4c49953b3b69c8949d2412c62 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Fri, 29 Mar 2013 09:08:31 +0400
  4. Subject: [PATCH] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET
  5. Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
  6. This alternative patch is better because it lets you just use CFLAGS_FOR_TARGET to set the compilation flags for libgcc. Since bootstrapped target libraries are never compiled with the native compiler, it makes little sense to use different flags for stage1 and later stages. And it also makes little sense to use a different variable than CFLAGS_FOR_TARGET.
  7. Other changes I had to do include:
  8. - moving the creation of default CFLAGS_FOR_TARGET from Makefile.am to configure.ac, because otherwise the BOOT_CFLAGS are substituted into CFLAGS_FOR_TARGET (which is "-O2 -g $(CFLAGS)") via $(CFLAGS). It is also cleaner this way though.
  9. - passing the right CFLAGS to configure scripts as exported environment variables
  10. I also stopped passing LIBCFLAGS to configure scripts since they are unused in the whole src tree. And I updated the documentation as H-P reminded me to do.
  11. Bootstrapped/regtested i686-pc-linux-gnu, will commit to 4.4 shortly. Ok for 4.3?
  12. Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
  13. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  14. Upstream-Status: Pending
  15. ---
  16. configure | 32 ++++++++++++++++++++++++++++++++
  17. 1 file changed, 32 insertions(+)
  18. diff --git a/configure b/configure
  19. index bcebad264ec..86e4ee7c383 100755
  20. --- a/configure
  21. +++ b/configure
  22. @@ -8977,6 +8977,38 @@ fi
  23. +# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
  24. +# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
  25. +# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
  26. +# We want to ensure that TARGET libraries (which we know are built with
  27. +# gcc) are built with "-O2 -g", so include those options when setting
  28. +# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
  29. +if test "x$CFLAGS_FOR_TARGET" = x; then
  30. + CFLAGS_FOR_TARGET=$CFLAGS
  31. + case " $CFLAGS " in
  32. + *" -O2 "*) ;;
  33. + *) CFLAGS_FOR_TARGET="-O2 $CFLAGS" ;;
  34. + esac
  35. + case " $CFLAGS " in
  36. + *" -g "* | *" -g3 "*) ;;
  37. + *) CFLAGS_FOR_TARGET="-g $CFLAGS" ;;
  38. + esac
  39. +fi
  40. +
  41. +
  42. +if test "x$CXXFLAGS_FOR_TARGET" = x; then
  43. + CXXFLAGS_FOR_TARGET=$CXXFLAGS
  44. + case " $CXXFLAGS " in
  45. + *" -O2 "*) ;;
  46. + *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS" ;;
  47. + esac
  48. + case " $CXXFLAGS " in
  49. + *" -g "* | *" -g3 "*) ;;
  50. + *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS" ;;
  51. + esac
  52. +fi
  53. +
  54. +
  55. # Handle --with-headers=XXX. If the value is not "yes", the contents of
  56. # the named directory are copied to $(tooldir)/sys-include.
  57. if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then