Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
IIUC this doesn't prevent the crash in lld, it just improves the error message when reading the object file?
Yes, it turns out that the crash in LLD was a special case of llvm being aware of a new symbol type but lld not being testing with it.. in practice that should be rare. It was bad luck that it bit us I think,
In ELF, we usually use yaml2obj to generate invalid object files, instead of checking in precanned binaries. You can find lots of grimar's changes migrating away from binaries.
I generally prefer that method too, however I didn't think it was possible for this kind of case. How would I generate an invalid relocation type? Currently relocations are specified with a string:
For example here is the yaml I used as a starting point for this invalid binary:
--- !WASM FileHeader: Version: 0x1 Sections: - Type: TYPE Signatures: - Index: 0 ParamTypes: [] ReturnTypes: - I32 - Type: FUNCTION FunctionTypes: [ 0 ] - Type: CODE Relocations: - Type: R_WASM_TABLE_INDEX_SLEB Index: 0 Offset: 0x4 Functions: - Index: 0 Locals: [] Body: 4181808080000B - Type: CUSTOM Name: linking Version: 2 SymbolTable: - Index: 0 Kind: FUNCTION Name: foo Flags: [ VISIBILITY_HIDDEN ] Function: 0
In this case I modified the binary to change the R_WASM_TABLE_INDEX_SLEB value to 63 (an invalid value). If I try to do that in the yaml I get:
yaml2obj out.yaml > obj.o YAML:15:26: error: unknown enumerated scalar - Type: 63 ^~ yaml2obj: error: failed to parse YAML input: Invalid argument
Also, I see a lot of ELF files (and very few yaml files) checked in directly to llvm/test/Object/Inputs/. Is that just because there is ongoing work to covert them?