diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-elf/check-ptr-eq.c | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr18718.c | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 10 |
3 files changed, 19 insertions, 5 deletions
diff --git a/ld/testsuite/ld-elf/check-ptr-eq.c b/ld/testsuite/ld-elf/check-ptr-eq.c new file mode 100644 index 0000000..874431f --- /dev/null +++ b/ld/testsuite/ld-elf/check-ptr-eq.c @@ -0,0 +1,12 @@ +extern void abort (void); + +/* Since GCC 5 folds symbol address comparison, assuming each symbol has + different address, &foo == &bar is always false for GCC 5. Use + check_ptr_eq to check if 2 addresses are the same. */ + +void +check_ptr_eq (void *p1, void *p2) +{ + if (p1 != p2) + abort (); +} diff --git a/ld/testsuite/ld-elf/pr18718.c b/ld/testsuite/ld-elf/pr18718.c index de628ef..2f4c2a3 100644 --- a/ld/testsuite/ld-elf/pr18718.c +++ b/ld/testsuite/ld-elf/pr18718.c @@ -2,6 +2,7 @@ #include <bfd_stdint.h> extern void foo (void); +extern void check_ptr_eq (void *, void *); void new_foo (void) @@ -21,6 +22,7 @@ int main(void) { bar (); + check_ptr_eq (&foo, &new_foo); printf("PASS\n"); return 0; } diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 1b6e02f..0076740 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -533,7 +533,7 @@ if { [istarget *-*-linux*] "Run pr18718" \ "" \ "" \ - { pr18718.c } \ + { pr18718.c check-ptr-eq.c } \ "pr18718" \ "pass.out" \ "-O2 -I../bfd" \ @@ -542,7 +542,7 @@ if { [istarget *-*-linux*] "Run pr18718 with PIE (1)" \ "-pie" \ "" \ - { pr18718.c } \ + { pr18718.c check-ptr-eq.c } \ "pr18718pie1" \ "pass.out" \ "-O2 -fPIE -I../bfd" \ @@ -551,7 +551,7 @@ if { [istarget *-*-linux*] "Run pr18718 with PIE (2)" \ "" \ "" \ - { pr18718.c } \ + { pr18718.c check-ptr-eq.c } \ "pr18718pie2" \ "pass.out" \ "-O2 -fPIE -I../bfd" \ @@ -560,7 +560,7 @@ if { [istarget *-*-linux*] "Run pr18718 with PIC (1)" \ "" \ "" \ - { pr18718.c } \ + { pr18718.c check-ptr-eq.c } \ "pr18718pic1" \ "pass.out" \ "-O2 -fPIC -I../bfd" \ @@ -569,7 +569,7 @@ if { [istarget *-*-linux*] "Run pr18718 with PIC (2)" \ "-pie" \ "" \ - { pr18718.c } \ + { pr18718.c check-ptr-eq.c } \ "pr18718pic2" \ "pass.out" \ "-O2 -fPIC -I../bfd" \ |