aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Granberg <zorry@gentoo.org>2012-08-21 22:10:11 +0200
committerMagnus Granberg <zorry@gentoo.org>2012-08-21 22:10:11 +0200
commit35167b3faba4a431156102e48c2375d3c036a40b (patch)
treea137f97569a34d9c5990378f439a13e706411304
parentupdated upstream patches with small fixes in gcc.c (diff)
downloadhardened-gccpatchset-35167b3faba4a431156102e48c2375d3c036a40b.tar.gz
hardened-gccpatchset-35167b3faba4a431156102e48c2375d3c036a40b.tar.bz2
hardened-gccpatchset-35167b3faba4a431156102e48c2375d3c036a40b.zip
update the testsuite patches
-rw-r--r--upstream/testsuite-hardening-format.patch87
-rw-r--r--upstream/testsuite-hardening-printf-types.patch590
-rw-r--r--upstream/testsuite.patch9
-rw-r--r--upstream/testsuite_no_espf.patch98
4 files changed, 784 insertions, 0 deletions
diff --git a/upstream/testsuite-hardening-format.patch b/upstream/testsuite-hardening-format.patch
new file mode 100644
index 0000000..3b9583d
--- /dev/null
+++ b/upstream/testsuite-hardening-format.patch
@@ -0,0 +1,87 @@
+--- 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-07-31 14:40:00.411552986 +0200
+@@ -1,7 +1,8 @@
+ /* { 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-printf-types.patch b/upstream/testsuite-hardening-printf-types.patch
new file mode 100644
index 0000000..4fa6b5d
--- /dev/null
+++ b/upstream/testsuite-hardening-printf-types.patch
@@ -0,0 +1,590 @@
+--- 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];
+ };
+--- agcc/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;
diff --git a/upstream/testsuite.patch b/upstream/testsuite.patch
index 50d06e5..82456cc 100644
--- a/upstream/testsuite.patch
+++ b/upstream/testsuite.patch
@@ -15,6 +15,15 @@
# 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 @@
diff --git a/upstream/testsuite_no_espf.patch b/upstream/testsuite_no_espf.patch
new file mode 100644
index 0000000..8991a69
--- /dev/null
+++ b/upstream/testsuite_no_espf.patch
@@ -0,0 +1,98 @@
+--- 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()