[lld] [lld][ELF] Demote symbols in discarded sections to Undefined. (PR #68777)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 11 01:48:44 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 d5444ab26743115e42e4abb3782bbefb0e8912d0 c6cd3523ed5d8d424eda47b0b69bcdaf33af041c -- lld/ELF/Driver.cpp lld/ELF/Relocations.cpp lld/ELF/Symbols.cpp lld/ELF/Writer.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index a49e72ee96ef..d0f73f3fc4a8 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -3073,15 +3073,16 @@ void LinkerDriver::link(opt::InputArgList &args) {
if (d->section && !d->section->isLive()) {
uint32_t secIdx = 0;
if (d->file)
- secIdx = d->file->getSections().drop_while([=](auto *s) {
- return s != d->section;
- }).size();
+ secIdx = d->file->getSections()
+ .drop_while([=](auto *s) { return s != d->section; })
+ .size();
// If we don't change the binding from WEAK to GLOBAL here, the
// undefined symbol reporting will think this is undefined weak and
// not give a warning.
- Undefined(d->file, sym->getName(), sym->isWeak() ? (uint8_t)STB_GLOBAL
- : sym->binding,
- sym->stOther, sym->type, secIdx).overwrite(*sym);
+ Undefined(d->file, sym->getName(),
+ sym->isWeak() ? (uint8_t)STB_GLOBAL : sym->binding,
+ sym->stOther, sym->type, secIdx)
+ .overwrite(*sym);
}
});
}
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 7593bb14e1ff..28d2f7e0c8b8 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -722,11 +722,12 @@ template <class ELFT> void Writer<ELFT>::copyLocalSymbols() {
!dr->section->isLive()) {
uint32_t secIdx = 0;
if (dr->file)
- secIdx = dr->file->getSections().drop_while([=](auto *s) {
- return s != dr->section;
- }).size();
- Undefined(dr->file, b->getName(), b->binding,
- b->stOther, b->type, secIdx).overwrite(*b);
+ secIdx = dr->file->getSections()
+ .drop_while([=](auto *s) { return s != dr->section; })
+ .size();
+ Undefined(dr->file, b->getName(), b->binding, b->stOther, b->type,
+ secIdx)
+ .overwrite(*b);
continue;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/68777
More information about the llvm-commits
mailing list