Page MenuHomeFreeBSD

D30842.diff
No OneTemporary

D30842.diff

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

Mime Type
text/plain
Expires
Fri, May 22, 4:37 PM (12 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33424108
Default Alt Text
D30842.diff (1 KB)

Event Timeline