[lld] 1d08a19 - [ELF] Clarify --export-dynamic-symbol/--dynamic-list. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 16 17:13:12 PDT 2021
Author: Fangrui Song
Date: 2021-09-16T17:13:08-07:00
New Revision: 1d08a19a38a588a1ba39d1e0776ea331a451debd
URL: https://github.com/llvm/llvm-project/commit/1d08a19a38a588a1ba39d1e0776ea331a451debd
DIFF: https://github.com/llvm/llvm-project/commit/1d08a19a38a588a1ba39d1e0776ea331a451debd.diff
LOG: [ELF] Clarify --export-dynamic-symbol/--dynamic-list. NFC
Added:
Modified:
lld/ELF/Driver.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index dba6f64963904..34667c4a7ece6 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1377,9 +1377,19 @@ static void readConfigs(opt::InputArgList &args) {
error(arg->getSpelling() + ": " + toString(pat.takeError()));
}
- // When producing an executable, --dynamic-list specifies non-local defined
- // symbols which are required to be exported. When producing a shared object,
- // symbols not specified by --dynamic-list are non-preemptible.
+ // For -no-pie and -pie, --export-dynamic-symbol specifies defined symbols
+ // which should be exported. For -shared, references to matched non-local
+ // STV_DEFAULT symbols are not bound to definitions within the shared object,
+ // even if other options express a symbolic intention: -Bsymbolic,
+ // -Bsymbolic-functions (if STT_FUNC), --dynamic-list.
+ for (auto *arg : args.filtered(OPT_export_dynamic_symbol))
+ config->dynamicList.push_back(
+ {arg->getValue(), /*isExternCpp=*/false,
+ /*hasWildcard=*/hasWildcard(arg->getValue())});
+
+ // --export-dynamic-symbol-list specifies a list of --export-dynamic-symbol
+ // patterns. --dynamic-list is --export-dynamic-symbol-list plus -Bsymbolic
+ // like semantics.
config->symbolic =
config->bsymbolic == BsymbolicKind::All || args.hasArg(OPT_dynamic_list);
for (auto *arg :
@@ -1387,14 +1397,6 @@ static void readConfigs(opt::InputArgList &args) {
if (Optional<MemoryBufferRef> buffer = readFile(arg->getValue()))
readDynamicList(*buffer);
- // --export-dynamic-symbol specifies additional --dynamic-list symbols if any
- // other option expresses a symbolic intention: -no-pie, -pie, -Bsymbolic,
- // -Bsymbolic-functions (if STT_FUNC), --dynamic-list.
- for (auto *arg : args.filtered(OPT_export_dynamic_symbol))
- config->dynamicList.push_back(
- {arg->getValue(), /*isExternCpp=*/false,
- /*hasWildcard=*/hasWildcard(arg->getValue())});
-
for (auto *arg : args.filtered(OPT_version_script))
if (Optional<std::string> path = searchScript(arg->getValue())) {
if (Optional<MemoryBufferRef> buffer = readFile(*path))
More information about the llvm-commits
mailing list