Bug 1944513 - avoid symbol visibility issues for getauxval() r=mjf

Resolve the issue by using a system header in abseil-cpp instead of
a "private" re-declaration of getauxval().

See https://github.com/abseil/abseil-cpp/pull/1816 for the upstream change.

Differential Revision: https://phabricator.services.mozilla.com/D236213
This commit is contained in:
Dan Horák
2025-02-13 10:42:57 +00:00
parent 47bd14c98b
commit aaa5950232
2 changed files with 15 additions and 11 deletions

View File

@@ -63,8 +63,7 @@ static void __cpuid(int cpu_info[4], int info_type) {
// On linux, just use the c-library getauxval call. // On linux, just use the c-library getauxval call.
#if defined(ABSL_INTERNAL_USE_LINUX_GETAUXVAL) #if defined(ABSL_INTERNAL_USE_LINUX_GETAUXVAL)
__attribute__((visibility("default"))) #include <sys/auxv.h>
extern "C" unsigned long getauxval(unsigned long type); // NOLINT(runtime/int)
static uint32_t GetAuxval(uint32_t hwcap_type) { static uint32_t GetAuxval(uint32_t hwcap_type) {
return static_cast<uint32_t>(getauxval(hwcap_type)); return static_cast<uint32_t>(getauxval(hwcap_type));

View File

@@ -1,20 +1,25 @@
From: Mike Hommey <mh+mozilla@glandium.org> From 69187605305acf876a75c64a7665ffa725a306cb Mon Sep 17 00:00:00 2001
Date: Wed, 22 Jan 2025 05:36:40 +0900 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Subject: Bug 1942917 - Avoid trying to link getauxval as a hidden symbol. Date: Wed, 29 Jan 2025 10:22:58 +0000
Subject: Bug 1944513 - avoid symbol visibility issues for getauxval()
--- ---
abseil-cpp/absl/random/internal/randen_detect.cc | 1 + abseil-cpp/absl/random/internal/randen_detect.cc | 2 +-
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/abseil-cpp/absl/random/internal/randen_detect.cc b/abseil-cpp/absl/random/internal/randen_detect.cc diff --git a/abseil-cpp/absl/random/internal/randen_detect.cc b/abseil-cpp/absl/random/internal/randen_detect.cc
index bdeab877b98..518026d65c9 100644 index bdeab877..e23cdb32 100644
--- a/abseil-cpp/absl/random/internal/randen_detect.cc --- a/abseil-cpp/absl/random/internal/randen_detect.cc
+++ b/abseil-cpp/absl/random/internal/randen_detect.cc +++ b/abseil-cpp/absl/random/internal/randen_detect.cc
@@ -63,6 +63,7 @@ static void __cpuid(int cpu_info[4], int info_type) { @@ -63,7 +63,7 @@ static void __cpuid(int cpu_info[4], int info_type) {
// On linux, just use the c-library getauxval call. // On linux, just use the c-library getauxval call.
#if defined(ABSL_INTERNAL_USE_LINUX_GETAUXVAL) #if defined(ABSL_INTERNAL_USE_LINUX_GETAUXVAL)
+__attribute__((visibility("default"))) -extern "C" unsigned long getauxval(unsigned long type); // NOLINT(runtime/int)
extern "C" unsigned long getauxval(unsigned long type); // NOLINT(runtime/int) +#include <sys/auxv.h>
static uint32_t GetAuxval(uint32_t hwcap_type) { static uint32_t GetAuxval(uint32_t hwcap_type) {
return static_cast<uint32_t>(getauxval(hwcap_type));
--
2.47.0