diff options
| author | Wouter van Oortmerssen <aardappel@gmail.com> | 2019-07-15 18:36:07 +0000 |
|---|---|---|
| committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2019-07-15 18:36:07 +0000 |
| commit | b2a0745e2d5ee156e97a2e779cbf2abb3b2efb74 (patch) | |
| tree | a34ae5914416ff2192658e368d258400c68bafe9 | |
| parent | 90bdfb3daf7871ab324ff151b36cb0e783034706 (diff) | |
| download | bcm5719-llvm-b2a0745e2d5ee156e97a2e779cbf2abb3b2efb74.tar.gz bcm5719-llvm-b2a0745e2d5ee156e97a2e779cbf2abb3b2efb74.zip | |
[WebAssembly] Assembler: recognize .init_array as data section.
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64602
llvm-svn: 366104
| -rw-r--r-- | llvm/lib/MC/MCParser/WasmAsmParser.cpp | 3 | ||||
| -rw-r--r-- | llvm/test/MC/WebAssembly/basic-assembly.s | 15 |
2 files changed, 15 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCParser/WasmAsmParser.cpp b/llvm/lib/MC/MCParser/WasmAsmParser.cpp index b19647793fa..28d4459fecd 100644 --- a/llvm/lib/MC/MCParser/WasmAsmParser.cpp +++ b/llvm/lib/MC/MCParser/WasmAsmParser.cpp @@ -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); diff --git a/llvm/test/MC/WebAssembly/basic-assembly.s b/llvm/test/MC/WebAssembly/basic-assembly.s index 2c396d12bf9..81d6001175b 100644 --- a/llvm/test/MC/WebAssembly/basic-assembly.s +++ b/llvm/test/MC/WebAssembly/basic-assembly.s @@ -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 |

