[lld] ELF: Introduce --shuffle-padding flag. (PR #117653)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 25 16:46:59 PST 2024
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 30af6fb163add17a6be515200881afdff91d213a 75ad826539205c52e1d9502938bb814ce914853b --extensions cpp,h -- lld/ELF/Config.h lld/ELF/Driver.cpp lld/ELF/OutputSections.h lld/ELF/SyntheticSections.cpp lld/ELF/SyntheticSections.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 3c1ab32348..7591b5c0ff 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1445,9 +1445,9 @@ static void finalizeSynthetic(Ctx &ctx, SyntheticSection *sec) {
}
static bool canInsertPadding(OutputSection *sec) {
- StringRef s = sec->name;
- return s == ".bss" || s == ".data" || s == ".data.rel.ro" ||
- s == ".rodata" || s.starts_with(".text");
+ StringRef s = sec->name;
+ return s == ".bss" || s == ".data" || s == ".data.rel.ro" || s == ".rodata" ||
+ s.starts_with(".text");
}
static void shufflePadding(Ctx &ctx) {
@@ -1465,8 +1465,9 @@ static void shufflePadding(Ctx &ctx) {
curPtLoad = os->ptLoad;
}
for (InputSection *isec : isd->sections) {
- if (g() < (1<<28))
- tmp.push_back(make<ShufflePaddingSection>(ctx, isec->addralign, os));
+ if (g() < (1 << 28))
+ tmp.push_back(
+ make<ShufflePaddingSection>(ctx, isec->addralign, os));
tmp.push_back(isec);
}
isd->sections = std::move(tmp);
``````````
</details>
https://github.com/llvm/llvm-project/pull/117653
More information about the llvm-commits
mailing list