[PATCH] D87258: [WebAssembly, LowerTypeTests] Fix control-flow integrity support
Dominic Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 17:35:34 PDT 2020
ddcc added inline comments.
================
Comment at: llvm/lib/MC/WasmObjectWriter.cpp:622
// Ignore overflow. LLVM allows address arithmetic to silently wrap.
- return Segment.Offset + Ref.Offset + RelEntry.Addend;
+ return Segment.Offset + BaseRef.Offset + SymRef.Offset + RelEntry.Addend;
}
----------------
Not sure if this is entirely correct, please take a look. My understanding is that D79462 introduced a bug where it fails to add the offset from a relative symbol. Without these changes, I get the following error from the lld side:
`wasm-ld: warning: unexpected existing value for R_WASM_MEMORY_ADDR_SLEB: existing=8420 expected=8452`
After some debugging, it appears that this is a relative symbol, where the +32 offset gets missed since only the base is examined.
```
RelEntry.Symbol->getVariableValue(false): .L__unnamed_1+32
symbol: Name=.L_ZTV3Foo.0, Kind=WASM_SYMBOL_TYPE_DATA, Flags=2, Segment=62, Offset=32, Size=20
WasmObjectWriter::writeObject: Ref = {Segment = 62, Offset = 32, Size = 20}
WasmObjectWriter::getProvisionalValue: Ref = {Segment = 62, Offset = 0, Size = 52}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87258/new/
https://reviews.llvm.org/D87258
More information about the llvm-commits
mailing list