This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb/binutils-2_28-branch] ld testsuite function pointer comparisons vs. hppa
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 16 Feb 2017 15:15:45 -0000
- Subject: [binutils-gdb/binutils-2_28-branch] ld testsuite function pointer comparisons vs. hppa
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ce6972168908238be5cb86a92ba016cc5ca0171b
commit ce6972168908238be5cb86a92ba016cc5ca0171b
Author: Alan Modra <amodra@gmail.com>
Date: Thu Feb 16 22:19:10 2017 +1030
ld testsuite function pointer comparisons vs. hppa
ld/testsuite/ld-elf/check-ptr-eq.c fails for hppa, since function
pointers may point at plabels. It isn't valid to cast two function
pointers to void* and then compare the void pointers.
* testsuite/ld-elf/check-ptr-eq.c (check_ptr_eq): Change params
from void pointers to function pointers.
* testsuite/ld-elf/pr18718.c: Update to suit.
* testsuite/ld-elf/pr18720a.c: Update to suit.
Diff:
---
ld/ChangeLog | 7 +++++++
ld/testsuite/ld-elf/check-ptr-eq.c | 6 +++---
ld/testsuite/ld-elf/pr18718.c | 2 +-
ld/testsuite/ld-elf/pr18720a.c | 2 +-
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7fdcf3a..c5c5583 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,12 @@
2017-02-16 Alan Modra <amodra@gmail.com>
+ * testsuite/ld-elf/check-ptr-eq.c (check_ptr_eq): Change params
+ from void pointers to function pointers.
+ * testsuite/ld-elf/pr18718.c: Update to suit.
+ * testsuite/ld-elf/pr18720a.c: Update to suit.
+
+2017-02-16 Alan Modra <amodra@gmail.com>
+
PR 21000
* testsuite/ld-elf/loadaddr1.d: Adjust for hppa file offsets.
* testsuite/ld-elf/loadaddr2.d: Likewise.
diff --git a/ld/testsuite/ld-elf/check-ptr-eq.c b/ld/testsuite/ld-elf/check-ptr-eq.c
index 874431f..c1d5ef6 100644
--- a/ld/testsuite/ld-elf/check-ptr-eq.c
+++ b/ld/testsuite/ld-elf/check-ptr-eq.c
@@ -2,11 +2,11 @@ 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. */
+ check_ptr_eq to check if two functions are the same. */
void
-check_ptr_eq (void *p1, void *p2)
+check_ptr_eq (void (*f1) (void), void (*f2) (void))
{
- if (p1 != p2)
+ if (f1 != f2)
abort ();
}
diff --git a/ld/testsuite/ld-elf/pr18718.c b/ld/testsuite/ld-elf/pr18718.c
index 9cf15e8..426f46a 100644
--- a/ld/testsuite/ld-elf/pr18718.c
+++ b/ld/testsuite/ld-elf/pr18718.c
@@ -2,7 +2,7 @@
#include <bfd_stdint.h>
extern void foo (void);
-extern void check_ptr_eq (void *, void *);
+extern void check_ptr_eq (void (*) (void), void (*) (void));
void
new_foo (void)
diff --git a/ld/testsuite/ld-elf/pr18720a.c b/ld/testsuite/ld-elf/pr18720a.c
index 752623b..b4a3369 100644
--- a/ld/testsuite/ld-elf/pr18720a.c
+++ b/ld/testsuite/ld-elf/pr18720a.c
@@ -3,7 +3,7 @@
extern void bar (void);
extern void foo (void);
extern void foo_alias (void);
-extern void check_ptr_eq (void *, void *);
+extern void check_ptr_eq (void (*) (void), void (*) (void));
#if defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 4005
__attribute__ ((noinline, noclone))