[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / discard-group.s
blob1729a4d90ef20cb5de9cd113db71b2f737625998
1 # REQUIRES: arm
2 ## For --gc-sections, group members are retained or discarded as a unit.
3 ## However, discarding a section via /DISCARD/ should not discard other members
4 ## within the group. This is compatible with GNU ld.
6 # RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
8 ## We can discard .ARM.exidx* in a group.
9 # RUN: echo 'SECTIONS { /DISCARD/ : { *(.ARM.exidx*) }}' > %t.noarm.script
10 # RUN: ld.lld %t.o --gc-sections -T %t.noarm.script -o %t.noarm
11 # RUN: llvm-readobj -S %t.noarm | FileCheck %s --check-prefix=NOARM --implicit-check-not='Name: .ARM.exidx'
13 # NOARM: Name: .text
14 # NOARM: Name: .note._start
16 ## Another example, we can discard SHT_NOTE in a group.
17 # RUN: echo 'SECTIONS { /DISCARD/ : { *(.note*) }}' > %t.nonote.script
18 # RUN: ld.lld %t.o --gc-sections -T %t.nonote.script -o %t.nonote
19 # RUN: llvm-readobj -S %t.nonote | FileCheck %s --check-prefix=NONOTE --implicit-check-not='Name: .note'
21 # NONOTE: Name: .ARM.exidx
22 # NONOTE: Name: .text
24 .section .text._start,"axG",%progbits,_start,comdat
25 .globl _start
26 _start:
27 .fnstart
28 .cantunwind
29 bx lr
30 .fnend
32 .section .note._start,"G",%note,_start,comdat
33 .byte 0