[gn] port afa8aeeeec (RISCVGenExegesis.inc)
[llvm-project.git] / lld / test / ELF / linkerscript / empty-synthetic-removed-flags.s
blobdfc502e8da9e1d4299518a4faf5ac912cf097bc8
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 # RUN: echo "SECTIONS { .foo : { *(.foo) } .bar : { *(.got.plt) BYTE(0x11) }}" > %t.script
4 # RUN: ld.lld -o %t --script %t.script %t.o
5 # RUN: llvm-readobj -S %t | FileCheck %s
7 ## We have ".got.plt" synthetic section with SHF_ALLOC|SHF_WRITE flags.
8 ## It is empty, so linker removes it, but it has to keep ".got.plt" output
9 ## section because of the BYTE command. Here we check that the output section
10 ## still remembers what the flags of .got.plt are.
12 # CHECK: Section {
13 # CHECK: Index: 2
14 # CHECK: Name: .bar
15 # CHECK-NEXT: Type: SHT_PROGBITS
16 # CHECK-NEXT: Flags [
17 # CHECK-NEXT: SHF_ALLOC
18 # CHECK-NEXT: SHF_WRITE
19 # CHECK-NEXT: ]
21 ## Check flags are not the same if we omit empty synthetic section in script.
22 # RUN: echo "SECTIONS { .foo : { *(.foo) } .bar : { BYTE(0x11) }}" > %t.script
23 # RUN: ld.lld -o %t --script %t.script %t.o
24 # RUN: llvm-readobj -S %t | FileCheck --check-prefix=EMPTY %s
26 # EMPTY: Section {
27 # EMPTY: Index: 2
28 # EMPTY: Name: .bar
29 # EMPTY-NEXT: Type: SHT_PROGBITS
30 # EMPTY-NEXT: Flags [
31 # EMPTY-NEXT: SHF_ALLOC
32 # EMPTY-NEXT: ]
34 .section .foo,"ax"
35 .quad 0