-
Notifications
You must be signed in to change notification settings - Fork 14k
[lld][WebAssembly] Add missing relocation types to the --compress-relocations path #144578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-lld-wasm @llvm/pr-subscribers-lld Author: None (SingleAccretion) ChangesFixes #110045. Reloc list reference:
Full diff: https://github.com/llvm/llvm-project/pull/144578.diff 1 Files Affected:
diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp
index 9383dcaeb4f55..af35c83e35c9b 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -225,8 +225,14 @@ static unsigned writeCompressedReloc(uint8_t *buf, const WasmRelocation &rel,
return encodeULEB128(value, buf);
case R_WASM_TABLE_INDEX_SLEB:
case R_WASM_TABLE_INDEX_SLEB64:
+ case R_WASM_TABLE_INDEX_REL_SLEB64:
case R_WASM_MEMORY_ADDR_SLEB:
case R_WASM_MEMORY_ADDR_SLEB64:
+ case R_WASM_MEMORY_ADDR_REL_SLEB:
+ case R_WASM_MEMORY_ADDR_REL_SLEB64:
+ case R_WASM_MEMORY_ADDR_TLS_SLEB:
+ case R_WASM_MEMORY_ADDR_TLS_SLEB64:
+ case R_WASM_TABLE_INDEX_REL_SLEB:
return encodeSLEB128(static_cast<int64_t>(value), buf);
default:
llvm_unreachable("unexpected relocation type");
@@ -242,11 +248,17 @@ static unsigned getRelocWidthPadded(const WasmRelocation &rel) {
case R_WASM_MEMORY_ADDR_LEB:
case R_WASM_TABLE_NUMBER_LEB:
case R_WASM_TABLE_INDEX_SLEB:
+ case R_WASM_TABLE_INDEX_REL_SLEB:
case R_WASM_MEMORY_ADDR_SLEB:
+ case R_WASM_MEMORY_ADDR_REL_SLEB:
+ case R_WASM_MEMORY_ADDR_TLS_SLEB:
return 5;
case R_WASM_TABLE_INDEX_SLEB64:
+ case R_WASM_TABLE_INDEX_REL_SLEB64:
case R_WASM_MEMORY_ADDR_LEB64:
case R_WASM_MEMORY_ADDR_SLEB64:
+ case R_WASM_MEMORY_ADDR_REL_SLEB64:
+ case R_WASM_MEMORY_ADDR_TLS_SLEB64:
return 10;
default:
llvm_unreachable("unexpected relocation type");
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I think it would be good to add all of these to current test(s) for --emit-relocs
in lld/test/wasm/
?
Agree; the current testing is a bit spartan. Will do what's possible. |
Fixes #110045.
Reloc list reference: