path: root/src/internal/vis.h
diff options
authorRich Felker <>2015-11-19 20:28:08 -0500
committerRich Felker <>2015-11-19 22:10:55 -0500
commit19caa25d0a8e587bb89b79c3f629085548709dd4 (patch)
tree479d4a303ea7a1a0d0efb511fa09d80730a7e513 /src/internal/vis.h
parent4f3a92881aa1fd9a3ebebe2c9940d70c95a7b0e6 (diff)
remove undef weak refs to init/fini array symbols in
commit ad1cd43a86645ba2d4f7c8747240452a349d6bc1 eliminated preprocessor-level omission of references to the init/fini array symbols from object files going into the references are weak, and the intent was that the linker would resolve them to zero in, but instead it leaves undefined references that could be satisfied at runtime. normally these references would be harmless, since the code using them does not even get executed, but some older binutils versions produce a linking error: when linking a program against, ld first tries to use the hidden init/fini array symbols produced by the linker script to satisfy the references in, then produces an error because the definitions are hidden. ideally ld would have already provided definitions of these symbols when linking, but the linker script for -shared omits them. to avoid this situation, the dynamic linker now provides its own dummy definitions of the init/fini array symbols for since they are hidden, everything binds at ld time and no references remain in the dynamic symbol table. with modern binutils and --gc-sections, both the dummy empty array objects and the code referencing them get dropped at link time, anyway. the _init and _fini symbols are also switched back to using weak definitions rather than weak references since the latter behave somewhat problematically in general, and the weak definition approach was known to work well.
Diffstat (limited to 'src/internal/vis.h')
1 files changed, 1 insertions, 6 deletions
diff --git a/src/internal/vis.h b/src/internal/vis.h
index 02bfbda8..8414179e 100644
--- a/src/internal/vis.h
+++ b/src/internal/vis.h
@@ -8,8 +8,7 @@
/* Conceptually, all symbols should be protected, but some toolchains
* fail to support copy relocations for protected data, so exclude all
- * exported data symbols. Also omit visibility for possibly-undefined
- * weak references. */
+ * exported data symbols. */
extern struct _IO_FILE *const stdin, *const stdout, *const stderr;
@@ -23,10 +22,6 @@ extern long timezone, __timezone;
extern char *optarg, **environ, **__environ, *tzname[2], *__tzname[2], *__progname, *__progname_full;
-extern void (*const __init_array_start)(), (*const __init_array_end)(),
- (*const __fini_array_start)(), (*const __fini_array_end)();
#pragma GCC visibility push(protected)