OSDN Git Service

[WebAssembly] Assembler: recognize .init_array as data section.
authorWouter van Oortmerssen <aardappel@gmail.com>
Mon, 15 Jul 2019 18:36:07 +0000 (18:36 +0000)
committerWouter van Oortmerssen <aardappel@gmail.com>
Mon, 15 Jul 2019 18:36:07 +0000 (18:36 +0000)
Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D64602

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366104 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/WasmAsmParser.cpp
test/MC/WebAssembly/basic-assembly.s

index b196477..28d4459 100644 (file)
@@ -120,6 +120,9 @@ public:
                     .StartsWith(".text", SectionKind::getText())
                     .StartsWith(".custom_section", SectionKind::getMetadata())
                     .StartsWith(".bss", SectionKind::getBSS())
+                    // See use of .init_array in WasmObjectWriter and
+                    // TargetLoweringObjectFileWasm
+                    .StartsWith(".init_array", SectionKind::getData())
                     .Default(Optional<SectionKind>());
     if (!Kind.hasValue())
       return Parser->Error(Lexer->getLoc(), "unknown section kind: " + Name);
index 2c396d1..81d6001 100644 (file)
@@ -101,6 +101,10 @@ test0:
     .int32      2000000000
     .size       .L.str, 28
 
+    .section    .init_array.42,"",@
+    .p2align    2
+    .int32      test0
+
     .ident      "clang version 9.0.0 (trunk 364502) (llvm/trunk 364571)"
     .globaltype __stack_pointer, i32
 
@@ -190,8 +194,13 @@ test0:
 # CHECK-NEXT:  .L.str:
 # CHECK-NEXT:      .int8       72
 # CHECK-NEXT:      .asciz      "ello, World!"
-# CHECK-NEXT:      .int16       1234
-# CHECK-NEXT:      .int64       5000000000
-# CHECK-NEXT:      .int32       2000000000
+# CHECK-NEXT:      .int16      1234
+# CHECK-NEXT:      .int64      5000000000
+# CHECK-NEXT:      .int32      2000000000
+# CHECK-NEXT:      .size       .L.str, 28
+
+# CHECK:           .section    .init_array.42,"",@
+# CHECK-NEXT:      .p2align    2
+# CHECK-NEXT:      .int32      test0
 
 # CHECK:           .globaltype __stack_pointer, i32