[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / phdrs-flags.s
blob2311b6d22b41de961aa78746ab6abb263ea02b0a
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3 # RUN: echo "PHDRS {all PT_LOAD FILEHDR PHDRS FLAGS (1 | 1 + 0x1);} \
4 # RUN: SECTIONS { \
5 # RUN: . = 0x10000200; \
6 # RUN: .text : {*(.text*)} :all \
7 # RUN: .foo : {*(.foo.*)} :all \
8 # RUN: .data : {*(.data.*)} :all}" > %t.script
9 # RUN: ld.lld -o %t1 --script %t.script %t
10 # RUN: llvm-readobj -l %t1 | FileCheck %s
12 # RUN: echo "PHDRS {all PT_LOAD FILEHDR PHDRS FLAGS (0x1);} \
13 # RUN: SECTIONS { \
14 # RUN: . = 0x10000200; \
15 # RUN: .text : {*(.text*)} :all \
16 # RUN: .foo : {*(.foo.*)} \
17 # RUN: .data : {*(.data.*)} }" > %t.script
18 # RUN: ld.lld -o %t1 --script %t.script %t
19 # RUN: llvm-readobj -l %t1 | FileCheck --check-prefix=DEFHDR %s
21 # CHECK: ProgramHeaders [
22 # CHECK-NEXT: ProgramHeader {
23 # CHECK-NEXT: Type: PT_LOAD (0x1)
24 # CHECK-NEXT: Offset: 0x0
25 # CHECK-NEXT: VirtualAddress: 0x10000000
26 # CHECK-NEXT: PhysicalAddress: 0x10000000
27 # CHECK-NEXT: FileSize: 521
28 # CHECK-NEXT: MemSize: 521
29 # CHECK-NEXT: Flags [
30 # CHECK-NEXT: PF_W (0x2)
31 # CHECK-NEXT: PF_X (0x1)
32 # CHECK-NEXT: ]
34 # DEFHDR: ProgramHeaders [
35 # DEFHDR-NEXT: ProgramHeader {
36 # DEFHDR-NEXT: Type: PT_LOAD (0x1)
37 # DEFHDR-NEXT: Offset: 0x0
38 # DEFHDR-NEXT: VirtualAddress: 0x10000000
39 # DEFHDR-NEXT: PhysicalAddress: 0x10000000
40 # DEFHDR-NEXT: FileSize: 521
41 # DEFHDR-NEXT: MemSize: 521
42 # DEFHDR-NEXT: Flags [ (0x1)
43 # DEFHDR-NEXT: PF_X (0x1)
44 # DEFHDR-NEXT: ]
45 # DEFHDR-NEXT: Alignment: 4096
46 # DEFHDR-NEXT: }
48 .global _start
49 _start:
50 nop
52 .section .foo.1,"a"
53 foo1:
54 .long 0
56 .section .foo.2,"aw"
57 foo2:
58 .long 0