public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: vladimir.mezentsev@oracle.com
To: binutils@sourceware.org
Cc: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Subject: [PATCH 1/2] gprofng: PR30036 Build failure on aarch64 w/ glibc: symbol `pwrite64' is already defined
Date: Thu, 16 Feb 2023 20:40:33 -0800	[thread overview]
Message-ID: <20230217044033.2131866-1-vladimir.mezentsev@oracle.com> (raw)

From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

gprofng/ChangeLog
2023-02-16  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/30036
	* libcollector/iotrace.c: Define creat64 and pwrite64 only when
	__USE_LARGEFILE64 and __USE_FILE_OFFSET64 are not defined.
	* libcollector/mmaptrace.c: Likewise for mmap64.
---
 gprofng/libcollector/iotrace.c   | 15 ++++++++-------
 gprofng/libcollector/mmaptrace.c |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gprofng/libcollector/iotrace.c b/gprofng/libcollector/iotrace.c
index af90cc31f1a..d8439b02b3a 100644
--- a/gprofng/libcollector/iotrace.c
+++ b/gprofng/libcollector/iotrace.c
@@ -1441,7 +1441,7 @@ creat (const char *path, mode_t mode)
 }
 
 /*------------------------------------------------------------- creat64 */
-#if WSIZE(32)
+#if WSIZE(32) && !defined(__USE_LARGEFILE64)
 int
 creat64 (const char *path, mode_t mode)
 {
@@ -2476,7 +2476,7 @@ __collector_pwrite_2_1 (int fildes, const void *buf, size_t nbyte, off_t offset)
   return ret;
 }
 
-#else
+#endif
 ssize_t
 pwrite (int fildes, const void *buf, size_t nbyte, off_t offset)
 {
@@ -2497,11 +2497,10 @@ pwrite (int fildes, const void *buf, size_t nbyte, off_t offset)
   POP_REENTRANCE (guard);
   return ret;
 }
-#endif
 
 /*------------------------------------------------------------- pwrite64 */
-#if WSIZE(32)
-#if !defined(__MUSL_LIBC) && ARCH(Intel)
+#if WSIZE(32) && ARCH(Intel)
+#if !defined(__MUSL_LIBC)
 // map interposed symbol versions
 
 SYMVER_ATTRIBUTE (__collector_pwrite64_2_2, pwrite64@GLIBC_2.2)
@@ -2547,8 +2546,9 @@ __collector_pwrite64_2_1 (int fildes, const void *buf, size_t nbyte, off64_t off
   POP_REENTRANCE (guard);
   return ret;
 }
+#endif
 
-#else
+#if !defined(__USE_FILE_OFFSET64)
 ssize_t
 pwrite64 (int fildes, const void *buf, size_t nbyte, off64_t offset)
 {
@@ -2570,7 +2570,8 @@ pwrite64 (int fildes, const void *buf, size_t nbyte, off64_t offset)
   return ret;
 }
 #endif
-#endif /* SIZE(32) */
+
+#endif /* SIZE(32)  && ARCH(Intel) */
 
 /*------------------------------------------------------------- fgets */
 char*
diff --git a/gprofng/libcollector/mmaptrace.c b/gprofng/libcollector/mmaptrace.c
index 61613c21560..221b4e2d176 100644
--- a/gprofng/libcollector/mmaptrace.c
+++ b/gprofng/libcollector/mmaptrace.c
@@ -1494,7 +1494,7 @@ mmap (void *start, size_t length, int prot, int flags, int fd, off_t offset)
 }
 
 /*------------------------------------------------------------- mmap64 */
-#if WSIZE(32)       /* mmap64 only defined for non-64-bit */
+#if WSIZE(32) && !defined(__USE_FILE_OFFSET64)
 
 void *
 mmap64 (void *start, size_t length, int prot, int flags, int fd, off64_t offset)
-- 
2.31.1


                 reply	other threads:[~2023-02-17  4:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230217044033.2131866-1-vladimir.mezentsev@oracle.com \
    --to=vladimir.mezentsev@oracle.com \
    --cc=binutils@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).