diff options
Diffstat (limited to 'upstream/configure.ac.patch')
-rw-r--r-- | upstream/configure.ac.patch | 158 |
1 files changed, 95 insertions, 63 deletions
diff --git a/upstream/configure.ac.patch b/upstream/configure.ac.patch index 8fc9730..9d6f2bc 100644 --- a/upstream/configure.ac.patch +++ b/upstream/configure.ac.patch @@ -7,16 +7,16 @@ +# Check whether --enable-espf was given and target have the support. +AC_ARG_ENABLE([espf], +[AS_HELP_STRING([--enable-espf[=ARG]], -+ [Enable Stack protector, Position independent executable and -+ Fortify_source as default. If we have suppot for it when compiling. -+ Linux targets supported x86, x32 and x86_64. -+ @<:@ARG={all,pie,ssp,no}@:>@ ])], ++ [Enable Stack protector, Position independent executable and ++ Fortify_source as default. If we have suppot for it when compiling. ++ Linux targets supported i?86 and x86_64. ++ @<:@ARG={all,pie,ssp,no}@:>@ ])], +set_enable_espf=$enableval, +set_enable_espf=no) +case "${set_enable_espf}" in + all|pie|ssp) + case $target in -+ i?86*-*-linux* | x86_??*-*-linux*) ++ i?86*-*-linux* | x86_64*-*-linux*) + enable_espf=yes + ;; + *) @@ -51,7 +51,17 @@ # Enable --enable-checking in stage1 of the compiler. --- a/gcc/configure.ac 2012-02-22 12:27:45.000000000 +0100 +++ b/gcc/configure.ac 2012-07-01 00:43:14.054216215 +0200 -@@ -5193,6 +5193,156 @@ if test x"${LINKER_HASH_STYLE}" != x; th +@@ -342,7 +342,8 @@ GCC_STDINT_TYPES + # So, we only use -pedantic if we can disable those warnings. + + ACX_PROG_CC_WARNING_OPTS( +- m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual])), [loose_warn]) ++ m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual \ ++ -Wno-format-security])), [loose_warn]) + ACX_PROG_CC_WARNING_OPTS( + m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])), + [c_loose_warn]) +@@ -5193,6 +5194,167 @@ if test x"${LINKER_HASH_STYLE}" != x; th [The linker hash style]) fi @@ -62,24 +72,23 @@ +# Check whether --enable-espf was given and target have the support. +AC_ARG_ENABLE([espf], +[AS_HELP_STRING([--enable-espf[=ARG]], -+ [Enable Stack protector, Position independent executable and -+ Fortify_source as default. If we have suppot for it when compiling. -+ Linux targets supported x86, x32 and x86_64. -+ @<:@ARG={all,pie,ssp,no}@:>@ ])], ++ [Enable Stack protector, Position independent executable and ++ Fortify_sources as default. If we have suppot for it when compiling. ++ Linux targets supported x86_64. @<:@ARG={all,pie,ssp,no}@:>@ ])], +set_enable_espf=$enableval, +set_enable_espf=no) +case "${set_enable_espf}" in + all|pie|ssp) + AC_MSG_CHECKING(if $target support espf) + case $target in -+ i?86*-*-linux* | x86_??*-*-linux*) ++ i?86*-*-linux* | x86_64-*-linux*) + enable_espf=yes + AC_DEFINE(ENABLE_ESPF, 1, -+ [Define if your target support espf and you have enable it.]) ++ [Define if your target support espf and you have enable it.]) + ;; + *) + enable_espf=no -+ AC_MSG_WARN([*** --enable-espf is not supported on this $target target.]) ++ AC_MSG_WARN([*** --enable-espf is not supported on this $target target.]) + ;; + esac + AC_MSG_RESULT($enable_espf) @@ -92,32 +101,32 @@ + ;; +esac +AC_SUBST([enable_espf]) -+if test x$enable_espf = xyes ; then ++if test $enable_espf = yes ; then + -+# Check for FORTIFY_SOURCE support in target C library. -+ AC_CACHE_CHECK(for _FORTIFY_SOURCE support in target C library, ++# Check for FORTIFY_SOURCES support in target C library. ++ AC_CACHE_CHECK(for _FORTIFY_SOURCES support in target C library, + gcc_cv_libc_provides_fortify, + [gcc_cv_libc_provides_fortify=no + case "$target" in + *-*-linux*) -+ [# glibc 2.8 and later provides _FORTIFY_SOURCE. -+ # uClibc 0.9.32 and later provides _FORTIFY_SOURCE. ++ [# glibc 2.8 and later provides _FORTIFY_SOURCES. ++ # uClibc 0.9.32 and later provides _FORTIFY_SOURCES. + if test -f $target_header_dir/features.h; then -+ if $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+2' \ -+ $target_header_dir/features.h > /dev/null \ -+ && $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[8-9])' \ -+ $target_header_dir/features.h > /dev/null; then -+ gcc_cv_libc_provides_fortify=yes ++ if $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+2' \ ++ $target_header_dir/features.h > /dev/null \ ++ && $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[8-9])' \ ++ $target_header_dir/features.h > /dev/null; then ++ gcc_cv_libc_provides_fortify=yes + elif $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \ -+ $target_header_dir/features.h > /dev/null; then -+ if test -f $target_header_dir/bits/uClibc_config.h && \ -+ $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_SUBLEVEL__[ ]+([3-9][2-9]|[4-9][0-9])' \ -+ $target_header_dir/bits/uClibc_config.h > /dev/null; then -+ gcc_cv_libc_provides_fortify=yes -+ else -+ gcc_cv_libc_provides_fortify=no -+ fi -+ fi ++ $target_header_dir/features.h > /dev/null; then ++ if test -f $target_header_dir/bits/uClibc_config.h && \ ++ $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_SUBLEVEL__[ ]+([3-9][2-9]|[4-9][0-9])' \ ++ $target_header_dir/bits/uClibc_config.h > /dev/null; then ++ gcc_cv_libc_provides_fortify=yes ++ else ++ gcc_cv_libc_provides_fortify=no ++ fi ++ fi + fi] + ;; + *) gcc_cv_libc_provides_fortify=no ;; @@ -126,18 +135,22 @@ + AC_MSG_CHECKING(if we can default to use -fPIE and link with -pie) + enable_espf_pie=no + if test x$gcc_cv_ld_pie = xyes ;then -+ if test x$set_enable_espf = xall || test x$set_enable_espf = xpie; then -+ saved_LDFLAGS="$LDFLAGS" -+ saved_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -fPIE -Werror" -+ LDFLAGS="$LDFLAGS -fPIE -pie" -+ AC_TRY_LINK(,, -+ [AC_MSG_RESULT([yes]); enable_espf_pie=yes],) -+ LDFLAGS="$saved_LDFLAGS" -+ CFLAGS="$saved_CFLAGS" ++ if test x$set_enable_espf = xall || test x$set_enable_espf = pie; then ++ if test x$cross_compiling = xno ; then ++ saved_LDFLAGS="$LDFLAGS" ++ saved_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -fPIE -Werror" ++ LDFLAGS="$LDFLAGS -fPIE -pie" ++ AC_TRY_LINK(,, ++ [AC_MSG_RESULT([yes]); enable_espf_pie=yes],) ++ LDFLAGS="$saved_LDFLAGS" ++ CFLAGS="$saved_CFLAGS" ++ else ++ AC_MSG_RESULT([yes]) ++ fi + fi + fi -+ if test x$enable_espf_pie = xyes ; then ++ if test $enable_espf_pie = yes ; then + AC_DEFINE(ENABLE_ESPF_PIE, 1, + [Define if your compiler will default to use -fPIE and link with -pie.]) + else @@ -148,41 +161,46 @@ + ssp_link_test=no + enable_espf_ssp=no + if test x$gcc_cv_libc_provides_ssp = xyes && test x$set_have_as_tls = xyes; then -+ if $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \ -+ $target_header_dir/features.h > /dev/null; then -+ if test -f $target_header_dir/bits/uClibc_config.h && \ -+ $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_SUBLEVEL__[ ]+([3-9][2-9]|[4-9][0-9])' \ -+ $target_header_dir/bits/uClibc_config.h > /dev/null && \ -+ $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_HAS_TLS__[ ]+1' \ -+ $target_header_dir/bits/uClibc_config.h > /dev/null; then -+ ssp_link_test=yes -+ fi ++ if $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \ ++ $target_header_dir/features.h > /dev/null; then ++ if test -f $target_header_dir/bits/uClibc_config.h && \ ++ $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_SUBLEVEL__[ ]+([3-9][2-9]|[4-9][0-9])' \ ++ $target_header_dir/bits/uClibc_config.h > /dev/null && \ ++ $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_HAS_TLS__[ ]+1' \ ++ $target_header_dir/bits/uClibc_config.h > /dev/null; then ++ ssp_link_test=yes ++ fi + else + ssp_link_test=yes + fi + fi -+ if test x$ssp_link_test=xyes; then ++ if test x$ssp_link_test=xyes;then + if test x$set_enable_espf = xall || test x$set_enable_espf = xssp; then -+ saved_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -O2 -fstack-protector -Werror" -+ AC_TRY_LINK(,, -+ [AC_MSG_RESULT([yes]); enable_espf_ssp=yes],) -+ CFLAGS="$saved_CFLAGS" ++ if test x$cross_compiling = xno ; then ++ saved_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -O2 -fstack-protector -Werror" ++ AC_TRY_LINK(,, ++ [AC_MSG_RESULT([yes]); enable_espf_ssp=yes],) ++ CFLAGS="$saved_CFLAGS" ++ else ++ enable_espf_ssp=yes ++ AC_MSG_RESULT($enable_espf_ssp) ++ fi + fi + fi -+ if test x$enable_espf_ssp = xyes ; then ++ if test $enable_espf_ssp = yes ; then + AC_DEFINE(ENABLE_ESPF_SSP, 1, + [Define if your compiler will default to use -fstack-protector.]) + else + AC_MSG_RESULT([no]) + fi + -+ AC_MSG_CHECKING(if we can default to use -D_FORTIFY_SOURCE=2) -+ if test x$gcc_cv_libc_provides_fortify = xyes; then ++ AC_MSG_CHECKING(if the compiler default to use -D_FORTIFY_SOURCES=2) ++ if test x$gcc_cv_libc_provides_fortify = xyes && test x$cross_compiling = xno ; then + saved_CFLAGS="$CFLAGS" + saved_CPPFLAGS="$CPPFLAGS" + CFLAGS="$CFLAGS -O2 -Werror" -+ CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" ++ CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCES=2" + AC_TRY_LINK([ + #include <sys/types.h> + #include <sys/stat.h> @@ -194,13 +212,16 @@ + [AC_MSG_RESULT([yes]); enable_espf_fortify=yes]) + CFLAGS="$saved_CFLAGS" + CPPFLAGS="$saved_CPPFLAGS" ++ elif test x$gcc_cv_libc_provides_fortify = xyes && test x$cross_compiling = xyes ; then ++ AC_MSG_RESULT([yes]) ++ enable_espf_fortify=yes + else + AC_MSG_RESULT([no]) + enable_espf_fortify=no + fi -+ if test x$enable_espf_fortify = xyes ; then ++ if test $enable_espf_fortify = yes ; then + AC_DEFINE(ENABLE_ESPF_FORTIFY, 1, -+ [Define if your compiler will default to use -D_FORTIFY_SOURCE=2.]) ++ [Define if your compiler will default to use -D_FORTIFY_SOURCES=2.]) + fi + +fi @@ -208,3 +229,14 @@ # Configure the subdirectories # AC_CONFIG_SUBDIRS($subdirs) +--- a/libcpp/configure.ac 2012-02-14 11:02:21.000000000 +0100 ++++ b/libcpp/configure.ac 2012-09-10 01:27:54.618064325 +0200 +@@ -34,7 +34,7 @@ AC_CHECK_PROGS([AUTOHEADER], [autoheader + # See config/warnings.m4 for details. + + ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wno-narrowing -Wwrite-strings \ +- -Wmissing-format-attribute], [warn]) ++ -Wmissing-format-attribute -Wno-format-security], [warn]) + ACX_PROG_CC_WARNING_OPTS([-Wstrict-prototypes -Wmissing-prototypes \ + -Wold-style-definition -Wc++-compat], [c_warn]) + ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long]) |