• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: yaml2obj %s -o %t
2
3# Test --set-start.
4# RUN: llvm-objcopy --set-start 0x1000 %t %t2
5# RUN: llvm-readobj --file-headers %t2 | FileCheck %s --check-prefix=SET
6# RUN: llvm-objcopy --set-start 4096 %t %t3
7# RUN: cmp %t2 %t3
8# RUN: llvm-objcopy --set-start 0x100000000 %t %t4
9# RUN: llvm-readobj --file-headers %t4 | FileCheck %s --check-prefix=SET-LARGE
10# RUN: not llvm-objcopy --set-start -123 %t %t5 2>&1 | FileCheck %s --check-prefix=SET-ERR
11
12# Test --change-start.
13# RUN: llvm-objcopy --change-start 0x50 %t %t6
14# RUN: llvm-readobj --file-headers %t6 | FileCheck %s --check-prefix=ADD
15# RUN: llvm-objcopy --change-start 0x100000000 %t %t7
16# RUN: llvm-readobj --file-headers %t7 | FileCheck %s --check-prefix=ADD-LARGE
17# RUN: llvm-objcopy --change-start -4353 %t %t8
18# RUN: llvm-readobj --file-headers %t8 | FileCheck %s --check-prefix=ADD-UNDERFLOW
19# RUN: llvm-objcopy --change-start -0x1101 %t %t9
20# RUN: cmp %t8 %t9
21# RUN: not llvm-objcopy --change-start -xyz %t %t10 2>&1 | FileCheck %s --check-prefix=ADD-ERR
22
23# Test --change-start after --set-start. Result should be 0x1150.
24# RUN: llvm-objcopy --set-start 0x1000 --change-start 0x100 --change-start 0x50 %t %t11
25# RUN: cmp %t6 %t11
26
27# If --set-start is after --change-start then --change-start has no effect.
28# RUN: llvm-objcopy --change-start 0x150 --set-start 0x1000 %t %t12
29# RUN: cmp %t2 %t12
30
31# --adjust-start is an alias for --change-start.
32# RUN: llvm-objcopy --adjust-start -0x1101 %t %t13
33# RUN: cmp %t9 %t13
34
35!ELF
36FileHeader:
37  Class:           ELFCLASS64
38  Data:            ELFDATA2LSB
39  Type:            ET_EXEC
40  Machine:         EM_X86_64
41  Entry:           0x1100
42Sections:
43  - Name:            .text
44    Type:            SHT_PROGBITS
45    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
46    Address:         0x1000
47    AddressAlign:    0x0000000000001000
48    Size:            0x200
49
50# SET: Entry: 0x1000
51# ADD: Entry: 0x1150
52# SUB: Entry: 0x1080
53# SET-ERR: error: bad entry point address: '-123'
54# SET-LARGE: Entry: 0x100000000
55# ADD-LARGE: Entry: 0x100001100
56# ADD-ERR: error: bad entry point increment: '-xyz'
57# ADD-UNDERFLOW: Entry: 0xFFFFFFFFFFFFFFFF
58