format-binary.test
2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# REQUIRES: x86
# RUN: echo -n "Fluffle Puff" > %t.binary
# RUN: ld.lld -m elf_x86_64 -r -b binary %t.binary -o %t.out
# RUN: llvm-readobj %t.out -sections -section-data -symbols | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: ld.lld %t.o -b binary %t.binary -b default %t.o -shared -o %t.out
# RUN: not ld.lld -b foo > %t.log 2>&1
# RUN: FileCheck -check-prefix=ERR %s < %t.log
# ERR: error: unknown -format value: foo (supported formats: elf, default, binary)
# CHECK: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS
# CHECK-NEXT: Flags [
# CHECK-NEXT: SHF_ALLOC
# CHECK-NEXT: SHF_WRITE
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset:
# CHECK-NEXT: Size: 12
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment:
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: SectionData (
# CHECK-NEXT: 0000: 466C7566 666C6520 50756666 |Fluffle Puff|
# CHECK-NEXT: )
# CHECK-NEXT: }
# CHECK: Name: _binary_{{[a-zA-Z0-9_]+}}test_ELF_Output_format_binary_test_tmp_binary_start
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: Object
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: .data
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: _binary_{{[a-zA-Z0-9_]+}}test_ELF_Output_format_binary_test_tmp_binary_end
# CHECK-NEXT: Value: 0xC
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: Object
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: .data
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: _binary_{{[a-zA-Z0-9_]+}}test_ELF_Output_format_binary_test_tmp_binary_size
# CHECK-NEXT: Value: 0xC
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: Object
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Absolute
# CHECK-NEXT: }
# RUN: echo 'OUTPUT_FORMAT(elf64-x86-64)' > %t.script
# RUN: ld.lld -b binary %t.binary -T %t.script -o %t.out
# RUN: llvm-readobj %t.out -sections -section-data -symbols | FileCheck -check-prefix=X86-64 %s
# X86-64: Format: ELF64-x86-64
# RUN: echo 'OUTPUT_FORMAT("elf64-x86-64")' > %t.script
# RUN: ld.lld -b binary %t.binary -T %t.script -o %t.out
# RUN: llvm-readobj %t.out -sections -section-data -symbols | FileCheck -check-prefix=X86-64-in-quotes %s
# X86-64-in-quotes: Format: ELF64-x86-64