forked from OSchip/llvm-project
b06426da76
This option is a subset of -Bsymbolic-functions. It applies to STB_GLOBAL STT_FUNC definitions. The address of a vague linkage function (STB_WEAK STT_FUNC, e.g. an inline function, a template instantiation) seen by a -Bsymbolic-functions linked shared object may be different from the address seen from outside the shared object. Such cases are uncommon. (ELF/Mach-O programs may use `-fvisibility-inlines-hidden` to break such pointer equality. On Windows, correct dllexport and dllimport are needed to make pointer equality work. Windows link.exe enables /OPT:ICF by default so different inline functions may have the same address.) ``` // a.cc -> a.o -> a.so (-Bsymbolic-functions) inline void f() {} void *g() { return (void *)&f; } // b.cc -> b.o -> exe // The address is different! inline void f() {} ``` -Bsymbolic-non-weak-functions is a safer (C++ conforming) subset of -Bsymbolic-functions, which can make such programs work. Implementations usually emit a vague linkage definition in a COMDAT group. We could detect the group (with more code) but I feel that we should just check STB_WEAK for simplicity. A weak definition will thus serve as an escape hatch for rare cases when users want interposition on definitions. GNU ld feature request: https://sourceware.org/bugzilla/show_bug.cgi?id=27871 Longer write-up: https://maskray.me/blog/2021-05-16-elf-interposition-and-bsymbolic If Linux distributions migrate to protected non-vague-linkage external linkage functions by default, the linker option can still be handy because it allows rapid experiment without recompilation. Protected function addresses currently have deep issues in GNU ld. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D102570 |
||
---|---|---|
.. | ||
Arch | ||
AArch64ErrataFix.cpp | ||
AArch64ErrataFix.h | ||
ARMErrataFix.cpp | ||
ARMErrataFix.h | ||
CMakeLists.txt | ||
CallGraphSort.cpp | ||
CallGraphSort.h | ||
Config.h | ||
DWARF.cpp | ||
DWARF.h | ||
Driver.cpp | ||
Driver.h | ||
DriverUtils.cpp | ||
EhFrame.cpp | ||
EhFrame.h | ||
ICF.cpp | ||
ICF.h | ||
InputFiles.cpp | ||
InputFiles.h | ||
InputSection.cpp | ||
InputSection.h | ||
LTO.cpp | ||
LTO.h | ||
LinkerScript.cpp | ||
LinkerScript.h | ||
MapFile.cpp | ||
MapFile.h | ||
MarkLive.cpp | ||
MarkLive.h | ||
Options.td | ||
OutputSections.cpp | ||
OutputSections.h | ||
README.md | ||
Relocations.cpp | ||
Relocations.h | ||
ScriptLexer.cpp | ||
ScriptLexer.h | ||
ScriptParser.cpp | ||
ScriptParser.h | ||
SymbolTable.cpp | ||
SymbolTable.h | ||
Symbols.cpp | ||
Symbols.h | ||
SyntheticSections.cpp | ||
SyntheticSections.h | ||
Target.cpp | ||
Target.h | ||
Thunks.cpp | ||
Thunks.h | ||
Writer.cpp | ||
Writer.h |
README.md
See docs/NewLLD.rst