brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · e8f3b7f Raw
73 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o3# RUN: not ld.lld %t.o --section-start .text=0x100000 \4# RUN:   --section-start=.data=0x110000 --section-start .bss=0x200000 5# RUN: ld.lld %t.o --section-start .text=0x100000 \6# RUN:   --section-start=.data=0x110000 --section-start .bss=0x200000 --noinhibit-exec -o %t 2>&1 | \7# RUN:   FileCheck %s --check-prefix=LINK --implicit-check-not=warning:8# RUN: llvm-objdump --section-headers %t | FileCheck %s9 10# LINK:      warning: section '.text' address (0x100000) is smaller than image base (0x200000); specify --image-base11# LINK-NEXT: warning: section '.data' address (0x110000) is smaller than image base (0x200000); specify --image-base12 13# CHECK:      Sections:14# CHECK-NEXT:  Idx Name          Size     VMA              Type15# CHECK-NEXT:    0               00000000 000000000000000016# CHECK-NEXT:    1 .text         00000001 0000000000100000 TEXT17# CHECK-NEXT:    2 .data         00000004 0000000000110000 DATA18# CHECK-NEXT:    3 .bss          00000004 0000000000200000 BSS19 20## The errors go away when the image base is 0.21# RUN: ld.lld %t.o -pie --section-start .text=0x100000 \22# RUN:   --section-start=.data=0x110000 --section-start .bss=0x200000 -o %t 2>&1 | count 023# RUN: llvm-objdump --section-headers %t | FileCheck %s24 25## The same, but dropped "0x" prefix. Specify a smaller --image-base to suppress warnings.26# RUN: ld.lld %t.o --image-base=0x90000 --section-start .text=100000 \27# RUN:   --section-start .data=110000 --section-start .bss=0x200000 -o %t1 2>&1 | count 028# RUN: llvm-objdump --section-headers %t1 | FileCheck %s29 30## Use -Ttext, -Tdata, -Tbss as replacement for --section-start:31# RUN: ld.lld %t.o --image-base=0x90000 -Ttext=0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t432# RUN: llvm-objdump --section-headers %t4 | FileCheck %s33 34## The same, but dropped "0x" prefix.35# RUN: ld.lld %t.o --image-base=0x90000 -Ttext=100000 -Tdata=110000 -Tbss=200000 -o %t536# RUN: llvm-objdump --section-headers %t5 | FileCheck %s37 38## Check form without assignment:39# RUN: ld.lld %t.o --image-base=0x90000 -Ttext 0x100000 -Tdata 0x110000 -Tbss 0x200000 -o %t440# RUN: llvm-objdump --section-headers %t4 | FileCheck %s41 42## Errors:43# RUN: not ld.lld %t.o --section-start .text100000 -o /dev/null 2>&1 \44# RUN:    | FileCheck -check-prefix=ERR1 %s45# ERR1: invalid argument: --section-start .text10000046 47# RUN: not ld.lld %t.o --section-start .text=1Q0000 -o /dev/null 2>&1 \48# RUN:    | FileCheck -check-prefix=ERR2 %s49# ERR2: invalid argument: --section-start .text=1Q000050 51# RUN: not ld.lld %t.o -Ttext=1w0000 -o /dev/null 2>&1 \52# RUN:    | FileCheck -check-prefix=ERR3 %s53# ERR3: invalid argument: -Ttext=1w000054 55# RUN: not ld.lld %t.o -Tbss=1w0000 -o /dev/null 2>&1 \56# RUN:    | FileCheck -check-prefix=ERR4 %s57# ERR4: invalid argument: -Tbss=1w000058 59# RUN: not ld.lld %t.o -Tdata=1w0000 -o /dev/null 2>&1 \60# RUN:    | FileCheck -check-prefix=ERR5 %s61# ERR5: invalid argument: -Tdata=1w000062 63.text64.globl _start65_start:66 nop67 68.data69.long 070 71.bss72.zero 473