From: Mike Frysinger <vapier@gentoo.org>
To: libc-ports@sourceware.org
Subject: [PATCH/RFC] ia64: fix strict aliasing warnings with ENTRY_POINT
Date: Sun, 10 Mar 2013 12:11:00 -0000 [thread overview]
Message-ID: <1362917653-765-1-git-send-email-vapier@gentoo.org> (raw)
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
next reply other threads:[~2013-03-10 12:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-10 12:11 Mike Frysinger [this message]
2013-03-11 2:12 ` [PATCH v2] ia64: fix strict aliasing warnings with func descriptors Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1362917653-765-1-git-send-email-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=libc-ports@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).