Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alk/d97b2df483dfc512621385c53bd6f63f to your computer and use it in GitHub Desktop.
Save alk/d97b2df483dfc512621385c53bd6f63f to your computer and use it in GitHub Desktop.
From 4cd069d0ef876dc1053d09c9785a6cd451061f19 Mon Sep 17 00:00:00 2001
From: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Date: Mon, 22 May 2017 03:18:11 -0700
Subject: [PATCH] Use hidden visibility for TCMallocGetenvSafe
Because otherwise it might be unsafe to call it from ifunc
handler (when non-lazy symbol binding is in effect).
---
src/base/sysinfo.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/base/sysinfo.cc b/src/base/sysinfo.cc
index 36f7067..b03b719 100644
--- a/src/base/sysinfo.cc
+++ b/src/base/sysinfo.cc
@@ -152,7 +152,7 @@ static size_t slow_strlen(const char *s) {
// system calls to read the file, and thus avoid setting errno.
// /proc/self/environ has a limit of how much data it exports (around
// 8K), so it's not an ideal solution.
-const char* GetenvBeforeMain(const char* name) {
+ATTRIBUTE_HIDDEN const char* GetenvBeforeMain(const char* name) {
const int namelen = slow_strlen(name);
#if defined(HAVE___ENVIRON) // if we have it, it's declared in unistd.h
if (__environ) { // can exist but be NULL, if statically linked
@@ -201,7 +201,7 @@ const char* GetenvBeforeMain(const char* name) {
}
extern "C" {
- const char* TCMallocGetenvSafe(const char* name) {
+ ATTRIBUTE_HIDDEN const char* TCMallocGetenvSafe(const char* name) {
return GetenvBeforeMain(name);
}
}
--
2.11.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment