1 # RUN: yaml2obj %s -o %t
2 # RUN: llvm-objcopy --change-section-lma *+0x20 %t %t2
3 # RUN: llvm-readelf --program-headers %t2 | FileCheck %s --check-prefix=CHECK-PLUS-PROGRAMS
4 # RUN: llvm-readelf --section-headers %t2 | FileCheck %s --check-prefix=CHECK-PLUS-SECTIONS
5 # RUN: llvm-objcopy --change-section-lma *-0x30 %t %t3
6 # RUN: llvm-readelf --program-headers %t3 | FileCheck %s --check-prefix=CHECK-MINUS-PROGRAMS
7 # RUN: llvm-readelf --section-headers %t3 | FileCheck %s --check-prefix=CHECK-MINUS-SECTIONS
8 # RUN: not llvm-objcopy --change-section-lma .text3=0x5000 %t 2>&1 | FileCheck %s --check-prefix=ERR-SET-ADDRESS
9 # RUN: not llvm-objcopy --change-section-lma .text3+0x30 %t 2>&1 | FileCheck %s --check-prefix=ERR-SPECIFIC-SEC
10 # RUN: not llvm-objcopy --change-section-lma *+0c50 %t 2>&1 | FileCheck %s --check-prefix=ERR-INVALID-VAL
11 # RUN: not llvm-objcopy --change-section-lma 0 %t 2>&1 | FileCheck %s --check-prefix=ERR-MISSING-OFFSET
12 # RUN: not llvm-objcopy --change-section-lma *-0x2000 %t 2>&1 | FileCheck %s --check-prefix=ERR-UNDERFLOW
13 # RUN: not llvm-objcopy --change-section-lma *+0x100000000 %t 2>&1 | FileCheck %s --check-prefix=ERR-OVERFLOW
15 # CHECK-PLUS-PROGRAMS: Type Offset VirtAddr PhysAddr FileSiz MemSiz
16 # CHECK-PLUS-PROGRAMS: PHDR 0x000002 0x0000000000001102 0x0000000000001122 0x000038 0x000000
17 # CHECK-PLUS-PROGRAMS: LOAD 0x000000 0x0000000000001100 0x0000000000001120 0x000258 0x000258
18 # CHECK-PLUS-PROGRAMS: LOAD 0x000258 0xffffffff00005100 0xffffffff00006120 0x000100 0x000100
19 # CHECK-PLUS-PROGRAMS: NOTE 0x000358 0x0000000000001200 0x0000000000001220 0x000010 0x000000
20 # CHECK-PLUS-PROGRAMS: NOTE 0x000368 0x0000000000000000 0x0000000000000000 0x000000 0x000000
22 # CHECK-MINUS-PROGRAMS: PHDR 0x000002 0x0000000000001102 0x00000000000010d2 0x000038 0x000000
23 # CHECK-MINUS-PROGRAMS: LOAD 0x000000 0x0000000000001100 0x00000000000010d0 0x000258 0x000258
24 # CHECK-MINUS-PROGRAMS: LOAD 0x000258 0xffffffff00005100 0xffffffff000060d0 0x000100 0x000100
25 # CHECK-MINUS-PROGRAMS: NOTE 0x000358 0x0000000000001200 0x00000000000011d0 0x000010 0x000000
26 # CHECK-MINUS-PROGRAMS: NOTE 0x000368 0x0000000000000000 0x0000000000000000 0x000000 0x000000
28 # CHECK-PLUS-SECTIONS: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
29 # CHECK-PLUS-SECTIONS: .text1
30 # CHECK-PLUS-SECTIONS-SAME: 0000000000000000
31 # CHECK-PLUS-SECTIONS: .text2
32 # CHECK-PLUS-SECTIONS-SAME: 0000000000000000
34 # CHECK-MINUS-SECTIONS: .text1
35 # CHECK-MINUS-SECTIONS-SAME: 0000000000000000
36 # CHECK-MINUS-SECTIONS: .text2
37 # CHECK-MINUS-SECTIONS-SAME: 0000000000000000
39 # ERR-SET-ADDRESS: error: bad format for --change-section-lma: changing LMA to a specific value is not supported. Use *+val or *-val instead
40 # ERR-SPECIFIC-SEC: error: bad format for --change-section-lma: changing a specific section LMA is not supported. Use *+val or *-val instead
41 # ERR-INVALID-VAL: error: bad format for --change-section-lma: value after *+ is 0c50 when it should be an integer
42 # ERR-MISSING-OFFSET: error: bad format for --change-section-lma: missing LMA offset
43 # ERR-UNDERFLOW: : address 0x1102 cannot be decreased by 0x2000. The result would underflow
44 # ERR-OVERFLOW: address 0xffffffff00006100 cannot be increased by 0x100000000. The result would overflow
69 VAddr: 0xFFFFFFFF00005100
70 PAddr: 0xFFFFFFFF00006100