[2/2] Fix 32392 [2.44 Regression] gprofng fails to build on i686-linux-gnu

Message ID 20241127035327.3738529-1-vladimir.mezentsev@oracle.com
State New
Headers
Series [1/2] gprofng: skip unrecognized input command |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Vladimir Mezentsev Nov. 27, 2024, 3:53 a.m. UTC
  From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

gprofng/ChangeLog
2024-11-26  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/32392
	* libcollector/libcol_util.c (__collector_util_init): Fix warning.
---
 gprofng/libcollector/libcol_util.c | 51 ++++++------------------------
 1 file changed, 9 insertions(+), 42 deletions(-)
  

Patch

diff --git a/gprofng/libcollector/libcol_util.c b/gprofng/libcollector/libcol_util.c
index 77dc886be22..6be8b823cfe 100644
--- a/gprofng/libcollector/libcol_util.c
+++ b/gprofng/libcollector/libcol_util.c
@@ -1139,22 +1139,11 @@  __collector_util_init ()
       err = COL_ERROR_UTIL_INIT;
     }
 
-#if ARCH(Intel) && WSIZE(32)
-  ptr = dlvsym (libc, "open64", "GLIBC_2.2"); // it is in /lib/libpthread.so.0
+  ptr = dlsym (libc, "open64");
   if (ptr)
     __collector_util_funcs.open_bare = (int(*)(const char *path, int oflag, ...))ptr;
   else
-    {
-      Tprintf (DBG_LT0, "libcol_util: WARNING: dlvsym for %s@%s failed. Using dlsym() instead.", "open64", "GLIBC_2.2");
-#endif /* ARCH(Intel) && WSIZE(32) */
-      ptr = dlsym (libc, "open64");
-      if (ptr)
-	__collector_util_funcs.open_bare = (int(*)(const char *path, int oflag, ...))ptr;
-      else
-	__collector_util_funcs.open_bare = __collector_util_funcs.open;
-#if ARCH(Intel) && WSIZE(32)
-    }
-#endif /* ARCH(Intel) && WSIZE(32) */
+    __collector_util_funcs.open_bare = __collector_util_funcs.open;
 
   ptr = dlsym (libc, "close");
   if (ptr)
@@ -1183,42 +1172,20 @@  __collector_util_init ()
       err = COL_ERROR_UTIL_INIT;
     }
 
-#if ARCH(Intel) && WSIZE(32)
-  ptr = dlvsym (libc, "pwrite", "GLIBC_2.2"); // it is in /lib/libpthread.so.0
+  ptr = dlsym (libc, "pwrite");
   if (ptr)
-    __collector_util_funcs.pwrite = (ssize_t (*)(int, void*, size_t, off_t))ptr;
+    __collector_util_funcs.pwrite = (ssize_t (*)(int, const void*, size_t, off_t))ptr;
   else
     {
-      Tprintf (DBG_LT0, "libcol_util: WARNING: dlvsym for %s@%s failed. Using dlsym() instead.", "pwrite", "GLIBC_2.2");
-#endif /* ARCH(Intel) && WSIZE(32) */
-      ptr = dlsym (libc, "pwrite");
-      if (ptr)
-	__collector_util_funcs.pwrite = (ssize_t (*)(int, const void*, size_t, off_t))ptr;
-      else
-	{
-	  CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pwrite: %s\n", dlerror ());
-	  err = COL_ERROR_UTIL_INIT;
-	}
-#if ARCH(Intel) && WSIZE(32)
+      CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pwrite: %s\n", dlerror ());
+      err = COL_ERROR_UTIL_INIT;
     }
-#endif
 
-#if ARCH(Intel) && WSIZE(32)
-  ptr = dlvsym (libc, "pwrite64", "GLIBC_2.2"); // it is in /lib/libpthread.so.0
+  ptr = dlsym (libc, "pwrite64");
   if (ptr)
-    __collector_util_funcs.pwrite64_ = (ssize_t (*)())ptr;
+    __collector_util_funcs.pwrite64_ = (ssize_t (*)(int, const void*, size_t, off_t))ptr;
   else
-    {
-      Tprintf (DBG_LT0, "libcol_util: WARNING: dlvsym for %s@%s failed. Using dlsym() instead.", "pwrite64", "GLIBC_2.2");
-#endif /* ARCH(Intel) && WSIZE(32) */
-      ptr = dlsym (libc, "pwrite64");
-      if (ptr)
-	__collector_util_funcs.pwrite64_ = (ssize_t (*)(int, const void*, size_t, off_t))ptr;
-      else
-	__collector_util_funcs.pwrite64_ = __collector_util_funcs.pwrite;
-#if ARCH(Intel) && WSIZE(32)
-    }
-#endif /* ARCH(Intel) && WSIZE(32) */
+    __collector_util_funcs.pwrite64_ = __collector_util_funcs.pwrite;
 
   ptr = dlsym (libc, "lseek");
   if (ptr)