Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157454559
D30842.id91161.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D30842.id91161.diff
View Options
Index: lib/libc/gen/getprogname.c
===================================================================
--- lib/libc/gen/getprogname.c
+++ lib/libc/gen/getprogname.c
@@ -7,6 +7,15 @@
#include "libc_private.h"
+#ifdef PIC
+/*
+ * Note: __progname is defined in the main executable, but we add a weak
+ * definition to libc.so to allow linking other shared libraries with
+ * -Wl,--no-undefined/-Wl,--no-allow-shlib-undefined
+ */
+__weak_symbol const char *__progname = NULL;
+#endif
+
__weak_reference(_getprogname, getprogname);
const char *
Index: lib/libc/stdlib/Symbol.map
===================================================================
--- lib/libc/stdlib/Symbol.map
+++ lib/libc/stdlib/Symbol.map
@@ -134,4 +134,10 @@
__libc_system;
__cxa_thread_call_dtors;
__libc_atexit;
+ /*
+ * These are provided by the csu code in the main executable, but need
+ * to be defined in libc.so to allow linking with -Wl,--no-undefined:
+ */
+ __progname;
+ environ;
};
Index: lib/libc/stdlib/getenv.c
===================================================================
--- lib/libc/stdlib/getenv.c
+++ lib/libc/stdlib/getenv.c
@@ -57,6 +57,14 @@
* (re)builds of the environment.
*/
extern char **environ;
+#if defined(PIC) && !defined(IN_RTLD)
+/*
+ * Note: environ is defined in the main executable, but we add a weak
+ * definition to libc.so to allow linking other shared libraries with
+ * -Wl,--no-undefined/-Wl,--no-allow-shlib-undefined
+ */
+__weak_symbol char **environ = NULL;
+#endif
static char **origEnviron;
static char **intEnviron = NULL;
static int environSize = 0;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 22, 3:34 PM (6 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33424108
Default Alt Text
D30842.id91161.diff (1 KB)
Attached To
Mode
D30842: Export a weak __progname and environ symbol from libc.so
Attached
Detach File
Event Timeline
Log In to Comment