summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-06-14 18:48:19 +0000
committerSam Clegg <sbc@chromium.org>2018-06-14 18:48:19 +0000
commit277f898a4d155cbf79b017f163f7f6671c5acf73 (patch)
tree26748ab4d56e60914066675776c0882f16efa852 /llvm/test
parentb521dc3acfae26cef62f1ab3bfe1c3753c0c9955 (diff)
downloadbcm5719-llvm-277f898a4d155cbf79b017f163f7f6671c5acf73.tar.gz
bcm5719-llvm-277f898a4d155cbf79b017f163f7f6671c5acf73.zip
[WebAssembly] Ignore explicit section names for functions
WebAssembly doesn't support more than one function per section and we rely on function sections being unique. This change ignores the section provided by the function to avoid two functions being in the same section. Without this change the object writer produces the following error for this test: LLVM ERROR: section already has a defining function: baz Differential Revision: https://reviews.llvm.org/D48178 llvm-svn: 334752
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/MC/WebAssembly/function-sections.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/MC/WebAssembly/function-sections.ll b/llvm/test/MC/WebAssembly/function-sections.ll
new file mode 100644
index 00000000000..8f1e29adccf
--- /dev/null
+++ b/llvm/test/MC/WebAssembly/function-sections.ll
@@ -0,0 +1,28 @@
+; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s
+
+target triple = "wasm32-unknown-unknown"
+
+define hidden i32 @foo() section "baz" {
+entry:
+ ret i32 2
+}
+
+define hidden i32 @bar() section "baz" {
+entry:
+ ret i32 1
+}
+
+; CHECK: - Type: CUSTOM
+; CHECK-NEXT: Name: linking
+; CHECK-NEXT: Version: 1
+; CHECK-NEXT: SymbolTable:
+; CHECK-NEXT: - Index: 0
+; CHECK-NEXT: Kind: FUNCTION
+; CHECK-NEXT: Name: foo
+; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
+; CHECK-NEXT: Function: 0
+; CHECK-NEXT: - Index: 1
+; CHECK-NEXT: Kind: FUNCTION
+; CHECK-NEXT: Name: bar
+; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
+; CHECK-NEXT: Function: 1
OpenPOWER on IntegriCloud