[WebAssembly] section kind can be code
Currently, when creating a named section, the Wasm
frontend forces it to use `SectionKind::Data`, whereas
in fact C++ does generate code sections with custom
names.
Patch by Nicholas Wilson
Differential Revision: https://reviews.llvm.org/D40906
llvm-svn: 320002
diff --git a/llvm/test/MC/WebAssembly/custom-code-section.ll b/llvm/test/MC/WebAssembly/custom-code-section.ll
new file mode 100644
index 0000000..d528d42
--- /dev/null
+++ b/llvm/test/MC/WebAssembly/custom-code-section.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple wasm32-unknown-unknown-wasm -O2 -filetype=obj %s -o %t.o
+
+; Wasm silently ignores custom sections for code.
+; We had a bug where this cause a crash
+
+define hidden void @call_indirect() section "some_section_name" {
+entry:
+ ret void
+}