diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-11-13 14:47:03 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-01-09 09:32:58 -0800 |
commit | 391c2c35ce15c186ef3daeb0cb823423cb517e67 (patch) | |
tree | 599823a0e91f614aeb743a9fad72008cdb985c74 | |
parent | 37c28ba4dc86613d510cd8fafc16f2993a11254e (diff) | |
download | binutils-gdb-users/hjl/pr22393/relro.tar.gz |
x86-64: Add tests for -z separate-code -z max-page-size=0x1000users/hjl/pr22393/relro
PR ld/22393
* testsuite/ld-x86-64/pr22393-3a.c: New file.
* testsuite/ld-x86-64/pr22393-3a.rd: Likewise.
* testsuite/ld-x86-64/pr22393-3b.c: Likewise.
* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run tests for -z separate-code
-z max-page-size=0x1000.
-rw-r--r-- | ld/testsuite/ld-x86-64/pr22393-3a.c | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr22393-3a.rd | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr22393-3b.c | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr22393-3b.rd | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 71 |
5 files changed, 103 insertions, 0 deletions
diff --git a/ld/testsuite/ld-x86-64/pr22393-3a.c b/ld/testsuite/ld-x86-64/pr22393-3a.c new file mode 100644 index 00000000000..68fa4a0dd04 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22393-3a.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +void +test() +{ + printf ("PASS\n"); +} diff --git a/ld/testsuite/ld-x86-64/pr22393-3a.rd b/ld/testsuite/ld-x86-64/pr22393-3a.rd new file mode 100644 index 00000000000..b7ba1100952 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22393-3a.rd @@ -0,0 +1,9 @@ +#source: pr22393-1.s +#ld: -shared -z textonly +#readelf: -l --wide +#target: *-*-linux-gnu *-*-gnu* *-*-nacl* + +#failif +#... + +[0-9]+ +.*(\.note|\.gnu|\.hash|\.dyn|\.rel).*\.text.* +#... diff --git a/ld/testsuite/ld-x86-64/pr22393-3b.c b/ld/testsuite/ld-x86-64/pr22393-3b.c new file mode 100644 index 00000000000..3033809b02d --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22393-3b.c @@ -0,0 +1,7 @@ +void test(void); + +int main() +{ + test(); + return 0; +} diff --git a/ld/testsuite/ld-x86-64/pr22393-3b.rd b/ld/testsuite/ld-x86-64/pr22393-3b.rd new file mode 100644 index 00000000000..b7ba1100952 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr22393-3b.rd @@ -0,0 +1,9 @@ +#source: pr22393-1.s +#ld: -shared -z textonly +#readelf: -l --wide +#target: *-*-linux-gnu *-*-gnu* *-*-nacl* + +#failif +#... + +[0-9]+ +.*(\.note|\.gnu|\.hash|\.dyn|\.rel).*\.text.* +#... diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 1f32b2331d1..e7f338ee11e 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -1105,6 +1105,51 @@ if { [isnative] && [which $CC] != 0 } { {} \ "pr22064.so" \ ] \ + [list \ + "Build pr22393-3a.so" \ + "-shared -Wl,-z,separate-code,-z,max-page-size=0x1000" \ + "-fPIC" \ + {pr22393-3a.c} \ + {{readelf -lW pr22393-3a.rd} \ + {readelf -lW pr22393-3b.rd}} \ + "pr22393-3a.so" \ + ] \ + [list \ + "Build pr22393-3a-now.so" \ + "-shared -Wl,-z,separate-code,-z,now,-z,max-page-size=0x1000" \ + "-fPIC" \ + {pr22393-3a.c} \ + {{readelf -lW pr22393-3a.rd} \ + {readelf -lW pr22393-3b.rd}} \ + "pr22393-3a-now.so" \ + ] \ + [list \ + "Build pr22393-3" \ + "$NOPIE_LDFLAGS -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-2a.so" \ + "$NOPIE_CFLAGS" \ + {pr22393-3b.c} \ + {{readelf -lW pr22393-3a.rd} \ + {readelf -lW pr22393-3b.rd}} \ + "pr22393-3" \ + ] \ + [list \ + "Build pr22393-3 (PIE)" \ + "-pie -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-2a-now.so" \ + "-fPIE" \ + {pr22393-3b.c} \ + {{readelf -lW pr22393-3a.rd} \ + {readelf -lW pr22393-3b.rd}} \ + "pr22393-3-pie" \ + ] \ + [list \ + "Build pr22393-3 (static)" \ + "-static -Wl,-z,separate-code,-z,max-page-size=0x1000" \ + "" \ + {pr22393-3a.c pr22393-3b.c} \ + {{readelf -lW pr22393-3a.rd} \ + {readelf -lW pr22393-3b.rd}} \ + "pr22393-3-static" \ + ] \ ] if {[istarget "x86_64-*-linux*-gnux32"]} { @@ -1404,6 +1449,32 @@ if { [isnative] && [which $CC] != 0 } { "pass.out" \ "-fPIE" \ ] \ + [list \ + "Run pr22393-3" \ + "$NOPIE_LDFLAGS -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a.so" \ + "" \ + {pr22393-3b.c} \ + "pr22393-3" \ + "pass.out" \ + "$NOPIE_CFLAGS" \ + ] \ + [list \ + "Run pr22393-3 (PIE)" \ + "-pie -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a-now.so" \ + "" \ + {pr22393-3b.c} \ + "pr22393-3-pie" \ + "pass.out" \ + "-fPIE" \ + ] \ + [list \ + "Run pr22393-3 (static)" \ + "-static -Wl,-z,separate-code,-z,max-page-size=0x1000" \ + "" \ + {pr22393-3a.c pr22393-3b.c} \ + "pr22393-3-static" \ + "pass.out" \ + ] \ ] # Run-time tests which require working ifunc attribute support. |