Before:
wasm-ld: error: Relocations not in offset order
After
wasm-ld: error: While processing `libjulia.so`: Relocations not in offset order
At least this way you get to find out which input file is malformed.
Differential D63694
[lld/WebAssembly] Slightly nicer error message for malformed input files loladiro on Jun 23 2019, 3:16 PM. Authored by
Details Before: wasm-ld: error: Relocations not in offset order After wasm-ld: error: While processing `libjulia.so`: Relocations not in offset order At least this way you get to find out which input file is malformed.
Diff Detail
Event TimelineComment Actions Thanks!
Comment Actions Ideally I'd rather see the invalid file be generated on the fly, but this is also ok since it should never really change. What about the actual test that checks for the error string? I imagine the binary would go in "Inputs" and the .test would be a text file that checks for the error. Comment Actions The test file is just \00asm ; RUN: not wasm-ld -o %t.wasm.out %s %s 2>&1 | FileCheck %s ; This file is an invalid input file with wasm magic (\00asm). ; We test that the filename is printed in the error path. ; CHECK: error: ; CHECK: corrupted.wasm.test: Bad version number I suppose fabricator has some sort of binary detection that doens't like the leading zero byte. Comment Actions Oh cool, I totally didn't think of that. I find it a bit strange to have the test script within the invalid binary wasm file, but hey if it works its kinda cool. |
I think just MB.getBufferIdentifier() should be enough. Our other error message don't include the "While processing" prefix, but the filename is certainly useful.
We should find a way to make a test. Perhaps you can do something like " echo <WASM_MAGIC>foo" > "test.o" in order to generate a bad object file.