[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / build-id.s
blob63e488ef6d294a9a3f9790488d31f01033cea195
1 # REQUIRES: x86
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
5 # RUN: ld.lld --build-id %t -o %t2
6 # RUN: llvm-readobj -S %t2 | FileCheck -check-prefix=ALIGN %s
8 # RUN: ld.lld --build-id %t -o %t2
9 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=DEFAULT %s
10 # RUN: ld.lld --build-id=fast %t -o %t2
11 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=DEFAULT %s
12 # RUN: ld.lld --build-id %t -o %t2 --threads=1
13 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=DEFAULT %s
15 # RUN: ld.lld --build-id=md5 %t -o %t2
16 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=MD5 %s
17 # RUN: ld.lld --build-id=md5 %t -o %t2 --threads=1
18 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=MD5 %s
20 # RUN: ld.lld --build-id=sha1 %t -o %t2
21 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SHA1 %s
22 # RUN: ld.lld --build-id=sha1 %t -o %t2 --threads=1
23 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SHA1 %s
25 # RUN: ld.lld --build-id=tree %t -o %t2
26 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SHA1 %s
27 # RUN: ld.lld --build-id=tree %t -o %t2 --threads=1
28 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SHA1 %s
30 # RUN: ld.lld --build-id=uuid %t -o %t2
31 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=UUID %s
33 # RUN: ld.lld --build-id=0x12345678 %t -o %t2
34 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=HEX %s
36 # RUN: ld.lld %t -o %t2
37 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=NONE %s
39 # RUN: ld.lld --build-id=md5 --build-id=none %t -o %t2
40 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=NONE %s
41 # RUN: ld.lld --build-id --build-id=none %t -o %t2
42 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=NONE %s
43 # RUN: ld.lld --build-id=none --build-id %t -o %t2
44 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=DEFAULT %s
46 .globl _start
47 _start:
48 nop
50 .section .note.test, "a", @note
51 .quad 42
53 # ALIGN: Name: .note.gnu.build-id
54 # ALIGN-NEXT: Type: SHT_NOTE
55 # ALIGN-NEXT: Flags [
56 # ALIGN-NEXT: SHF_ALLOC
57 # ALIGN-NEXT: ]
58 # ALIGN-NEXT: Address:
59 # ALIGN-NEXT: Offset: [[_:0x[0-9A-Z]*(0|4|8|C)$]]
60 # ALIGN-NEXT: Size:
61 # ALIGN-NEXT: Link:
62 # ALIGN-NEXT: Info:
63 # ALIGN-NEXT: AddressAlignment: 4
65 # DEFAULT: Contents of section .note.test:
66 # DEFAULT: Contents of section .note.gnu.build-id:
67 # DEFAULT-NEXT: 04000000 08000000 03000000 474e5500 ............GNU.
68 # DEFAULT-NEXT: 7e8ddeff 3ed41fa3
70 # MD5: Contents of section .note.gnu.build-id:
71 # MD5-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.
72 # MD5-NEXT: 7b00fd9e 054ceb4b 06f64d0e 482cb476
74 # SHA1: Contents of section .note.gnu.build-id:
75 # SHA1-NEXT: 04000000 14000000 03000000 474e5500 ............GNU.
76 # SHA1-NEXT: 221a99da dd1d2bf3 05e48a91 dde8a0cb
78 # UUID: Contents of section .note.gnu.build-id:
79 # UUID-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.
81 # HEX: Contents of section .note.gnu.build-id:
82 # HEX-NEXT: 04000000 04000000 03000000 474e5500 ............GNU.
83 # HEX-NEXT: 12345678
85 # NONE-NOT: Contents of section .note.gnu.build-id:
87 # RUN: ld.lld --build-id=sha1 -z separate-loadable-segments %t -o %t2
88 # RUN: llvm-readelf -x .note.gnu.build-id %t2 | FileCheck --check-prefix=SEPARATE %s
90 # SEPARATE: Hex dump of section '.note.gnu.build-id':
91 # SEPARATE-NEXT: 0x00200198 04000000 14000000 03000000 474e5500
92 # SEPARATE-NEXT: 0x002001a8 96820adf d90d5470 0a0c32ff a88c4017
94 # RUN: ld.lld --build-id=sha1 --no-rosegment %t -o %t2
95 # RUN: llvm-readelf -x .note.gnu.build-id %t2 | FileCheck --check-prefix=NORO %s
97 # NORO: Hex dump of section '.note.gnu.build-id':
98 # NORO-NEXT: 0x00200160 04000000 14000000 03000000 474e5500
99 # NORO-NEXT: 0x00200170 cf6d7b3a 0b3297c3 5b47c079 ce048349