1# REQUIRES: x86
2
3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4
5# RUN: ld.lld --build-id %t -o %t2
6# RUN: llvm-readobj -S %t2 | FileCheck -check-prefix=ALIGN %s
7
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
14
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
19
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
24
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
29
30# RUN: ld.lld --build-id=uuid %t -o %t2
31# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=UUID %s
32
33# RUN: ld.lld --build-id=0x12345678 %t -o %t2
34# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=HEX %s
35
36# RUN: ld.lld %t -o %t2
37# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=NONE %s
38
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
45
46.globl _start
47_start:
48  nop
49
50.section .note.test, "a", @note
51   .quad 42
52
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
64
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
69
70# MD5:      Contents of section .note.gnu.build-id:
71# MD5-NEXT: 04000000 10000000 03000000 474e5500  ............GNU.
72# MD5-NEXT: 7b00fd9e 054ceb4b 06f64d0e 482cb476
73
74# SHA1:      Contents of section .note.gnu.build-id:
75# SHA1-NEXT: 04000000 14000000 03000000 474e5500  ............GNU.
76# SHA1-NEXT: 221a99da dd1d2bf3 05e48a91 dde8a0cb
77
78# UUID:      Contents of section .note.gnu.build-id:
79# UUID-NEXT: 04000000 10000000 03000000 474e5500  ............GNU.
80
81# HEX:      Contents of section .note.gnu.build-id:
82# HEX-NEXT: 04000000 04000000 03000000 474e5500  ............GNU.
83# HEX-NEXT: 12345678
84
85# NONE-NOT: Contents of section .note.gnu.build-id:
86