This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
[PATCH/RFC] ia64: fix strict aliasing warnings with ENTRY_POINT
- From: Mike Frysinger <vapier at gentoo dot org>
- To: libc-ports at sourceware dot org
- Date: Sun, 10 Mar 2013 08:14:13 -0400
- Subject: [PATCH/RFC] ia64: fix strict aliasing warnings with ENTRY_POINT
Function pointers on ia64 are like parisc -- they're plabels. While
the parisc port enjoys a gcc builtin for extracting the address here,
ia64 has no such luck.
Casting & dereferencing in one go triggers a strict aliasing warning.
Use a union to fix that.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
ports/ChangeLog.ia64 | 4 ++++
ports/sysdeps/ia64/entry.h | 12 ++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/ports/ChangeLog.ia64 b/ports/ChangeLog.ia64
index 46e2dd9..fec4f40 100644
--- a/ports/ChangeLog.ia64
+++ b/ports/ChangeLog.ia64
@@ -1,5 +1,9 @@
2013-03-10 Mike Frysinger <vapier@gentoo.org>
+ * sysdeps/ia64/entry.h (ENTRY_POINT): Change to a union.
+
+2013-03-10 Mike Frysinger <vapier@gentoo.org>
+
* sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h:
Change multiple inclusion guard to _LINUX_IA64_DL_SYSDEP_H.
Use #include_next.
diff --git a/ports/sysdeps/ia64/entry.h b/ports/sysdeps/ia64/entry.h
index b93e1b6..36f35a6 100644
--- a/ports/sysdeps/ia64/entry.h
+++ b/ports/sysdeps/ia64/entry.h
@@ -3,8 +3,16 @@ extern void _start (void);
#endif
/* The function's entry point is stored in the first word of the
- function descriptor (plabel) of _start(). */
-#define ENTRY_POINT (((long int *) _start)[0])
+ function descriptor (plabel) of _start(). Get tricky to avoid
+ strict aliasing warnings. */
+#define ENTRY_POINT \
+ ({ union { \
+ void *_start; \
+ long int *_ints; \
+ } _u; \
+ _u._start = _start; \
+ _u._ints[0]; \
+ })
/* We have to provide a special declaration. */
#define ENTRY_POINT_DECL(class) class void _start (void);
--
1.8.1.2