[lld] lld allow hidden symbols shared with dso (PR #70163)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 22:23:55 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 9abf3df111793831dd2fb6dce4cf34c84a5277dc 0aaf08d978437d9a37c6d921f40691cc7617a92d -- lld/ELF/Config.h lld/ELF/Driver.cpp lld/ELF/InputFiles.cpp lld/ELF/Symbols.h lld/ELF/Writer.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 82e8b9985b61..5e937297a025 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -272,17 +272,19 @@ static void demoteDefined(Defined &sym, DenseMap<SectionBase *, size_t> &map) {
static void demoteSymbolsAndComputeIsPreemptible() {
llvm::TimeTraceScope timeScope("Demote symbols");
DenseMap<InputFile *, DenseMap<SectionBase *, size_t>> sectionIndexMap;
- bool allowHiddenSymbolsSharedWithDso = config->allowHiddenSymbolsSharedWithDso;
+ bool allowHiddenSymbolsSharedWithDso =
+ config->allowHiddenSymbolsSharedWithDso;
for (Symbol *sym : symtab.getSymbols()) {
if (auto *d = dyn_cast<Defined>(sym)) {
- if (!allowHiddenSymbolsSharedWithDso && d->visibility() == ELF::STV_HIDDEN) {
+ if (!allowHiddenSymbolsSharedWithDso &&
+ d->visibility() == ELF::STV_HIDDEN) {
auto flags = d->flags.load(std::memory_order_relaxed);
if (flags & HAS_SHARED_DEF) {
errorOrWarn("hidden symbol also defined by DSO: " + toString(*sym) +
"\n>>> defined by " + toString(d->file));
} else if (flags & HAS_SHARED_REF) {
- errorOrWarn("hidden symbol also referenced by DSO: " + toString(*sym) +
- "\n>>> defined by " + toString(d->file));
+ errorOrWarn("hidden symbol also referenced by DSO: " +
+ toString(*sym) + "\n>>> defined by " + toString(d->file));
}
}
@@ -2041,7 +2043,8 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
if (!allNeededIsKnown)
continue;
for (Symbol *sym : file->requiredSymbols)
- if (sym->isUndefined() && !sym->isWeak() && !sym->hasFlag(HAS_SHARED_DEF))
+ if (sym->isUndefined() && !sym->isWeak() &&
+ !sym->hasFlag(HAS_SHARED_DEF))
diagnose("undefined reference due to --no-allow-shlib-undefined: " +
toString(*sym) + "\n>>> referenced by " + toString(file));
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/70163
More information about the llvm-commits
mailing list