This commit factors out a WasmTableType definition from WasmTable, as is the case for WasmGlobal and other data types. Also add support for extracting the SymbolName for a table from the linking section's symbol table.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
400 ms | linux > HWAddressSanitizer-x86_64.TestCases::sizes.cpp |
Event Timeline
A refactor harmonizing treatment of tables, relative to other kinds of definitions. NFC; I tested codegen, MC, and lld wasm tests.
Awesome!
llvm/lib/Object/WasmObjectFile.cpp | ||
---|---|---|
600 | Looks like you also added support for table names.. Maybe mention that in the description? | |
llvm/tools/obj2yaml/wasm2yaml.cpp | ||
237 | Hmm.. is this true for GlobalImport and EventImport too? It looks like none of them set Index. It it worth switching Im.TableImport to be of type TypeType instead of `Table? Maybe that comes latest when the FIXME is addressed? |
I guess I should ask for commit rights so I can land after approval; would you be OK sponsoring my request, Sam? In the meantime if you would like to land this one that would be grand :)
llvm/tools/obj2yaml/wasm2yaml.cpp | ||
---|---|---|
237 | Yeah this is true of GlobalImport and EventImport also. Agreed that it does make sense here to just store a TableType; can fix in a followup. |
I'm seeing a lot of tests fail. For example just the MC tests:
Failed Tests (28): LLVM :: MC/WebAssembly/array-fill.ll LLVM :: MC/WebAssembly/assembler-binary.ll LLVM :: MC/WebAssembly/bss.ll LLVM :: MC/WebAssembly/comdat.ll LLVM :: MC/WebAssembly/data-section.s LLVM :: MC/WebAssembly/event-section.ll LLVM :: MC/WebAssembly/explicit-sections.ll LLVM :: MC/WebAssembly/export-name.s LLVM :: MC/WebAssembly/external-data.ll LLVM :: MC/WebAssembly/external-func-address.ll LLVM :: MC/WebAssembly/externref.s LLVM :: MC/WebAssembly/function-sections.ll LLVM :: MC/WebAssembly/global-ctor-dtor.ll LLVM :: MC/WebAssembly/globals.s LLVM :: MC/WebAssembly/import-module.s LLVM :: MC/WebAssembly/libcall.ll LLVM :: MC/WebAssembly/offset.ll LLVM :: MC/WebAssembly/reloc-pic.s LLVM :: MC/WebAssembly/stack-ptr.ll LLVM :: MC/WebAssembly/tables.s LLVM :: MC/WebAssembly/tls.s LLVM :: MC/WebAssembly/type-index.s LLVM :: MC/WebAssembly/types.ll LLVM :: MC/WebAssembly/unnamed-data.ll LLVM :: MC/WebAssembly/visibility.ll LLVM :: MC/WebAssembly/wasm64.s LLVM :: MC/WebAssembly/weak-alias.s LLVM :: MC/WebAssembly/weak.s
Looks like something to do with objectyaml:
FAIL: LLVM :: MC/WebAssembly/weak.s (1 of 1) ******************** TEST 'LLVM :: MC/WebAssembly/weak.s' FAILED ******************** Script: -- : 'RUN: at line 1'; /usr/local/google/home/sbc/dev/wasm/llvm-build/bin/llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -o /usr/local/google/home/sbc/dev/wasm/llvm-build/test/MC/WebAssembly/Output/weak.s.tmp.o < /usr/local/google/home/sbc/dev/wasm/llvm-project/llvm/test/MC/WebAssembly/weak.s : 'RUN: at line 2'; /usr/local/google/home/sbc/dev/wasm/llvm-build/bin/obj2yaml /usr/local/google/home/sbc/dev/wasm/llvm-build/test/MC/WebAssembly/Output/weak.s.tmp.o | /usr/local/google/home/sbc/dev/wasm/llvm-build/bin/FileCheck /usr/local/google/home/sbc/dev/wasm/llvm-project/llvm/test/MC/WebAssembly/weak.s -- Exit Code: 2 Command Output (stderr): -- bad runtime enum value UNREACHABLE executed at /usr/local/google/home/sbc/dev/wasm/llvm-project/llvm/lib/Support/YAMLTraits.cpp:655! PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: /usr/local/google/home/sbc/dev/wasm/llvm-build/bin/obj2yaml /usr/local/google/home/sbc/dev/wasm/llvm-build/test/MC/WebAssembly/Output/weak.s.tmp.o #0 0x00007fdcbe7fbb83 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.12git+0x193b83) #1 0x00007fdcbe7f99ae llvm::sys::RunSignalHandlers() (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.12git+0x1919ae) #2 0x00007fdcbe7fc045 SignalHandler(int) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.12git+0x194045) #3 0x00007fdcbeabf140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140) #4 0x00007fdcbe1b3db1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1 #5 0x00007fdcbe19d537 abort ./stdlib/abort.c:81:7 #6 0x00007fdcbe73c2a1 (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.12git+0xd42a1) #7 0x00007fdcbe7d8e91 (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.12git+0x170e91) #8 0x00007fdcbec3ae1d llvm::yaml::MappingTraits<llvm::WasmYAML::Table>::mapping(llvm::yaml::IO&, llvm::WasmYAML::Table&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMObjectYAML.so.12git+0x134e1d) #9 0x00007fdcbec3bc1f llvm::yaml::MappingTraits<llvm::WasmYAML::Import>::mapping(llvm::yaml::IO&, llvm::WasmYAML::Import&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMObjectYAML.so.12git+0x135c1f) #10 0x00007fdcbec3fe4c std::enable_if<has_SequenceTraits<std::vector<llvm::WasmYAML::Import, std::allocator<llvm::WasmYAML::Import> > >::value, void>::type llvm::yaml::yamlize<std::vector<llvm::WasmYAML::Import, std::allocator<llvm::WasmYAML::Import> >, llvm::yaml::EmptyContext>(llvm::yaml::IO&, std::vector<llvm::WasmYAML::Import, std::allocator<llvm::WasmYAML::Import> >&, bool, llvm::yaml::EmptyContext&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMObjectYAML.so.12git+0x139e4c) #11 0x00007fdcbec387b5 llvm::yaml::MappingTraits<std::unique_ptr<llvm::WasmYAML::Section, std::default_delete<llvm::WasmYAML::Section> > >::mapping(llvm::yaml::IO&, std::unique_ptr<llvm::WasmYAML::Section, std::default_delete<llvm::WasmYAML::Section> >&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMObjectYAML.so.12git+0x1327b5) #12 0x00007fdcbec42658 std::enable_if<has_SequenceTraits<std::vector<std::unique_ptr<llvm::WasmYAML::Section, std::default_delete<llvm::WasmYAML::Section> >, std::allocator<std::unique_ptr<llvm::WasmYAML::Section, std::default_delete<llvm::WasmYAML::Section> > > > >::value, void>::type llvm::yaml::yamlize<std::vector<std::unique_ptr<llvm::WasmYAML::Section, std::default_delete<llvm::WasmYAML::Section> >, std::allocator<std::unique_ptr<llvm::WasmYAML::Section, std::default_delete<llvm::WasmYAML::Section> > > >, llvm::yaml::EmptyContext>(llvm::yaml::IO&, std::vector<std::unique_ptr<llvm::WasmYAML::Section, std::default_delete<llvm::WasmYAML::Section> >, std::allocator<std::unique_ptr<llvm::WasmYAML::Section, std::default_delete<llvm::WasmYAML::Section> > > >&, bool, llvm::yaml::EmptyContext&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMObjectYAML.so.12git+0x13c658) #13 0x00007fdcbec37f4e llvm::yaml::MappingTraits<llvm::WasmYAML::Object>::mapping(llvm::yaml::IO&, llvm::WasmYAML::Object&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMObjectYAML.so.12git+0x131f4e) #14 0x000000000047f518 wasm2yaml(llvm::raw_ostream&, llvm::object::WasmObjectFile const&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/obj2yaml+0x47f518) #15 0x00000000004104d5 main (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/obj2yaml+0x4104d5) #16 0x00007fdcbe19ecca __libc_start_main ./csu/../csu/libc-start.c:308:16 #17 0x000000000040dd2a _start (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/obj2yaml+0x40dd2a) FileCheck error: '<stdin>' is empty. FileCheck command line: /usr/local/google/home/sbc/dev/wasm/llvm-build/bin/FileCheck /usr/local/google/home/sbc/dev/wasm/llvm-project/llvm/test/MC/WebAssembly/weak.s
Weird. I rebuilt fresh release and debug binaries here and no problem. Just rebased the patch too and also no problem (patch just updated now). No CI errors either AFAICS. What could be wrong?
Sorry, I think I might have only doing a partial rebuild when I first tried this patch. Seems to work now.arcpatch-D91849_1
Looks like you also added support for table names.. Maybe mention that in the description?