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