1 # RUN: echo -n abcd > %t.x-txt
2 # Preserve input to verify it is not modified
3 # RUN: cp %t.x-txt %t-copy.txt
4 # RUN: llvm-objcopy -I binary -O elf64-x86-64 %t.x-txt %t.o
5 # RUN: llvm-readobj --sections --symbols %t.o | FileCheck %s
6 # RUN: cmp %t.x-txt %t-copy.txt
9 # CHECK-NEXT: Section {
10 # CHECK-NEXT: Index: 0
11 # CHECK-NEXT: Name: (0)
12 # CHECK-NEXT: Type: SHT_NULL (0x0)
13 # CHECK-NEXT: Flags [ (0x0)
15 # CHECK-NEXT: Address: 0x0
20 # CHECK-NEXT: AddressAlignment: 0
21 # CHECK-NEXT: EntrySize: 0
23 # CHECK-NEXT: Section {
24 # CHECK-NEXT: Index: 1
25 # CHECK-NEXT: Name: .strtab
26 # CHECK-NEXT: Type: SHT_STRTAB (0x3)
27 # CHECK-NEXT: Flags [ (0x0)
29 # CHECK-NEXT: Address: 0x0
34 # CHECK-NEXT: AddressAlignment: 1
35 # CHECK-NEXT: EntrySize: 0
37 # CHECK-NEXT: Section {
38 # CHECK-NEXT: Index: 2
39 # CHECK-NEXT: Name: .symtab
40 # CHECK-NEXT: Type: SHT_SYMTAB (0x2)
41 # CHECK-NEXT: Flags [ (0x0)
43 # CHECK-NEXT: Address: 0x0
48 # CHECK-NEXT: AddressAlignment: 8
49 # CHECK-NEXT: EntrySize: 24
51 # CHECK-NEXT: Section {
52 # CHECK-NEXT: Index: 3
53 # CHECK-NEXT: Name: .data
54 # CHECK-NEXT: Type: SHT_PROGBITS (0x1)
55 # CHECK-NEXT: Flags [ (0x3)
56 # CHECK-NEXT: SHF_ALLOC (0x2)
57 # CHECK-NEXT: SHF_WRITE (0x1)
59 # CHECK-NEXT: Address: 0x0
64 # CHECK-NEXT: AddressAlignment: 1
65 # CHECK-NEXT: EntrySize: 0
69 # Note: the symbol names are derived from the full path (with non-alnum values
70 # replaced with "_"), e.g. "/tmp/a-b.c" should yield
71 # _binary__tmp_a_b_c_{start,end,size}.
72 # Just check for _binary_{{[_a-zA-Z0-9]*}}_x_txt_{start,end,size} to avoid
73 # making assumptions about how this test is run.
76 # CHECK-NEXT: Symbol {
78 # CHECK-NEXT: Value: 0x0
80 # CHECK-NEXT: Binding: Local (0x0)
81 # CHECK-NEXT: Type: None (0x0)
82 # CHECK-NEXT: Other: 0
83 # CHECK-NEXT: Section: Undefined (0x0)
85 # CHECK-NEXT: Symbol {
86 # CHECK-NEXT: Name: _binary_{{[_a-zA-Z0-9]*}}_x_txt_start
87 # CHECK-NEXT: Value: 0x0
89 # CHECK-NEXT: Binding: Global (0x1)
90 # CHECK-NEXT: Type: None (0x0)
91 # CHECK-NEXT: Other: 0
92 # CHECK-NEXT: Section: .data
94 # CHECK-NEXT: Symbol {
95 # CHECK-NEXT: Name: _binary_{{[_a-zA-Z0-9]*}}_x_txt_end
96 # CHECK-NEXT: Value: 0x4
98 # CHECK-NEXT: Binding: Global (0x1)
99 # CHECK-NEXT: Type: None (0x0)
100 # CHECK-NEXT: Other: 0
101 # CHECK-NEXT: Section: .data
103 # CHECK-NEXT: Symbol {
104 # CHECK-NEXT: Name: _binary_{{[_a-zA-Z0-9]*}}_x_txt_size
105 # CHECK-NEXT: Value: 0x4
106 # CHECK-NEXT: Size: 0
107 # CHECK-NEXT: Binding: Global (0x1)
108 # CHECK-NEXT: Type: None (0x0)
109 # CHECK-NEXT: Other: 0
110 # CHECK-NEXT: Section: Absolute
114 ## The alignment can be changed by --set-section-alignment.
115 # RUN: llvm-objcopy -I binary -O elf64-x86-64 --set-section-alignment .data=8 %t.x-txt %t2.o
116 # RUN: llvm-readobj --sections %t2.o | FileCheck --check-prefix=ALIGN %s
119 # ALIGN: AddressAlignment: