diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr19579a.c | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr19579b.c | 14 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 24 |
4 files changed, 60 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 328e51d..ac73cf8 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2016-03-04 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/19579 + * testsuite/ld-elf/pr19579a.c: New file. + * testsuite/ld-elf/pr19579b.c: Likewise. + * testsuite/ld-elf/shared.exp: Run PR ld/19579 test. + 2016-03-02 H.J. Lu <hongjiu.lu@intel.com> * testsuite/ld-elf/pr19162.d: Skip hppa-*-*. diff --git a/ld/testsuite/ld-elf/pr19579a.c b/ld/testsuite/ld-elf/pr19579a.c new file mode 100644 index 0000000..e4a6eb1 --- /dev/null +++ b/ld/testsuite/ld-elf/pr19579a.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +int foo[1]; +int bar[2]; + +extern int *foo_p (void); +extern int *bar_p (void); + +int +main () +{ + if (foo[0] == 0 && foo == foo_p () && bar[0] == 0 && bar == bar_p ()) + printf ("PASS\n"); + return 0; +} diff --git a/ld/testsuite/ld-elf/pr19579b.c b/ld/testsuite/ld-elf/pr19579b.c new file mode 100644 index 0000000..d906545 --- /dev/null +++ b/ld/testsuite/ld-elf/pr19579b.c @@ -0,0 +1,14 @@ +int foo[2]; +int bar[2] = { -1, -1 }; + +int * +foo_p (void) +{ + return foo; +} + +int * +bar_p (void) +{ + return bar; +} diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 678ab1b..ef0747d 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -524,6 +524,21 @@ if { [istarget *-*-linux*] {} \ "libpr2404b.a" \ ] \ + [list \ + "Build pr19579a.o" \ + "" "-fPIE" \ + {pr19579a.c} \ + {} \ + "libpr19579a.a" \ + ] \ + [list \ + "Build libpr19579.so" \ + "-shared" \ + "-fPIC" \ + {pr19579b.c} \ + {} \ + "libpr19579.so" \ + ] \ ] run_ld_link_exec_tests [] [list \ [list \ @@ -580,6 +595,15 @@ if { [istarget *-*-linux*] "pass.out" \ "-O2 -fPIC -I../bfd" \ ] \ + [list \ + "Run pr19579" \ + "-pie -z text tmpdir/pr19579a.o tmpdir/libpr19579.so" \ + "" \ + {dummy.c} \ + "pr19579" \ + "pass.out" \ + "-fPIE" \ + ] \ ] } |