[lld] [lld][Wasm] Do not emit relocs against dead symbols (PR #129346)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 17:52:05 PST 2025
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 743571b5f11599232a2a0a9c396827782ed4868c 8436f5a0a0b4c96c011e1b1533a133b683b4d996 --extensions h,cpp -- lld/wasm/InputChunks.cpp lld/wasm/InputChunks.h lld/wasm/OutputSections.cpp lld/wasm/OutputSections.h lld/wasm/Symbols.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp
index 0558f64aa7..7a8409ffc2 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -167,15 +167,16 @@ void InputChunk::relocate(uint8_t *buf) const {
}
}
-static bool relocIsLive(const WasmRelocation& rel, ObjFile* file) {
+static bool relocIsLive(const WasmRelocation &rel, ObjFile *file) {
return rel.Type == R_WASM_TYPE_INDEX_LEB ||
- file->getSymbol(rel.Index)->isLive();
+ file->getSymbol(rel.Index)->isLive();
}
size_t InputChunk::getNumLiveRelocations() const {
size_t result = 0;
- for (const WasmRelocation& rel : relocations) {
- if (relocIsLive(rel, file)) result ++;
+ for (const WasmRelocation &rel : relocations) {
+ if (relocIsLive(rel, file))
+ result++;
}
return result;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/129346
More information about the llvm-commits
mailing list