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
| # RUN: yaml2obj %s -o %t
# RUN: llvm-objcopy --set-section-alignment .foo=4 --set-section-alignment .bar=0x5 \
# RUN: --set-section-alignment .baz=0 %t %t.2
# RUN: llvm-readobj --sections %t.2 | FileCheck --check-prefix=CHECK %s
# CHECK: Name: .foo
# CHECK: AddressAlignment:
# CHECK-SAME: 4{{$}}
# CHECK: Name: .bar
# CHECK: AddressAlignment:
# CHECK-SAME: 5{{$}}
# CHECK: Name: .baz
# CHECK: AddressAlignment:
# CHECK-SAME: 0{{$}}
## If a section is specified multiple times, the last wins.
# RUN: llvm-objcopy --set-section-alignment .foo=4 --set-section-alignment=.foo=7 %t %t.3
# RUN: llvm-readobj --sections %t.3 | FileCheck --check-prefix=MULTI %s
# MULTI: Name: .foo
# MULTI: AddressAlignment:
# MULTI-SAME: 7{{$}}
## Ignore the option if the section does not exist.
# RUN: llvm-objcopy --set-section-alignment .not_exist=4 %t.3 %t.4
# RUN: cmp %t.3 %t.4
# RUN: not llvm-objcopy --set-section-alignment=.foo %t /dev/null 2>&1 | \
# RUN: FileCheck --check-prefix=MISSING-EQUAL %s
# MISSING-EQUAL: error: bad format for --set-section-alignment: missing '='
# RUN: not llvm-objcopy --set-section-alignment==4 %t /dev/null 2>&1 | \
# RUN: FileCheck --check-prefix=MISSING-SECTION %s
# MISSING-SECTION: error: bad format for --set-section-alignment: missing section name
# RUN: not llvm-objcopy --set-section-alignment=.foo=bar %t /dev/null 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-ALIGN %s
# INVALID-ALIGN: error: invalid alignment for --set-section-alignment: 'bar'
!ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .foo
Type: SHT_PROGBITS
- Name: .bar
Type: SHT_NOBITS
- Name: .baz
Type: SHT_NOTE
AddressAlign: 4
Notes: []
|