[lld] [lld][WebAssembly] Error on unexptected relocation types in `-pie/`-shared` data sections (PR #162117)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 6 09:57:43 PDT 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 origin/main HEAD --extensions cpp -- lld/wasm/InputChunks.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</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 f5e9c4a04..d40cd7a5e 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -409,11 +409,9 @@ uint64_t InputChunk::getVA(uint64_t offset) const {
bool isValidRuntimeRelocation(WasmRelocType type) {
// TODO(https://github.com/llvm/llvm-project/issues/146923): Add
// R_WASM_FUNCTION_INDEX_I32 to this list
- return type == R_WASM_TABLE_INDEX_I32 ||
- type == R_WASM_TABLE_INDEX_I64 ||
+ return type == R_WASM_TABLE_INDEX_I32 || type == R_WASM_TABLE_INDEX_I64 ||
type == R_WASM_MEMORY_ADDR_LOCREL_I32 ||
- type == R_WASM_MEMORY_ADDR_I32 ||
- type == R_WASM_MEMORY_ADDR_I64;
+ type == R_WASM_MEMORY_ADDR_I32 || type == R_WASM_MEMORY_ADDR_I64;
}
// Generate code to apply relocations to the data section at runtime.
@@ -437,10 +435,10 @@ bool InputChunk::generateRelocationCode(raw_ostream &os) const {
uint64_t offset = getVA(rel.Offset) - getInputSectionOffset();
if (!isValidRuntimeRelocation(rel.getType())) {
- error("invalid relocation type in data section: " + relocTypetoString(rel.Type));
+ error("invalid relocation type in data section: " +
+ relocTypetoString(rel.Type));
}
-
Symbol *sym = file->getSymbol(rel);
// Runtime relocations are needed when we don't know the address of
// a symbol statically.
``````````
</details>
https://github.com/llvm/llvm-project/pull/162117
More information about the llvm-commits
mailing list