diff options
author | Magnus Granberg <zorry@gentoo.org> | 2012-10-07 18:46:30 +0200 |
---|---|---|
committer | Magnus Granberg <zorry@gentoo.org> | 2012-10-07 18:46:30 +0200 |
commit | a82e19b9017f887c1b04d39c1e75f15e66242d73 (patch) | |
tree | 955b2c5d0bdc574e8e5a658dbf5b99a27073fab9 | |
parent | Add configure.ac patches (diff) | |
download | hardened-gccpatchset-a82e19b9017f887c1b04d39c1e75f15e66242d73.tar.gz hardened-gccpatchset-a82e19b9017f887c1b04d39c1e75f15e66242d73.tar.bz2 hardened-gccpatchset-a82e19b9017f887c1b04d39c1e75f15e66242d73.zip |
Update with some cross-compile fixes
-rw-r--r-- | gcc-4.7.0/piepatch/01_all_gcc47_configure.ac.patch | 63 | ||||
-rw-r--r-- | gcc-4.7.0/piepatch/01_all_gcc47_configure.patch | 182 | ||||
-rw-r--r-- | upstream/Changelog.txt | 28 | ||||
-rw-r--r-- | upstream/Makefile.in.patch | 100 | ||||
-rw-r--r-- | upstream/config.in.patch | 32 | ||||
-rw-r--r-- | upstream/config_all.patch | 35 | ||||
-rw-r--r-- | upstream/config_i386.patch | 66 | ||||
-rw-r--r-- | upstream/configure.ac.patch | 158 | ||||
-rw-r--r-- | upstream/gcc_doc.patch | 48 | ||||
-rw-r--r-- | upstream/testsuite-hardening-format.patch | 87 | ||||
-rw-r--r-- | upstream/testsuite-hardening-fortify.patch | 44 | ||||
-rw-r--r-- | upstream/testsuite-hardening-piessp.patch | 98 | ||||
-rw-r--r-- | upstream/testsuite-hardening-printf-types.patch | 590 |
13 files changed, 372 insertions, 1159 deletions
diff --git a/gcc-4.7.0/piepatch/01_all_gcc47_configure.ac.patch b/gcc-4.7.0/piepatch/01_all_gcc47_configure.ac.patch index ed49cd9..8b4c72e 100644 --- a/gcc-4.7.0/piepatch/01_all_gcc47_configure.ac.patch +++ b/gcc-4.7.0/piepatch/01_all_gcc47_configure.ac.patch @@ -1,4 +1,4 @@ -2011-04-27 Magnus Granberg <zorry@gentoo.org> +2012-10-04 Magnus Granberg <zorry@gentoo.org> * configure.ac Add --enable-esp. Add -fno-stack-protector to stage1_cflags. @@ -15,14 +15,14 @@ +# Check whether --enable-esp was given and target have the support. +AC_ARG_ENABLE([esp], +[AS_HELP_STRING([--enable-esp], -+ [Enable Stack protector, Position independent executable as -+ default if we have suppot for it when compiling -+ and link with -z relro and -z now as default. -+ Linux targets supported i*86, x86_64, x86_x32, powerpc, powerpc64, ia64 and arm.])], ++ [Enable Stack protector and Position independent executable as ++ default if we have suppot for it when compiling ++ and link with -z relro and -z now as default. ++ Linux targets supported i*86, x86_64, x32, powerpc, powerpc64, ia64 and arm.])], +[ + case $target in -+ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) -+ enable_espf=yes ++ i?86*-*-linux* | x86_64-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ enable_esp=yes + ;; + *) + AC_MSG_WARN([*** --enable-esp is not supported on this $target target.]) @@ -48,7 +48,7 @@ # Enable --enable-checking in stage1 of the compiler. --- a/gcc/configure.ac 2011-11-18 11:52:32.000000000 +0100 +++ b/gcc/configure.ac 2012-10-02 17:39:15.649526241 +0200 -@@ -5130,6 +5237,88 @@ if test x"${LINKER_HASH_STYLE}" != x; th +@@ -5130,6 +5237,85 @@ if test x"${LINKER_HASH_STYLE}" != x; th [The linker hash style]) fi @@ -59,17 +59,16 @@ +# Check whether --enable-esp was given and target have the support. +AC_ARG_ENABLE([esp], +[AS_HELP_STRING([--enable-esp], -+ [Enable Stack protector, Position independent executable and -+ Fortify_sources as default if we have suppot for it when compiling -+ and link -z now as default. -+ Linux targets supported i*86, x86_64, x86_x32, powerpc, powerpc64, ia64 and arm])], -+ set_enable_espf=$enableval, -+ set_enable_espf=no) -+if test $set_enable_esp = yes ; then ++ [Enable Stack protector and Position independent executable as ++ default if we have suppot for it when compiling ++ and link with -z relro and -z now as default. ++ Linux targets supported i*86, x86_64, x32, powerpc, powerpc64, ia64 and arm.])], ++ enable_esp=$enableval, ++ enable_esp=no) ++if test $enable_esp = yes ; then + AC_MSG_CHECKING(if $target support esp) -+if test $set_enable_esp = yes ; then + case "$target" in -+ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ i?86*-*-linux* | x86_64-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) + enable_esp=yes + AC_DEFINE(ENABLE_ESP, 1, + [Define if your target support esp and you have enable it.]) @@ -78,26 +77,22 @@ + enable_esp=no + ;; + esac -+else -+ enable_esp=no -+fi +AC_MSG_RESULT($enable_esp) +fi +AC_SUBST([enable_esp]) +if test $enable_esp = yes ; then -+ + AC_MSG_CHECKING(if we can default to use -fstack-protector-all) + ssp_link_test=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 ++ $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 @@ -110,7 +105,8 @@ + [AC_MSG_RESULT([no]); enable_esp_ssp=no]) + CFLAGS="$saved_CFLAGS" + else -+ [AC_MSG_RESULT([no]); enable_esp_ssp=no] ++ enable_esp_ssp=no ++ AC_MSG_RESULT($enable_esp_ssp) + fi + if test $enable_esp_ssp = yes ; then + AC_DEFINE(ENABLE_ESP_SSP, 1, @@ -119,20 +115,21 @@ + AC_MSG_CHECKING(checking for crtbeginP.o support) + if test x$enable_esp = xyes ; then + case "$target" in -+ ia64*-*-linux*) ++ ia64*-*-linux*) + enable_crtbeginP=no ;; + *-*-linux*) + if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then + enable_crtbeginP=yes + AC_DEFINE(ENABLE_CRTBEGINP, 1, + [Define if your compiler will support crtbeginP.]) -+ fi ++ fi + ;; -+ *) enable_crtbeginP=no ;; ++ *) enable_crtbeginP=no ;; + esac + fi + AC_MSG_RESULT($enable_crtbeginP) +fi ++AC_SUBST([enable_crtbeginP]) + # Configure the subdirectories # AC_CONFIG_SUBDIRS($subdirs) diff --git a/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch b/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch index 1a48f49..f0ddc7e 100644 --- a/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch +++ b/gcc-4.7.0/piepatch/01_all_gcc47_configure.patch @@ -1,11 +1,53 @@ -2012-04-06 Magnus Granberg <zorry@gentoo.org> +2012-10-04 Magnus Granberg <zorry@gentoo.org> - * configure Add --enable-esp. Add-fno-stack-protector + * configure.ac Add --enable-esp. Add -fno-stack-protector to stage1_cflags. - * gcc/configure Add --enable-esp and check if SSP works. + * configure Likewise + * gcc/configure.ac Add --enable-esp and check if SSP works. Define ENABLE_ESP ENABLE_ESP_SSP. Check if we support crtbeginP and define ENABLE_CRTBEGINP. + * gcc/configure Likewise +--- a/configure.ac 2011-11-29 22:36:43.000000000 +0100 ++++ b/configure.ac 2011-12-07 23:29:26.125712475 +0100 +@@ -419,6 +419,25 @@ if test "${ENABLE_LIBADA}" != "yes" ; th + noconfigdirs="$noconfigdirs gnattools" + fi + ++# Check whether --enable-esp was given and target have the support. ++AC_ARG_ENABLE([esp], ++[AS_HELP_STRING([--enable-esp], ++ [Enable Stack protector and Position independent executable as ++ default if we have suppot for it when compiling ++ and link with -z relro and -z now as default. ++ Linux targets supported i*86, x86_64, x32, powerpc, powerpc64, ia64 and arm.])], ++[ ++ case $target in ++ i?86*-*-linux* | x86_64-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ enable_espf=yes ++ ;; ++ *) ++ AC_MSG_WARN([*** --enable-esp is not supported on this $target target.]) ++ ;; ++ esac ++]) ++AC_SUBST([enable_esp]) ++ + AC_ARG_ENABLE(libssp, + [AS_HELP_STRING([--enable-libssp], [build libssp directory])], + ENABLE_LIBSSP=$enableval, +@@ -3211,6 +3230,11 @@ if test "$GCC" = yes -a "$ENABLE_BUILD_W + CFLAGS="$saved_CFLAGS" + fi + ++# Disable -fstack-protector on stage1 ++if test x$enable_esp = xyes; then ++ stage1_cflags="$stage1_cflags -fno-stack-protector" ++fi ++ + AC_SUBST(stage1_cflags) + + # Enable --enable-checking in stage1 of the compiler. --- a/configure 2011-12-22 21:51:34.700589641 +0100 +++ b/configure 2011-12-22 22:17:32.855636066 +0100 @@ -671,6 +671,7 @@ LDFLAGS @@ -28,11 +70,11 @@ --disable-libquadmath-support disable libquadmath support for Fortran --enable-libada build libada directory -+ --enable-esp Enable Stack protector, Position independent ++ --enable-esp Enable Stack protector and Position independent + executable as default if we have suppot for it when + compiling and link with -z relro and -z now as -+ default. Linux targets supported i*86, x86_64, -+ x86_x32, powerpc, powerpc64, ia64 and arm. ++ default. Linux targets supported i*86, x86_64, x32, ++ powerpc, powerpc64, ia64 and arm. --enable-libssp build libssp directory --enable-static-libjava[=ARG] build static libjava [default=no] @@ -45,7 +87,7 @@ +if test "${enable_esp+set}" = set; then : + enableval=$enable_esp; + case $target in -+ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ i?86*-*-linux* | x86_64-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) + enable_esp=yes + ;; + *) @@ -73,14 +115,101 @@ # Enable --enable-checking in stage1 of the compiler. +--- a/gcc/configure.ac 2011-11-18 11:52:32.000000000 +0100 ++++ b/gcc/configure.ac 2012-10-02 17:39:15.649526241 +0200 +@@ -5130,6 +5237,84 @@ if test x"${LINKER_HASH_STYLE}" != x; th + [The linker hash style]) + fi + ++# -------------- ++# Esp checks ++# -------------- ++ ++# Check whether --enable-esp was given and target have the support. ++AC_ARG_ENABLE([esp], ++[AS_HELP_STRING([--enable-esp], ++ [Enable Stack protector and Position independent executable as ++ default if we have suppot for it when compiling ++ and link with -z relro and -z now as default. ++ Linux targets supported i*86, x86_64, x32, powerpc, powerpc64, ia64 and arm.])], ++ enable_esp=$enableval, ++ enable_esp=no) ++if test $enable_esp = yes ; then ++ AC_MSG_CHECKING(if $target support esp) ++ case "$target" in ++ i?86*-*-linux* | x86_64-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ enable_esp=yes ++ AC_DEFINE(ENABLE_ESP, 1, ++ [Define if your target support esp and you have enable it.]) ++ ;; ++ *) ++ enable_esp=no ++ ;; ++ esac ++AC_MSG_RESULT($enable_esp) ++fi ++AC_SUBST([enable_esp]) ++if test $enable_esp = yes ; then ++ AC_MSG_CHECKING(if we can default to use -fstack-protector-all) ++ ssp_link_test=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 ++ else ++ ssp_link_test=yes ++ fi ++ fi ++ if test x$ssp_link_test=xyes ; then ++ saved_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -O2 -fstack-protector-all -Werror" ++ AC_TRY_LINK(,, ++ [AC_MSG_RESULT([yes]); enable_esp_ssp=yes], ++ [AC_MSG_RESULT([no]); enable_esp_ssp=no]) ++ CFLAGS="$saved_CFLAGS" ++ else ++ [AC_MSG_RESULT([no]); enable_esp_ssp=no] ++ fi ++ if test $enable_esp_ssp = yes ; then ++ AC_DEFINE(ENABLE_ESP_SSP, 1, ++ [Define if your compiler will default to use -fstack-protector-all.]) ++ fi ++ AC_MSG_CHECKING(checking for crtbeginP.o support) ++ if test x$enable_esp = xyes ; then ++ case "$target" in ++ ia64*-*-linux*) ++ enable_crtbeginP=no ;; ++ *-*-linux*) ++ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then ++ enable_crtbeginP=yes ++ AC_DEFINE(ENABLE_CRTBEGINP, 1, ++ [Define if your compiler will support crtbeginP.]) ++ fi ++ ;; ++ *) enable_crtbeginP=no ;; ++ esac ++ fi ++ AC_MSG_RESULT($enable_crtbeginP) ++fi ++AC_SUBST([enable_crtbeginP]) ++ + # Configure the subdirectories + # AC_CONFIG_SUBDIRS($subdirs) + --- a/gcc/configure 2011-12-31 12:45:24.449810238 +0100 +++ b/gcc/configure 2011-12-31 00:43:40.000000000 +0100 @@ -600,6 +600,8 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS -+enable_esp +enable_crtbeginP ++enable_esp enable_plugin pluginlibs CLOOGINC @@ -96,15 +225,15 @@ --enable-plugin enable plugin support --disable-libquadmath-support disable libquadmath support for Fortran -+ --enable-esp Enable Stack protector, Position independent ++ --enable-esp Enable Stack protector and Position independent + executable and Fortify_sources as default if we have + suppot for it when compiling and link -z now as -+ default. Linux targets supported i*86, x86_64, -+ x86_x32, powerpc, powerpc64, ia64, mips and arm ++ default. Linux targets supported i*86, x86_64, x32, ++ powerpc, powerpc64, ia64, mips and arm. Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] -@@ -27290,6 +27411,113 @@ _ACEOF +@@ -27290,6 +27145,110 @@ _ACEOF fi @@ -115,17 +244,16 @@ +# Check whether --enable-esp was given and target have the support. +# Check whether --enable-esp was given. +if test "${enable_esp+set}" = set; then : -+ enableval=$enable_esp; set_enable_esp=$enableval ++ enableval=$enable_esp; enable_esp=$enableval +else -+ set_enable_esp=no ++ enable_esp=no +fi + -+if test $set_enable_esp = yes ; then ++if test $enable_esp = yes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $target support esp" >&5 +$as_echo_n "checking if $target support esp... " >&6; } -+if test $set_enable_esp = yes ; then + case "$target" in -+ i?86*-*-linux* | x86_??*-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) ++ i?86*-*-linux* | x86_64-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*) + enable_esp=yes + +$as_echo "#define ENABLE_ESP 1" >>confdefs.h @@ -135,23 +263,19 @@ + enable_esp=no + ;; + esac -+else -+ enable_esp=no -+fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_esp" >&5 +$as_echo "$enable_esp" >&6; } +fi + +if test $enable_esp = yes ; then -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fstack-protector" >&5 -+$as_echo_n "checking if we can default to use -fstack-protector... " >&6; } ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can default to use -fstack-protector-all" >&5 ++$as_echo_n "checking if we can default to use -fstack-protector-all... " >&6; } + ssp_link_test=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])' \ ++ $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 @@ -163,7 +287,7 @@ + fi + if test x$ssp_link_test=xyes ; then + saved_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -O2 -fstack-protector -Werror" ++ CFLAGS="$CFLAGS -O2 -fstack-protector-all -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + @@ -186,16 +310,18 @@ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$saved_CFLAGS" + else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } + enable_esp_ssp=no ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_esp_ssp" >&5 ++$as_echo "$enable_esp_ssp" >&6; } + fi + if test $enable_esp_ssp = yes ; then + +$as_echo "#define ENABLE_ESP_SSP 1" >>confdefs.h + ++ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5 +$as_echo_n "checking checking for crtbeginP.o support... " >&6; } ++ if test x$enable_esp = xyes ; then + case "$target" in + ia64*-*-linux*) + enable_crtbeginP=no ;; @@ -212,9 +338,9 @@ + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5 +$as_echo "$enable_crtbeginP" >&6; } -+ +fi + ++ # Configure the subdirectories # AC_CONFIG_SUBDIRS($subdirs) diff --git a/upstream/Changelog.txt b/upstream/Changelog.txt index d8e4764..f263591 100644 --- a/upstream/Changelog.txt +++ b/upstream/Changelog.txt @@ -1,23 +1,26 @@ -2012-08-24 Magnus Granberg <zorry@gentoo.org +2012-09-10 Magnus Granberg <zorry@gentoo.org * configure.ac Add new configure options espf. - * Makefile.in Add -fno-stack-protector when + * Makefile.tpl Add -fno-stack-protector when needed for espf. + * configure Regenerated + * Makefile.in Likewise. gcc/ * configure.ac Add new configure options espf. + Add -Wno-format-security to warn flags. + * configure Regenerated + * config.in Regenerated * Makefile.in Add -fno-PIE when needed for espf. - * config.in Add ENABLE_ESPF, - ENABLE_ESPF_FORTIFY, ENABLE_ESPF_PIE and - ENABLE_ESPF_SSP. - * config/linux.h Define ESPF_GCC_PIE_SPEC, + * config/gnu-user.h Define ESPF_GCC_PIE_SPEC, ESPF_GCC_SSP_SPEC, ESPF_CPP_UNIQUE_OPTIONS_SPEC, ESPF_DRIVER_SELF_SPECS and ESPF_EXTRA_SPECS. - * config/i386/linux.h Define DRIVER_SELF_SPECS. - * config/i386/linux64.h Likewise. + * config/i386/gnu-user64.h Define DRIVER_SELF_SPECS. * config/i386/gnu-user.h Add ESPF_EXTRA_SPECS to + SUBTARGET_EXTRA_SPECS when needed. Define + DRIVER_SELF_SPECS. + * config/i386/i386.h Add ESPF_EXTRA_SPECS to SUBTARGET_EXTRA_SPECS when needed. - * config/i386/i386.h Likewise. * gcc.c Add espf_cpp_unique_options to cpp_unique_options when needed. * c-family/c-common.c Enable warn_format when espf is @@ -27,8 +30,13 @@ libgcc/ * libgcc/Makefile.in Add -fno-PIE when needed for espf. + libcpp/ + * configure.ac Add -Wno-format-security to warn + flags. + * configure Regenerated + * config.in Regenerated -2012-08-26 Magnus Granberg <zorry@gentoo.org> +2012-09-10 Magnus Granberg <zorry@gentoo.org> Kees Cook <kees@ubuntu.com> gcc/doc/ diff --git a/upstream/Makefile.in.patch b/upstream/Makefile.in.patch deleted file mode 100644 index 9b3c173..0000000 --- a/upstream/Makefile.in.patch +++ /dev/null @@ -1,100 +0,0 @@ ---- a/Makefile.in 2012-01-02 11:59:04.000000000 +0100 -+++ b/Makefile.in 2012-06-29 00:11:30.886010145 +0200 -@@ -362,9 +362,17 @@ WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@ - BUILD_PREFIX = @BUILD_PREFIX@ - BUILD_PREFIX_1 = @BUILD_PREFIX_1@ - -+# Disable SSP on BOOT_CFLAGS, LIBCFLAGS and LIBCXXFLAGS -+enable_espf = @enable_espf@ -+ifeq ($(enable_espf),yes) -+ESPF_NOSSP_CFLAGS = -fno-stack-protector -+else -+ESPF_NOSSP_CFLAGS= -+endif -+ - # Flags to pass to stage2 and later makes. They are defined - # here so that they can be overridden by Makefile fragments. --BOOT_CFLAGS= -g -O2 -+BOOT_CFLAGS= -g -O2 $(ESPF_NOSSP_CFLAGS) - BOOT_LDFLAGS= - BOOT_ADAFLAGS=-gnatpg -gnata - -@@ -410,9 +418,9 @@ GNATMAKE = @GNATMAKE@ - - CFLAGS = @CFLAGS@ - LDFLAGS = @LDFLAGS@ --LIBCFLAGS = $(CFLAGS) -+LIBCFLAGS = $(CFLAGS) $(ESPF_NOSSP_CFLAGS) - CXXFLAGS = @CXXFLAGS@ --LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESPF_NOSSP_CFLAGS) - GOCFLAGS = $(CFLAGS) - - TFLAGS = ---- a/gcc/Makefile.in 2012-02-11 09:50:23.000000000 +0100 -+++ b/gcc/Makefile.in 2012-06-29 00:07:45.230003420 +0200 -@@ -973,14 +973,23 @@ LIBFUNCS_H = libfuncs.h $(HASHTAB_H) - # cross compiler which does not use the native headers and libraries. - INTERNAL_CFLAGS = -DIN_GCC @CROSS@ - -+# We don't want to compile the compiler with -fPIE, it make PCH fail. -+enable_espf = @enable_espf@ -+ifeq ($(enable_espf),yes) -+ESPF_NOPIE_CFLAGS = -fno-PIE -+else -+ESPF_NOPIE_CFLAGS= -+endif -+ - # This is the variable actually used when we compile. If you change this, - # you probably want to update BUILD_CFLAGS in configure.ac --ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \ -+ALL_CFLAGS = $(ESPF_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \ - $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@ - - # The C++ version. --ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \ -- $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@ -+ALL_CXXFLAGS =$(ESPF_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) \ -+ $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) \ -+ $(WARN_CXXFLAGS) @DEFS@ - - # Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro - # puts -I options in CPPFLAGS, our include files in the srcdir will always -@@ -1815,6 +1824,7 @@ libgcc.mvars: config.status Makefile spe - echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars - echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars - echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars -+ echo enable_espf = '$(enable_espf)' >> tmp-libgcc.mvars - - mv tmp-libgcc.mvars libgcc.mvars - -@@ -4893,6 +4903,9 @@ site.exp: ./config.status Makefile - @if test "@enable_lto@" = "yes" ; then \ - echo "set ENABLE_LTO 1" >> ./site.tmp; \ - fi -+ @if test "@enable_espf@" = "yes" ; then \ -+ echo "set ENABLE_ESPF 1" >> ./site.tmp; \ -+ fi - # If newlib has been configured, we need to pass -B to gcc so it can find - # newlib's crt0.o if it exists. This will cause a "path prefix not used" - # message if it doesn't, but the testsuite is supposed to ignore the message - ---- a/libgcc/Makefile.in 2011-11-22 04:01:02.000000000 +0100 -+++ b/libgcc/Makefile.in 2012-06-29 00:15:04.534016511 +0200 -@@ -275,11 +275,16 @@ override CFLAGS := $(filter-out -fprofil - INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \ - $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@ - -+ifeq ($(enable_espf),yes) -+ESPF_NOPIE_CFLAGS = -fno-PIE -+else -+ESPF_NOPIE_CFLAGS= -+endif - # Options to use when compiling crtbegin/end. - CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline -fno-exceptions \ - -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ -- -fno-stack-protector \ -+ -fno-stack-protector $(ESPF_NOPIE_CFLAGS) \ - $(INHIBIT_LIBC_CFLAGS) - - # Extra flags to use when compiling crt{begin,end}.o. diff --git a/upstream/config.in.patch b/upstream/config.in.patch deleted file mode 100644 index 7c1f849..0000000 --- a/upstream/config.in.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/gcc/config.in 2011-04-24 00:36:52.000000000 +0200 -+++ b/gcc/config.in 2011-06-24 14:17:05.166236726 +0200 -@@ -77,6 +77,29 @@ - #endif - - -+/* Define to 1 to enable espf. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_ESPF -+#endif -+ -+ -+/* Define to 1 to enable espf with FORTIFY_SOURCES. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_ESPF_FORTIFY -+#endif -+ -+ -+/* Define to 1 to enable espf with -fPIE -pie. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_ESPF_PIE -+#endif -+ -+ -+/* Define to 1 to enable espf with -fstack-protector. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_ESPF_SSP -+#endif -+ - /* Define to 1 to enable fixed-point arithmetic extension to C. */ - #ifndef USED_FOR_TARGET - #undef ENABLE_FIXED_POINT diff --git a/upstream/config_all.patch b/upstream/config_all.patch deleted file mode 100644 index 3fe4824..0000000 --- a/upstream/config_all.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/gcc/config/linux.h 2011-07-07 17:38:34.000000000 +0200 -+++ b/gcc/config/linux.h 2012-07-09 14:24:08.599281404 +0200 -@@ -104,3 +104,32 @@ see the files COPYING3 and COPYING.RUNTI - /* Whether we have Bionic libc runtime */ - #undef TARGET_HAS_BIONIC - #define TARGET_HAS_BIONIC (OPTION_BIONIC) -+ -+/* Needed by configure --enable-espf */ -+#ifdef ENABLE_ESPF -+#ifdef ENABLE_ESPF_PIE -+#define ESPF_GCC_PIE_SPEC \ -+ "%{pie|fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE| \ -+ shared|static|nostdlib|nostartfiles:;:-fPIE -pie}" -+#else -+#define ESPF_GCC_PIE_SPEC "" -+#endif -+#ifdef ENABLE_ESPF_SSP -+#define ESPF_GCC_SSP_SPEC \ -+ "%{nostdlib|nodefaultlibs|fno-stack-protector|freestanding| \ -+ fstack-protector|fstack-protector-all:;:-fstack-protector}" -+#else -+#define ESPF_GCC_SSP_SPEC "" -+#endif -+#ifdef ENABLE_ESPF_FORTIFY -+#define ESPF_CPP_UNIQUE_OPTIONS_SPEC \ -+ "%{D_FORTIFY_SOURCE|D_FORTIFY_SOURCE=*|U_FORTIFY_SOURCE:;:-D_FORTIFY_SOURCE=2}" -+#else -+#define ESPF_CPP_UNIQUE_OPTIONS_SPEC "" -+#endif -+#define ESPF_DRIVER_SELF_SPECS \ -+ ESPF_GCC_PIE_SPEC, \ -+ ESPF_GCC_SSP_SPEC -+#define ESPF_EXTRA_SPECS \ -+ { "espf_cpp_unique_options", ESPF_CPP_UNIQUE_OPTIONS_SPEC } -+#endif diff --git a/upstream/config_i386.patch b/upstream/config_i386.patch index f8c10cb..b142ccf 100644 --- a/upstream/config_i386.patch +++ b/upstream/config_i386.patch @@ -1,24 +1,36 @@ ---- a/gcc/config/i386/linux.h 2011-06-03 20:30:39.000000000 +0200 -+++ b/gcc/config/i386/linux.h 2012-07-05 21:00:38.304691613 +0200 -@@ -22,3 +22,8 @@ along with GCC; see the file COPYING3. +--- a/gcc/config/gnu-user.h 2011-04-28 18:49:49.000000000 +0200 ++++ b/gcc/config/gnu-user.h 2012-09-08 18:22:41.020729353 +0200 +@@ -98,3 +98,31 @@ see the files COPYING3 and COPYING.RUNTI - #define GNU_USER_LINK_EMULATION "elf_i386" - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + #define TARGET_C99_FUNCTIONS 1 + #define TARGET_HAS_SINCOS 1 + -+/* Needed by configure --enable-espf */ +#ifdef ENABLE_ESPF -+#define DRIVER_SELF_SPECS ESPF_DRIVER_SELF_SPECS ++#ifdef ENABLE_ESPF_PIE ++#define ESPF_GCC_PIE_SPEC \ ++"%{pie|fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE| \ ++shared|static|nostdlib|nostartfiles:;:-fPIE -pie}" ++#else ++#define ESPF_GCC_PIE_SPEC "" +#endif ---- a/gcc/config/i386/linux64.h 2011-07-07 17:38:34.000000000 +0200 -+++ b/gcc/config/i386/linux64.h 2012-07-05 20:59:39.342689855 +0200 -@@ -31,3 +31,8 @@ see the files COPYING3 and COPYING.RUNTI - #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" - #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" - #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" -+ -+/* Needed by configure --enable-espf */ -+#ifdef ENABLE_ESPF -+#define DRIVER_SELF_SPECS ESPF_DRIVER_SELF_SPECS ++#ifdef ENABLE_ESPF_SSP ++#define ESPF_GCC_SSP_SPEC \ ++"%{nostdlib|nodefaultlibs|fno-stack-protector| \ ++fstack-protector|fstack-protector-all:;:-fstack-protector}" ++#else ++#define ESPF_GCC_SSP_SPEC "" ++#endif ++#ifdef ENABLE_ESPF_FORTIFY ++#define ESPF_CPP_UNIQUE_OPTIONS_SPEC \ ++"%{D_FORTIFY_SOURCE|D_FORTIFY_SOURCE=*|U_FORTIFY_SOURCE:;:-D_FORTIFY_SOURCE=2}" ++#else ++#define ESPF_CPP_UNIQUE_OPTIONS_SPEC "" ++#endif ++#define ESPF_DRIVER_SELF_SPECS \ ++ESPF_GCC_PIE_SPEC, \ ++ESPF_GCC_SSP_SPEC ++#define ESPF_EXTRA_SPECS \ ++{ "espf_cpp_unique_options", ESPF_CPP_UNIQUE_OPTIONS_SPEC } +#endif --- a/gcc/config/i386/gnu-user.h 2011-05-05 14:32:50.000000000 +0200 +++ b/gcc/config/i386/gnu-user.h 2012-07-09 14:28:38.726289455 +0200 @@ -26,7 +38,7 @@ "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" #undef SUBTARGET_EXTRA_SPECS -+#if def ENABLE_ESPF ++#ifdef ENABLE_ESPF #define SUBTARGET_EXTRA_SPECS \ { "link_emulation", GNU_USER_LINK_EMULATION },\ - { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } @@ -40,6 +52,24 @@ #undef LINK_SPEC #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \ +@@ -202,3 +159,7 @@ along with GCC; see the file COPYING3. + #define TARGET_CAN_SPLIT_STACK + #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30 + #endif ++ ++#ifdef ENABLE_ESPF ++#define DRIVER_SELF_SPECS ESPF_DRIVER_SELF_SPECS ++#endif +--- gcc-4.8-20120302/gcc/config/i386/gnu-user64.h 2012-06-30 00:21:30.000000000 +0200 ++++ gcc-4.8-20120302-work/gcc/config/i386/gnu-user64.h 2012-09-08 18:14:03.683713936 +0200 +@@ -94,3 +94,7 @@ see the files COPYING3 and COPYING.RUNTI + + #undef WCHAR_TYPE + #define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int") ++ ++#ifdef ENABLE_ESPF ++#define DRIVER_SELF_SPECS ESPF_DRIVER_SELF_SPECS ++#endif --- a/gcc/config/i386/i386.h 2011-11-24 23:11:12.000000000 +0100 +++ b/gcc/config/i386/i386.h 2012-07-09 14:21:24.575276517 +0200 @@ -617,13 +617,16 @@ enum target_cpu_default 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]) diff --git a/upstream/gcc_doc.patch b/upstream/gcc_doc.patch index 3aa53ad..c3e876b 100644 --- a/upstream/gcc_doc.patch +++ b/upstream/gcc_doc.patch @@ -1,34 +1,37 @@ --- a/gcc/doc/invoke.texi 2012-03-01 10:57:59.000000000 +0100 +++ b/gcc/doc/invoke.texi 2012-07-30 00:57:03.766847851 +0200 -@@ -3216,6 +3216,10 @@ aspects of format checking, the options +@@ -3216,6 +3216,11 @@ aspects of format checking, the options @option{-Wformat-nonliteral}, @option{-Wformat-security}, and @option{-Wformat=2} are available, but are not included in @option{-Wall}. -+NOTE: With configure --enable-espf=@r{[}all@r{|}ssp@r{|}pie@r{]}is -+this option enabled by default for C, C++, ObjC, ObjC++. -+To disable, use @option{-Wformat=0}. ++@emph{Note:} (existing style). ++With @option{--enable-espf=@r{[}all@r{|}ssp@r{|}pie@r{]}}this option is ++enabled by default for C, C++, ObjC, ObjC++. To disable, use ++@option{-Wno-format}. + @item -Wformat-y2k @opindex Wformat-y2k @opindex Wno-format-y2k -@@ -3269,6 +3273,12 @@ currently a subset of what @option{-Wfor +@@ -3269,6 +3273,13 @@ currently a subset of what @option{-Wfor in future warnings may be added to @option{-Wformat-security} that are not included in @option{-Wformat-nonliteral}.) -+NOTE: With configure --enable-espf=@r{[}all@r{|}ssp@r{|}pie@r{]} is -+this option enabled by default for C, C++, ObjC, ObjC++. To disable, -+use @option{-Wno-format-security}, or disable all format warnings -+with @option{-Wformat=0}. To make format security warnings fatal, ++@emph{Note:} (existing style). ++With @option{--enable-espf=@r{[}all@r{|}ssp@r{|}pie@r{]}}this option is ++enabled by default for C, C++, ObjC, ObjC++. To disable, use ++@option{-Wno-format-security}, or disable all format warnings ++with @option{-Wno-format}. To make format security warnings fatal, +specify @option{-Werror=format-security}. + @item -Wformat=2 @opindex Wformat=2 @opindex Wno-format=2 -@@ -6229,6 +6239,13 @@ also turns on the following optimization +@@ -6229,6 +6239,14 @@ also turns on the following optimization Please note the warning under @option{-fgcse} about invoking @option{-O2} on programs that use computed gotos. -+NOTE: With configure --enable-espf=@r{[}all@r{|}ssp@r{|}pie@r{]}, ++@emph{Note:} (existing style). ++With @option{--enable-espf=@r{[}all@r{|}ssp@r{|}pie@r{]}}, +@option{-D_FORTIFY_SOURCE=2} is set by default, and is activated +when @option{-O} is set to 2 or higher. This enables additional +compile-time and run-time checks for several libc functions. @@ -38,11 +41,12 @@ @item -O3 @opindex O3 Optimize yet more. @option{-O3} turns on all optimizations specified -@@ -8475,6 +8492,12 @@ functions with buffers larger than 8 byt +@@ -8475,6 +8492,13 @@ functions with buffers larger than 8 byt when a function is entered and then checked when the function exits. If a guard check fails, an error message is printed and the program exits. -+NOTE: With configure --enable-espf=@r{[}all@r{|}ssp@r{]} this option ++@emph{Note:} (existing style). ++With @option{--enable-espf=@r{[}all@r{|}ssp@r{|}pie@r{]}} this option +is enabled by default for C, C++, ObjC, ObjC++, if none of +@option{-fno-stack-protector}, @option{-nostdlib}, +@option{-fno-stack-protector-all}, @option{nodefaultlibs}, @@ -51,28 +55,30 @@ @item -fstack-protector-all @opindex fstack-protector-all Like @option{-fstack-protector} except that all functions are protected. -@@ -9457,6 +9480,12 @@ For predictable results, you must also s +@@ -9457,6 +9480,13 @@ For predictable results, you must also s that were used to generate code (@option{-fpie}, @option{-fPIE}, or model suboptions) when you specify this option. -+NOTE: With configure --enable-espf=@r{[}all@r{|}pie@r{]} this option is ++@emph{Note:} (existing style). ++With @option{--enable-espf=@r{[}all@r{|}ssp@r{|}pie@r{]}} this option is +enabled by default for C, C++, ObjC, ObjC++, if none of @option{-fno-PIE}, +@option{-fno-pie}, @option{-fPIC}, @option{-fpic}, @option{-fno-PIC}, +@option{-fno-pic}, @option{-nostdlib}, @option{-nostartfiles}, -+@option{-shared}, @option{-nodefaultlibs}, nor @option{static} are found. ++@option{-shared}, @option{-nodefaultlibs}, nor @option{-static} are found. + @item -rdynamic @opindex rdynamic Pass the flag @option{-export-dynamic} to the ELF linker, on targets -@@ -19125,6 +19154,12 @@ used during linking. +@@ -19125,6 +19154,13 @@ used during linking. @code{__pie__} and @code{__PIE__}. The macros have the value 1 for @option{-fpie} and 2 for @option{-fPIE}. -+NOTE: With configure --enable-espf=@r{[}all@r{|}pie@r{]} this option is ++@emph{Note:} (existing style). ++With @option{--enable-espf=@r{[}all@r{|}ssp@r{|}pie@r{]}} this option is +enabled by default for C, C++, ObjC, ObjC++, if none of @option{-fno-PIE}, +@option{-fno-pie}, @option{-fPIC}, @option{-fpic}, @option{-fno-PIC}, +@option{-fno-pic}, @option{-nostdlib}, @option{-nostartfiles}, -+@option{-shared}, @option{-nodefaultlibs}, nor @option{static} are found. ++@option{-shared}, @option{-nodefaultlibs}, nor @option{-static} are found. + @item -fno-jump-tables @opindex fno-jump-tables @@ -92,8 +98,8 @@ +use @samp{ssp} it will turn on @option{-fstack-protection} by default if the +support is there. If you use @samp{pie} it will turn on @option{-fPIE} and +@option{-pie} by default if the support is there. If you use @samp{no} it will -+not turn on any options. We only support i?86*-*-linux*, x86_32*-*-linux* -+and x86_64*-*-linux* as target for now. ++not turn on any options. We only support i?86*-*-linux* and ++x86_64*-*-linux* as target for now. + @item --disable-libquadmath Specify that the GCC quad-precision math library should not be built. diff --git a/upstream/testsuite-hardening-format.patch b/upstream/testsuite-hardening-format.patch deleted file mode 100644 index 0d14c10..0000000 --- a/upstream/testsuite-hardening-format.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- a/gcc/testsuite/gcc.dg/charset/builtin2.c -+++ b/gcc/testsuite/gcc.dg/charset/builtin2.c -@@ -4,6 +4,7 @@ - /* { dg-do compile } */ - /* { dg-require-iconv "IBM1047" } */ - /* { dg-options "-O2 -fexec-charset=IBM1047" } */ -+/* { dg-additional-options "-Wno-format" { target espf } } */ - /* { dg-final { scan-assembler-not "printf" } } */ - /* { dg-final { scan-assembler-not "fprintf" } } */ - /* { dg-final { scan-assembler-not "sprintf" } } */ ---- a/gcc/testsuite/gcc.dg/format/format.exp -+++ b/gcc/testsuite/gcc.dg/format/format.exp -@@ -24,9 +24,16 @@ if [is_remote host] { - - load_lib gcc-dg.exp - load_lib torture-options.exp -+load_lib target-supports.exp - - torture-init --set-torture-options [list { } { -DWIDE } ] -+ -+# Disable -Wformat if we use espf. -+if [check_effective_target_espf] { -+ set-torture-options [list { -Wno-format } { -DWIDE -Wno-format } ] -+} else { -+ set-torture-options [list { } { -DWIDE } ] -+} - - dg-init - gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" - ---- a/gcc/testsuite/gcc.dg/pr30473.c -+++ b/gcc/testsuite/gcc.dg/pr30473.c -@@ -2,6 +2,7 @@ - /* Make sure this doesn't ICE. */ - /* { dg-do compile } */ - /* { dg-options "-O2" } */ -+/* { dg-additional-options "Wno-format" { target espf } } */ - - extern int sprintf (char *, const char *, ...); - ---- a/gcc/testsuite/gcc.dg/pr38902.c -+++ b/gcc/testsuite/gcc.dg/pr38902.c -@@ -2,6 +2,7 @@ - /* { dg-do run } */ - /* { dg-options "-O2 -fstack-protector" } */ - /* { dg-require-effective-target fstack_protector } */ -+/* { dg-additional-options "Wno-format" { target espf } } */ - - #ifdef DEBUG - #include <stdio.h> ---- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c 2010-09-10 01:38:23.000000000 +0200 -+++b/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c 2012-07-31 14:37:53.238554197 +0200 -@@ -1,5 +1,6 @@ - /* { dg-do run } */ - /* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */ -+/* { dg-additional-options "-Wno-format" { target espf } } */ - - struct bovid - { ---- a/gcc/testsuite/gcc.dg/torture/tls/tls-test.c 2011-06-22 19:27:07.000000000 +0200 -+++ b/gcc/testsuite/gcc.dg/torture/tls/tls-test.c 2012-08-21 23:51:33.205398132 +0200 -@@ -2,6 +2,7 @@ - /* { dg-require-effective-target tls } */ - /* { dg-require-effective-target pthread } */ - /* { dg-options "-pthread" } */ -+/* { dg-additional-options "-Wno-format" { target espf } } */ - - #include <pthread.h> - extern int printf (char *,...); ---- a/gcc/testsuite/g++.dg/abi/pragma-pack1.C 2011-06-07 23:54:07.000000000 +0200 -+++ b/gcc/testsuite/g++.dg/abi/pragma-pack1.C 2012-08-16 17:49:19.472877085 +0200 -@@ -1,4 +1,5 @@ - // PR c++/7046 -+// { dg-additional-options "-Wno-format" { target espf } } - - extern "C" int printf (const char *, ...); - ---- a/gcc/testsuite/g++.dg/cpp0x/constexpr-tuple.C 2012-08-16 17:41:19.486862781 +0200 -+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-tuple.C 2012-08-16 17:38:38.000000000 +0200 -@@ -1,5 +1,6 @@ - // PR c++/53202 - // { dg-do run { target c++11 } } -+// { dg-additional-options "-Wno-format" { target espf } } - - #include <tuple> - diff --git a/upstream/testsuite-hardening-fortify.patch b/upstream/testsuite-hardening-fortify.patch deleted file mode 100644 index 82456cc..0000000 --- a/upstream/testsuite-hardening-fortify.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/gcc/testsuite/lib/target-supports.exp 2012-02-22 12:00:21.000000000 +0100 -+++ b/gcc/testsuite/lib/target-supports.exp 2012-07-27 19:19:30.849216278 +0200 -@@ -4419,6 +4419,14 @@ proc check_effective_target_lto { } { - return [info exists ENABLE_LTO] - } - -+# Return 1 if the compiler has been configure with espf -+# (configure --enable-espf=(all|ssp|pie)) support. -+ -+proc check_effective_target_espf { } { -+ global ENABLE_ESPF -+ return [info exists ENABLE_ESPF] -+} -+ - # Return 1 if this target supports the -fsplit-stack option, 0 - # otherwise. - ---- a/gcc/testsuite/gcc.c-torture/execute/memset-1.x 2012-08-18 14:43:31.963694252 +0200 -+++ b/gcc/testsuite/gcc.c-torture/execute/memset-1.x 2012-07-27 21:47:01.000000000 +0200 -@@ -0,0 +1,6 @@ -+load_lib target-supports.exp -+ -+if { [check_effective_target_espf] } { -+ set additional_flags "-U_FORTIFY_SOURCE" -+} -+return 0 ---- a/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.x 2012-07-30 02:31:20.573793905 +0200 -+++ b/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.x 2012-07-27 21:47:01.574480025 +0200 -@@ -0,0 +1,6 @@ -+load_lib target-supports.exp -+ -+if [check_effective_target_espf] { -+ set additional_flags "-U_FORTIFY_SOURCE" -+} -+return 0 ---- a/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.x 2012-07-30 02:31:07.366794031 +0200 -+++ b/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.x 2012-07-27 21:47:01.000000000 +0200 -@@ -0,0 +1,6 @@ -+load_lib target-supports.exp -+ -+if [check_effective_target_espf] { -+ set additional_flags "-U_FORTIFY_SOURCE" -+} -+return 0 diff --git a/upstream/testsuite-hardening-piessp.patch b/upstream/testsuite-hardening-piessp.patch deleted file mode 100644 index 8991a69..0000000 --- a/upstream/testsuite-hardening-piessp.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- a/gcc/testsuite/gcc.dg/20021014-1.c 2009-10-02 01:08:07.000000000 +0200 -+++ b/gcc/testsuite/gcc.dg/20021014-1.c 2012-08-14 23:50:16.724373103 +0200 -@@ -1,6 +1,7 @@ - /* { dg-do run } */ - /* { dg-require-profiling "-p" } */ - /* { dg-options "-O2 -p" } */ -+/* { dg-additional-options "-fno-PIE" { target espf } } */ - /* { dg-options "-O2 -p -static" { target hppa*-*-hpux* } } */ - /* { dg-error "profiler" "No profiler support" { target xstormy16-*-* } 0 } */ - /* { dg-message "" "consider using `-pg' instead of `-p' with gprof(1)" { target *-*-freebsd* } 0 } */ ---- a/gcc/testsuite/gcc.dg/nest.c 2007-08-30 07:23:02.000000000 +0200 -+++ b/gcc/testsuite/gcc.dg/nest.c 2012-08-14 23:51:44.797375728 +0200 -@@ -3,6 +3,7 @@ - /* { dg-require-profiling "-pg" } */ - /* { dg-options "-O2 -pg" } */ - /* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */ -+/* { dg-additional-options "-fno-PIE" { target espf } } */ - /* { dg-error "profiler" "No profiler support" { target xstormy16-*-* } 0 } */ - - extern void abort (void); ---- a/gcc/testsuite/gcc.dg/nested-func-4.c 2007-08-30 07:23:02.000000000 +0200 -+++ b/gcc/testsuite/gcc.dg/nested-func-4.c 2012-08-14 23:52:23.337376877 +0200 -@@ -1,6 +1,7 @@ - /* { dg-do run } */ - /* { dg-options "-pg" } */ - /* { dg-options "-pg -static" { target hppa*-*-hpux* } } */ -+/* { dg-additional-options "-fno-PIE" { target espf } } */ - /* { dg-require-profiling "-pg" } */ - - extern void abort(void); ---- a/gcc/testsuite/gcc.dg/pr32450.c 2007-08-30 07:23:02.000000000 +0200 -+++ b/gcc/testsuite/gcc.dg/pr32450.c 2012-08-14 23:53:38.125379106 +0200 -@@ -5,6 +5,7 @@ - /* { dg-options "-O2 -pg" } */ - /* { dg-options "-O2 -pg -mtune=core2" { target { i?86-*-* x86_64-*-* } } } */ - /* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */ -+/* { dg-additional-options "-fno-PIE" { target espf } } */ - - extern void abort (void); - ---- a/gcc/testsuite/gcc.dg/pr43643.c 2010-04-14 18:47:15.000000000 +0200 -+++ b/gcc/testsuite/gcc.dg/pr43643.c 2012-08-14 23:54:20.084380356 +0200 -@@ -4,6 +4,7 @@ - /* { dg-require-profiling "-pg" } */ - /* { dg-options "-O2 -pg" } */ - /* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */ -+/* { dg-additional-options "-fno-PIE" { target espf } } */ - - extern char *strdup (const char *); - ---- a/gcc.dg/tree-ssa/ssa-store-ccp-3.c 2011-08-07 09:45:57.000000000 +0200 -+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-3.c 2012-08-14 23:59:24.489389427 +0200 -@@ -3,6 +3,7 @@ - defined for executables as well as shared libraries. */ - /* { dg-skip-if "" { *-*-darwin* hppa*64*-*-* mips*-*-linux* mips*-*-irix* *-*-mingw* } { "*" } { "" } } */ - /* { dg-options "-O2 -fno-common -fdump-tree-optimized" } */ -+/* { dg-skip-if "" { espf } { "*" } { "" } } */ */ - - const int conststaticvariable; - ---- a/gcc/testsuite/gcc.dg/stack-usage-1.c 2012-02-23 19:10:53.000000000 +0100 -+++ b/gcc/testsuite/gcc.dg/stack-usage-1.c 2012-08-14 23:55:37.558382664 +0200 -@@ -1,5 +1,6 @@ - /* { dg-do compile } */ - /* { dg-options "-fstack-usage" } */ -+/* { dg-additional-options "-fno-stack-protector" { target espf } } */ - - /* This is aimed at testing basic support for -fstack-usage in the back-ends. - See the SPARC back-end for example (grep flag_stack_usage_info in sparc.c). ---- a/gcc/testsuite/gcc.dg/superblock.c 2012-08-15 00:28:32.995441532 +0200 -+++ b/gcc/testsuite/gcc.dg/superblock.c 2012-08-14 23:56:30.159384232 +0200 -@@ -1,5 +1,6 @@ - /* { dg-do compile } */ - /* { dg-options "-O2 -fno-asynchronous-unwind-tables -fsched2-use-superblocks -fdump-rtl-sched2 -fdump-rtl-bbro" } */ -+/* { dg-additional-options "-fno-stack-protector" { target espf } } */ - - typedef int aligned __attribute__ ((aligned (64))); - extern void abort (void); ---- a/gcc/testsuite/g++.dg/other/anon5.C 2012-08-16 17:33:08.842848160 +0200 -+++ b/gcc/testsuite/g++.dg/other/anon5.C 2012-08-16 17:33:35.913848967 +0200 -@@ -1,6 +1,7 @@ - // PR c++/34094 - // { dg-do link { target { ! { *-*-darwin* *-*-hpux* *-*-solaris2.* alpha*-dec-osf* mips-sgi-irix* } } } } - // { dg-options "-g" } -+// { dg-additional-options "-fno-PIE" { target espf } } - - namespace { - struct c ---- a/gcc/testsuite/g++.old-deja/g++.law/profile1.C 2007-08-30 07:23:02.000000000 +0200 -+++ b/gcc/testsuite/g++.old-deja/g++.law/profile1.C 2012-08-21 20:48:15.463070406 +0200 -@@ -2,6 +2,7 @@ - // { dg-require-profiling "-pg" } - // { dg-options "-pg" } - // { dg-options "-pg -static" { target hppa*-*-hpux* } } -+// { dg-additional-options "-fno-PIE" { target espf } } - // GROUPS passed profiling - #include <stdio.h> - main() diff --git a/upstream/testsuite-hardening-printf-types.patch b/upstream/testsuite-hardening-printf-types.patch deleted file mode 100644 index 8ca807e..0000000 --- a/upstream/testsuite-hardening-printf-types.patch +++ /dev/null @@ -1,590 +0,0 @@ ---- a/gcc/testsuite/g++.dg/ext/align1.C 2002-02-06 17:18:33.000000000 +0100 -+++ b/gcc/testsuite/g++.dg/ext/align1.C 2012-08-11 02:14:51.533875779 +0200 -@@ -16,6 +16,5 @@ float f1 __attribute__ ((aligned)); - int - main (void) - { -- printf ("%d %d\n", __alignof (a1), __alignof (f1)); - return (__alignof (a1) < __alignof (f1)); - } - ---- a/gcc/testsuite/g++.old-deja/g++.law/operators28.C -+++ b/gcc/testsuite/g++.old-deja/g++.law/operators28.C -@@ -14,7 +14,8 @@ - { - void *p; - -- printf("%d %d %d\n", sz, count, type); -+ // ISO C++ does not support format size modifier "z", so use a cast -+ printf("%u %d %d\n", (unsigned int)sz, count, type); - - p = new char[sz * count]; - ((new_test *)p)->type = type; ---- a/gcc/testsuite/gcc.dg/torture/matrix-2.c -+++ b/gcc/testsuite/gcc.dg/torture/matrix-2.c -@@ -42,7 +42,7 @@ - } - for (i = 0; i < ARCHnodes; i++) - for (j = 0; j < 3; j++) -- printf ("%x\n",vel[i][j]); -+ printf ("%p\n",vel[i][j]); - /*if (i!=1 || j!=1)*/ - /*if (i==1 && j==1) - continue; -@@ -83,14 +83,14 @@ - for (j = 0; j < 3; j++) - { - vel[i][j] = (int *) malloc (ARCHnodes1 * sizeof (int)); -- printf ("%x %d %d\n",vel[i][j], ARCHnodes1, sizeof (int)); -+ printf ("%p %d %d\n",vel[i][j], ARCHnodes1, (int)sizeof (int)); - } - } - for (i = 0; i < ARCHnodes; i++) - { - for (j = 0; j < 3; j++) - { -- printf ("%x\n",vel[i][j]); -+ printf ("%p\n",vel[i][j]); - } - } - -@@ -99,7 +99,7 @@ - { - for (j = 0; j < 3; j++) - { -- printf ("%x\n",vel[i][j]); -+ printf ("%p\n",vel[i][j]); - /*for (k = 0; k < ARCHnodes1; k++) - { - vel[i][j][k] = d; ---- a/gcc/testsuite/gcc.dg/packed-vla.c -+++ b/gcc/testsuite/gcc.dg/packed-vla.c -@@ -17,8 +17,8 @@ - int b[4]; - } __attribute__ ((__packed__)) foo; - -- printf("foo %d\n", sizeof(foo)); -- printf("bar %d\n", sizeof(bar)); -+ printf("foo %d\n", (int)sizeof(foo)); -+ printf("bar %d\n", (int)sizeof(bar)); - - if (sizeof (foo) != sizeof (bar)) - abort (); ---- a/gcc/testsuite/g++.dg/opt/alias2.C -+++ b/gcc/testsuite/g++.dg/opt/alias2.C -@@ -30,14 +30,14 @@ - - - _Deque_base::~_Deque_base() { -- printf ("bb %x %x\n", this, *_M_start._M_node); -+ printf ("bb %p %x\n", this, *_M_start._M_node); - } - - void - _Deque_base::_M_initialize_map() - { - yy = 0x123; -- printf ("aa %x %x\n", this, yy); -+ printf ("aa %p %x\n", this, yy); - - _M_start._M_node = &yy; - _M_start._M_cur = yy; ---- a/gcc/testsuite/g++.old-deja/g++.abi/vbase1.C -+++ b/gcc/testsuite/g++.old-deja/g++.abi/vbase1.C -@@ -33,7 +33,7 @@ - void Offset () const - { - printf ("VBase\n"); -- printf (" VBase::member %d\n", &this->VBase::member - (int *)this); -+ printf (" VBase::member %d\n", (int)(&this->VBase::member - (int *)this)); - } - }; - -@@ -55,8 +55,8 @@ - void Offset () const - { - printf ("VDerived\n"); -- printf (" VBase::member %d\n", &this->VBase::member - (int *)this); -- printf (" VDerived::member %d\n", &this->VDerived::member - (int *)this); -+ printf (" VBase::member %d\n", (int)(&this->VBase::member - (int *)this)); -+ printf (" VDerived::member %d\n", (int)(&this->VDerived::member - (int *)this)); - } - }; - struct B : virtual VBase -@@ -65,8 +65,8 @@ - void Offset () const - { - printf ("B\n"); -- printf (" VBase::member %d\n", &this->VBase::member - (int *)this); -- printf (" B::member %d\n", &this->B::member - (int *)this); -+ printf (" VBase::member %d\n", (int)(&this->VBase::member - (int *)this)); -+ printf (" B::member %d\n", (int)(&this->B::member - (int *)this)); - } - }; - struct MostDerived : B, virtual VDerived -@@ -75,10 +75,10 @@ - void Offset () const - { - printf ("MostDerived\n"); -- printf (" VBase::member %d\n", &this->VBase::member - (int *)this); -- printf (" B::member %d\n", &this->B::member - (int *)this); -- printf (" VDerived::member %d\n", &this->VDerived::member - (int *)this); -- printf (" MostDerived::member %d\n", &this->MostDerived::member - (int *)this); -+ printf (" VBase::member %d\n", (int)(&this->VBase::member - (int *)this)); -+ printf (" B::member %d\n", (int)(&this->B::member - (int *)this)); -+ printf (" VDerived::member %d\n", (int)(&this->VDerived::member - (int *)this)); -+ printf (" MostDerived::member %d\n", (int)(&this->MostDerived::member - (int *)this)); - } - }; - -@@ -95,10 +95,10 @@ - if (ctorVDerived != &dum.VDerived::member) - return 24; - -- printf (" VBase::member %d\n", &dum.VBase::member - this_); -- printf (" B::member %d\n", &dum.B::member - this_); -- printf (" VDerived::member %d\n", &dum.VDerived::member - this_); -- printf (" MostDerived::member %d\n", &dum.MostDerived::member - this_); -+ printf (" VBase::member %d\n", (int)(&dum.VBase::member - this_)); -+ printf (" B::member %d\n", (int)(&dum.B::member - this_)); -+ printf (" VDerived::member %d\n", (int)(&dum.VDerived::member - this_)); -+ printf (" MostDerived::member %d\n", (int)(&dum.MostDerived::member - this_)); - dum.MostDerived::Offset (); - dum.B::Offset (); - dum.VDerived::Offset (); ---- a/gcc/testsuite/g++.old-deja/g++.brendan/template8.C -+++ b/gcc/testsuite/g++.old-deja/g++.brendan/template8.C -@@ -15,6 +15,6 @@ - - Double_alignt<20000> heap; - -- printf(" &heap.array[0] = %d, &heap.for_alignt = %d\n", &heap.array[0], &heap.for_alignt); -+ printf(" &heap.array[0] = %p, &heap.for_alignt = %p\n", (void*)&heap.array[0], (void*)&heap.for_alignt); - - } ---- a/gcc/testsuite/g++.old-deja/g++.eh/ptr1.C -+++ b/gcc/testsuite/g++.old-deja/g++.eh/ptr1.C -@@ -16,7 +16,7 @@ - } - - catch (E *&e) { -- printf ("address of e is 0x%lx\n", (__SIZE_TYPE__)e); -+ printf ("address of e is %p\n", (void *)e); - return !((__SIZE_TYPE__)e != 5 && e->x == 5); - } - return 2; ---- a/gcc/testsuite/g++.old-deja/g++.jason/access23.C -+++ b/gcc/testsuite/g++.old-deja/g++.jason/access23.C -@@ -42,19 +42,19 @@ - void DoSomething() { - PUB_A = 0; - Foo::A = 0; -- printf("%x\n",pX); -+ printf("%p\n",pX); - Foo::PUB.A = 0; -- printf("%x\n",PUB.pX); -+ printf("%p\n",PUB.pX); - B = 0; -- printf("%x\n",Foo::pY); -+ printf("%p\n",Foo::pY); - PRT_A = 0; - PRT.B = 0; -- printf("%x\n",Foo::PRT.pY); -+ printf("%p\n",Foo::PRT.pY); - PRV_A = 0; // { dg-error "" } - Foo::C = 0; // { dg-error "" } -- printf("%x\n",pZ); // { dg-error "" } -+ printf("%p\n",pZ); // { dg-error "" } - Foo::PRV.C = 0; // { dg-error "" } -- printf("%x\n",PRV.pZ); // { dg-error "" } -+ printf("%p\n",PRV.pZ); // { dg-error "" } - } - }; - -@@ -64,17 +64,17 @@ - - a.PUB_A = 0; - a.A = 0; -- printf("%x\n",a.pX); -+ printf("%p\n",a.pX); - a.PRT_A = 0; // { dg-error "" } - a.B = 0; // { dg-error "" } -- printf("%x\n",a.pY); // { dg-error "" } -+ printf("%p\n",a.pY); // { dg-error "" } - a.PRV_A = 0; // { dg-error "" } - a.C = 0; // { dg-error "" } -- printf("%x\n",a.pZ); // { dg-error "" } -+ printf("%p\n",a.pZ); // { dg-error "" } - a.PUB.A = 0; -- printf("%x\n",a.PUB.pX); -+ printf("%p\n",a.PUB.pX); - a.PRT.B = 0; // { dg-error "" } -- printf("%x\n",a.PRT.pY); // { dg-error "" } -+ printf("%p\n",a.PRT.pY); // { dg-error "" } - a.PRV.C = 0; // { dg-error "" } -- printf("%x\n",a.PRV.pZ); // { dg-error "" } -+ printf("%p\n",a.PRV.pZ); // { dg-error "" } - } ---- a/gcc/testsuite/g++.old-deja/g++.law/cvt8.C -+++ b/gcc/testsuite/g++.old-deja/g++.law/cvt8.C -@@ -20,12 +20,12 @@ - B::operator const A&() const { - static A a; - a.i = i; -- printf("convert B to A at %x\n", &a); -+ printf("convert B to A at %p\n", (void*)&a); - return a; - } - - void f(A &a) { // { dg-error "" } in passing argument -- printf("A at %x is %d\n", &a, a.i); -+ printf("A at %p is %d\n", (void*)&a, a.i); - } - - int main() { ---- a/gcc/testsuite/g++.old-deja/g++.mike/net35.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/net35.C -@@ -17,10 +17,10 @@ - - int main() { - C c; -- printf("&c.x = %x\n", &c.x); -- printf("&c.B1::x = %x\n", &c.B1::x); -- printf("&c.B2::x = %x\n", &c.B2::x); -- printf("&c.A::x = %x\n", &c.A::x); -+ printf("&c.x = %p\n", (void*)&c.x); -+ printf("&c.B1::x = %p\n", (void*)&c.B1::x); -+ printf("&c.B2::x = %p\n", (void*)&c.B2::x); -+ printf("&c.A::x = %p\n", (void*)&c.A::x); - if (&c.x != &c.B1::x - || &c.x != &c.B2::x - || &c.x != &c.A::x) ---- a/gcc/testsuite/g++.old-deja/g++.mike/offset1.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/offset1.C -@@ -6,7 +6,7 @@ - class Foo { - public: - virtual void setName() { -- printf("Foo at %x\n", this); -+ printf("Foo at %p\n", (void*)this); - if (vp != (void*)this) - fail = 1; - } -@@ -15,7 +15,7 @@ - class Bar : public Foo { - public: - virtual void init(int argc, char **argv) { -- printf("Bar's Foo at %x\n", (Foo*)this); -+ printf("Bar's Foo at %p\n", (void*)(Foo*)this); - vp = (void*)(Foo*)this; - setName(); - } ---- a/gcc/testsuite/g++.old-deja/g++.mike/p12306.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/p12306.C -@@ -18,7 +18,7 @@ - if (ptr2 != &(*this).slist) - fail = 6; - -- if (0) printf("at %x %x\n", (RWSlistIterator*)this, &(*this).slist); -+ if (0) printf("at %p %p\n", (void*)(RWSlistIterator*)this, (void*)&(*this).slist); - } - }; - -@@ -54,14 +54,14 @@ - void Sim_Event_Manager::post_event () { - ptr1 = (RWSlistIterator*)&last_posted_event_position_; - ptr2 = &((RWSlistIterator*)&last_posted_event_position_)->slist; -- if (0) printf("at %x %x\n", (RWSlistIterator*)&last_posted_event_position_, -- &((RWSlistIterator*)&last_posted_event_position_)->slist); -+ if (0) printf("at %p %p\n", (void*)(RWSlistIterator*)&last_posted_event_position_, -+ (void*)&((RWSlistIterator*)&last_posted_event_position_)->slist); - if (ptr1 != (RWSlistIterator*)&last_posted_event_position_) - fail = 1; - if (ptr2 != &((RWSlistIterator&)last_posted_event_position_).slist) - fail = 2; -- if (0) printf("at %x ?%x\n", (RWSlistIterator*)&last_posted_event_position_, -- &((RWSlistIterator&)last_posted_event_position_).slist); -+ if (0) printf("at %p ?%p\n", (void*)(RWSlistIterator*)&last_posted_event_position_, -+ (void*)&((RWSlistIterator&)last_posted_event_position_).slist); - if (ptr1 != (RWSlistIterator*)&last_posted_event_position_) - fail = 3; - if (ptr2 != &((RWSlistIterator&)last_posted_event_position_).slist) ---- a/gcc/testsuite/g++.old-deja/g++.mike/p3579.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/p3579.C -@@ -7,26 +7,26 @@ - - class Y { - public: -- Y () { printf("Y() this: %x\n", this); } -- ~Y () { printf("~Y() this: %x\n", this); } -+ Y () { printf("Y() this: %p\n", (void*)this); } -+ ~Y () { printf("~Y() this: %p\n", (void*)this); } - }; - - class X { - public: - X () { - ++num_x; -- printf("X() this: %x\n", this); -+ printf("X() this: %p\n", (void*)this); - Y y; - *this = (X) y; - } - -- X (const Y & yy) { printf("X(const Y&) this: %x\n", this); ++num_x; } -+ X (const Y & yy) { printf("X(const Y&) this: %p\n", (void*)this); ++num_x; } - X & operator = (const X & xx) { -- printf("X.op=(X&) this: %x\n", this); -+ printf("X.op=(X&) this: %p\n", (void*)this); - return *this; - } - -- ~X () { printf("~X() this: %x\n", this); --num_x; } -+ ~X () { printf("~X() this: %p\n", (void*)this); --num_x; } - }; - - int main (int, char **) { ---- a/gcc/testsuite/g++.old-deja/g++.mike/p3708a.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/p3708a.C -@@ -38,7 +38,7 @@ - virtual void xx(int doit) { - --num; - if (ptr != this) -- printf("FAIL\n%x != %x\n", ptr, this); -+ printf("FAIL\n%p != %p\n", ptr, (void*)this); - printf ("C is destructed.\n"); - B::xx (0); - if (doit) A::xx (1); ---- a/gcc/testsuite/g++.old-deja/g++.mike/p3708b.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/p3708b.C -@@ -48,7 +48,7 @@ - virtual void xx(int doit) { - --num; - if (ptr != this) { -- printf("FAIL\n%x != %x\n", ptr, this); -+ printf("FAIL\n%p != %p\n", ptr, (void*)this); - exit(1); - } - printf ("D is destructed.\n"); ---- a/gcc/testsuite/g++.old-deja/g++.mike/p3708.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/p3708.C -@@ -38,7 +38,7 @@ - virtual void xx(int doit) { - --num; - if (ptr != this) -- printf("FAIL\n%x != %x\n", ptr, this); -+ printf("FAIL\n%p != %p\n", ptr, (void*)this); - printf ("C is destructed.\n"); - B::xx (0); - if (doit) A::xx (1); ---- a/gcc/testsuite/g++.old-deja/g++.mike/p646.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/p646.C -@@ -35,20 +35,20 @@ - foo::foo () - { - si++; -- printf ("new foo @ 0x%x; now %d foos\n", this, si); -+ printf ("new foo @ %p; now %d foos\n", (void*)this, si); - } - - foo::foo (const foo &other) - { - si++; -- printf ("another foo @ 0x%x; now %d foos\n", this, si); -+ printf ("another foo @ %p; now %d foos\n", (void*)this, si); - *this = other; - } - - foo::~foo () - { - si--; -- printf ("deleted foo @ 0x%x; now %d foos\n", this, si); -+ printf ("deleted foo @ %p; now %d foos\n", (void*)this, si); - } - - int ---- a/gcc/testsuite/g++.old-deja/g++.mike/p710.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/p710.C -@@ -30,7 +30,7 @@ - virtual ~B() {} - void operator delete(void*,size_t s) - { -- printf("B::delete() %d\n",s); -+ printf("B::delete() %u\n",(unsigned int)s); - } - void operator delete(void*){} - }; ---- a/gcc/testsuite/g++.old-deja/g++.mike/p789a.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/p789a.C -@@ -13,10 +13,10 @@ - int x; - foo () { - x = count++; -- printf("this %d = %x\n", x, (void *)this); -+ printf("this %d = %p\n", x, (void *)this); - } - virtual ~foo () { -- printf("this %d = %x\n", x, (void *)this); -+ printf("this %d = %p\n", x, (void *)this); - --count; - } - }; -@@ -31,7 +31,7 @@ - { - for (int j = 0; j < 3; j++) - { -- printf("&a[%d][%d] = %x\n", i, j, (void *)&array[i][j]); -+ printf("&a[%d][%d] = %p\n", i, j, (void *)&array[i][j]); - } - } - // The count should be nine, if not, fail the test. ---- a/gcc/testsuite/g++.old-deja/g++.mike/pmf2.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/pmf2.C -@@ -42,7 +42,7 @@ - bar jar; - - int main() { -- printf("ptr to B_table=%x, ptr to A_table=%x\n",&b,(A_table*)&b); -+ printf("ptr to B_table=%p, ptr to A_table=%p\n",(void*)&b,(void*)(A_table*)&b); - B_table::B_ti_fn z = &B_table::func1; - int j = 1; - jar.call_fn_fn1(j,(void *)&z); ---- a/gcc/testsuite/g++.old-deja/g++.mike/temp.C -+++ b/gcc/testsuite/g++.old-deja/g++.mike/temp.C -@@ -7,11 +7,11 @@ - public: - T() { - i = 1; -- printf("T() at %x\n", this); -+ printf("T() at %p\n", (void*)this); - } - T(const T& o) { - i = o.i; -- printf("T(const T&) at %x <-- %x\n", this, &o); -+ printf("T(const T&) at %p <-- %p\n", (void*)this, (void*)&o); - } - T operator +(const T& o) { - T r; -@@ -21,7 +21,7 @@ - operator int () { - return i; - } -- ~T() { printf("~T() at %x\n", this); } -+ ~T() { printf("~T() at %p\n", (void*)this); } - } s, b; - - int foo() { return getenv("TEST") == 0; } ---- a/gcc/testsuite/g++.old-deja/g++.other/temporary1.C -+++ b/gcc/testsuite/g++.old-deja/g++.other/temporary1.C -@@ -5,16 +5,16 @@ - class Foo - { - public: -- Foo() { printf("Foo() 0x%08lx\n", (__SIZE_TYPE__)this); ++c; } -- Foo(Foo const &) { printf("Foo(Foo const &) 0x%08lx\n", (__SIZE_TYPE__)this); } -- ~Foo() { printf("~Foo() 0x%08lx\n", (__SIZE_TYPE__)this); ++d; } -+ Foo() { printf("Foo() %p\n", (void*)this); ++c; } -+ Foo(Foo const &) { printf("Foo(Foo const &) %p\n", (void*)this); } -+ ~Foo() { printf("~Foo() %p\n", (void*)this); ++d; } - }; - - // Bar creates constructs a temporary Foo() as a default - class Bar - { - public: -- Bar(Foo const & = Foo()) { printf("Bar(Foo const &) 0x%08lx\n", (__SIZE_TYPE__)this); } -+ Bar(Foo const & = Foo()) { printf("Bar(Foo const &) %p\n", (void*)this); } - }; - - void fakeRef(Bar *) ---- a/gcc/testsuite/g++.old-deja/g++.other/virtual8.C -+++ b/gcc/testsuite/g++.old-deja/g++.other/virtual8.C -@@ -4,7 +4,7 @@ - struct A - { - virtual void f () { -- printf ("%x\n", this); -+ printf ("%p\n", (void*)this); - } - }; - ---- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp23.C -+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp23.C -@@ -13,7 +13,7 @@ - - template <class U> - void f(U u) -- { printf ("In S::f(U)\nsizeof(U) == %d\n", sizeof(u)); } -+ { printf ("In S::f(U)\nsizeof(U) == %d\n", (int)sizeof(u)); } - - int c[16]; - }; ---- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp24.C -+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp24.C -@@ -13,7 +13,7 @@ - - template <class U> - void f(U u) -- { printf ("In S::f(U)\nsizeof(U) == %d\n", sizeof(u)); } -+ { printf ("In S::f(U)\nsizeof(U) == %d\n", (int)sizeof(u)); } - - int c[16]; - }; ---- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp25.C -+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp25.C -@@ -6,7 +6,7 @@ - struct S - { - template <class U> -- void f(U u) { printf ("%d\n", sizeof (U)); } -+ void f(U u) { printf ("%d\n", (int)sizeof (U)); } - - int i[4]; - }; ---- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp26.C -+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp26.C -@@ -16,7 +16,7 @@ - template <class U> - void S<X>::f(U u) - { -- printf ("%d\n", sizeof (U)); -+ printf ("%d\n", (int)sizeof (U)); - } - - ---- a/gcc/testsuite/g++.old-deja/g++.pt/t39.C -+++ b/gcc/testsuite/g++.old-deja/g++.pt/t39.C -@@ -10,9 +10,9 @@ - - template <class T> - void frob<T>::print () { -- printf ("this = %08x\n", this); -- printf (" ptr = %08x\n", ptr); -- printf (" values = %x %x %x ...\n", ptr[0], ptr[1], ptr[2]); -+ printf ("this = %p\n", (void*)this); -+ printf (" ptr = %p\n", (void*)ptr); -+ printf (" values = %x %x %x ...\n", (int)ptr[0], (int)ptr[1], (int)ptr[2]); - } - - static int x[10]; ---- a/gcc/testsuite/g++.old-deja/g++.robertl/eb17.C -+++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb17.C -@@ -44,15 +44,15 @@ - A * a = new B; - B * b = dynamic_cast<B *>(a); - -- printf("%p\n",b); // (*2*) -+ printf("%p\n",(void*)b); // (*2*) - b->print(); - - a = b; -- printf("%p\n",a); -+ printf("%p\n",(void*)a); - a->print(); - - a = a->clone(); -- printf("%p\n",a); -+ printf("%p\n",(void*)a); - a->print(); // (*1*) - - return 0; |