1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/MC/WebAssembly/comdat-sections.s
Derek Schuff d4257740dd [WebAssembly] Support COMDAT sections in assembly syntax
This CL changes the asm syntax for section flags, making them more like ELF
(previously "passive" was the only option). Now we also allow "G" to designate
COMDAT group sections. In these sections we set the appropriate comdat flag on
function symbols, and also avoid auto-creating a new section for them.

This also adds asm-based tests for the changes D92691 to go along with
the direct-to-object tests.

Differential Revision: https://reviews.llvm.org/D92952
This is a reland of rG4564553b8d8a with a fix to the lit pipeline in
llvm/test/MC/WebAssembly/comdat.ll
2020-12-10 16:43:59 -08:00

51 lines
1.7 KiB
ArmAsm

# RUN: llvm-mc -triple=wasm32 -filetype=obj %s -o - | obj2yaml | FileCheck %s
.section .text.foo,"G",@,abc123,comdat
.globl foo
.type foo,@function
foo:
.functype foo () -> ()
return
end_function
.globl bar
bar:
.functype bar () -> ()
return
end_function
.section .debug_foo,"G",@,abc123,comdat
.int32 42
.section .debug_foo,"G",@,duplicate,comdat
.int64 234
# Check that there are 2 identically-named custom sections, with the desired
# contents
# CHECK: - Type: CUSTOM
# CHECK-NEXT: Name: .debug_foo
# CHECK-NEXT: Payload: 2A000000
# CHECK-NEXT: - Type: CUSTOM
# CHECK-NEXT: Name: .debug_foo
# CHECK-NEXT: Payload: EA00000000000000
# And check that they are in 2 different comdat groups
# CHECK-NEXT:- Type: CUSTOM
# CHECK-NEXT: Name: linking
# CHECK-NEXT: Version: 2
# CHECK: Comdats:
# CHECK-NEXT: - Name: abc123
# CHECK-NEXT: Entries:
# CHECK-NEXT: - Kind: FUNCTION
# CHECK-NEXT: Index: 0
# If the user forgets to create a new section for a function, one is created for
# them by the assembler. Check that it is also in the same group.
# CHECK-NEXT: - Kind: FUNCTION
# CHECK-NEXT: Index: 1
# CHECK-NEXT: - Kind: SECTION
# CHECK-NEXT: Index: 4
# CHECK-NEXT: - Name: duplicate
# CHECK-NEXT: Entries:
# CHECK-NEXT: - Kind: SECTION
# CHECK-NEXT: Index: 5