1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 3# RUN: ld.lld %t.o --section-start .text=0x100000 \ 4# RUN: --section-start .data=0x110000 --section-start .bss=0x200000 -o %t 5# RUN: llvm-objdump -section-headers %t | FileCheck %s 6 7# CHECK: Sections: 8# CHECK-NEXT: Idx Name Size Address Type 9# CHECK-NEXT: 0 00000000 0000000000000000 10# CHECK-NEXT: 1 .text 00000001 0000000000100000 TEXT DATA 11# CHECK-NEXT: 2 .data 00000004 0000000000110000 DATA 12# CHECK-NEXT: 3 .bss 00000004 0000000000200000 BSS 13 14## The same, but dropped "0x" prefix. 15# RUN: ld.lld %t.o --section-start .text=100000 \ 16# RUN: --section-start .data=110000 --section-start .bss=0x200000 -o %t1 17# RUN: llvm-objdump -section-headers %t1 | FileCheck %s 18 19## Use -Ttext, -Tdata, -Tbss as replacement for --section-start: 20# RUN: ld.lld %t.o -Ttext=0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t4 21# RUN: llvm-objdump -section-headers %t4 | FileCheck %s 22 23## Check Ttext-segment X and Ttext-segment=X forms. 24# RUN: ld.lld %t.o -Ttext-segment=0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t4 25# RUN: llvm-objdump -section-headers %t4 | FileCheck %s 26# RUN: ld.lld %t.o -Ttext-segment 0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t4 27# RUN: llvm-objdump -section-headers %t4 | FileCheck %s 28 29## The same, but dropped "0x" prefix. 30# RUN: ld.lld %t.o -Ttext=100000 -Tdata=110000 -Tbss=200000 -o %t5 31# RUN: llvm-objdump -section-headers %t5 | FileCheck %s 32 33## Check form without assignment: 34# RUN: ld.lld %t.o -Ttext 0x100000 -Tdata 0x110000 -Tbss 0x200000 -o %t4 35# RUN: llvm-objdump -section-headers %t4 | FileCheck %s 36 37## Errors: 38# RUN: not ld.lld %t.o --section-start .text100000 -o %t2 2>&1 \ 39# RUN: | FileCheck -check-prefix=ERR1 %s 40# ERR1: invalid argument: --section-start .text100000 41 42# RUN: not ld.lld %t.o --section-start .text=1Q0000 -o %t3 2>&1 \ 43# RUN: | FileCheck -check-prefix=ERR2 %s 44# ERR2: invalid argument: --section-start .text=1Q0000 45 46# RUN: not ld.lld %t.o -Ttext=1w0000 -o %t6 2>&1 \ 47# RUN: | FileCheck -check-prefix=ERR3 %s 48# ERR3: invalid argument: --Ttext 1w0000 49 50# RUN: not ld.lld %t.o -Tbss=1w0000 -o %t6 2>&1 \ 51# RUN: | FileCheck -check-prefix=ERR4 %s 52# ERR4: invalid argument: --Tbss 1w0000 53 54# RUN: not ld.lld %t.o -Tdata=1w0000 -o %t6 2>&1 \ 55# RUN: | FileCheck -check-prefix=ERR5 %s 56# ERR5: invalid argument: --Tdata 1w0000 57 58.text 59.globl _start 60_start: 61 nop 62 63.data 64.long 0 65 66.bss 67.zero 4 68