[ELF,test] Specify image base to make -Ttext/--section-start tests less sensitive

Many tests specify -Ttext, -Tdata, or --section-start without SECTIONS
commands. When the specified address is lower than the image base,

* In the default --ro-segment case, there will be a read-only PT_LOAD segment covering ELF header/program headers, which may cover no section (as many tests omit .rodata). This appears unusual and has non-ascending p_vaddr.
* In the --no-rosegment case, an `error: output file too large` occurs.

We will add a diagnostic (#140187) and possibly change layout. Add
--image-base to make these tests less sensitive.
This commit is contained in:
Fangrui Song
2025-05-16 23:57:44 -07:00
parent 39722154d8
commit 07e2300a8c
37 changed files with 109 additions and 109 deletions

View File

@@ -17,7 +17,7 @@ REQUIRES: aarch64
# RUN: sed "s/\.rela/\.rel/;s/SHT_RELA/SHT_REL/" rela.yaml > rel.yaml
# RUN: yaml2obj rel.yaml -o rel.o
# RUN: llvm-mc -filetype=obj -triple=aarch64 symbols.s -o symbols.o
# RUN: ld.lld rel.o symbols.o -o a.out --section-start=.data=0x100000 --section-start=.text=0x200000
# RUN: ld.lld rel.o symbols.o -o a.out --image-base=0x80000 --section-start=.data=0x100000 --section-start=.text=0x200000
# RUN: llvm-objdump -s a.out | FileCheck %s --check-prefix=DATALE
# RUN: llvm-objdump -d a.out | FileCheck %s --check-prefix=CODE
@@ -26,7 +26,7 @@ REQUIRES: aarch64
# RUN: sed "s/\.rela/\.rel/;s/SHT_RELA/SHT_REL/" rela_be.yaml > rel_be.yaml
# RUN: yaml2obj rel_be.yaml -o rel_be.o
# RUN: llvm-mc -filetype=obj -triple=aarch64_be symbols.s -o symbols_be.o
# RUN: ld.lld -EB rel_be.o symbols_be.o -o be.out --section-start=.data=0x100000 --section-start=.text=0x200000
# RUN: ld.lld -EB rel_be.o symbols_be.o -o be.out --image-base=0x80000 --section-start=.data=0x100000 --section-start=.text=0x200000
# RUN: llvm-objdump -s be.out | FileCheck %s --check-prefix=DATABE
# RUN: llvm-objdump -d be.out | FileCheck %s --check-prefix=CODE

View File

@@ -1,6 +1,6 @@
// REQUIRES: aarch64
// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t
// RUN: ld.lld -Ttext=0x12000 -defsym long=0x10000000 -defsym short=0x8012004 -defsym short2=0x8012008 -defsym short3=0x801200c %t -o %t.exe
// RUN: ld.lld --image-base=0x12000 -Ttext=0x12000 -defsym long=0x10000000 -defsym short=0x8012004 -defsym short2=0x8012008 -defsym short3=0x801200c %t -o %t.exe
// RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck %s
/// The AArch64AbsLongThunk requires 8-byte alignment just in case unaligned

View File

@@ -25,31 +25,31 @@
/// CMSE Only supported by ARMv8-M architecture or later.
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv8m.base app -I %S/Inputs -o app1.o
// RUN: ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app1 app1.o 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: ld.lld --cmse-implib -pie -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app1 app1.o 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv8m.main app -I %S/Inputs -o app2.o
// RUN: ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app2 app2.o 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: ld.lld --cmse-implib -pie -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app2 app2.o 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv8.1m.main app -I %S/Inputs -o app3.o
// RUN: ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app3 app3.o 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: ld.lld --cmse-implib -pie -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app3 app3.o 2>&1 | FileCheck /dev/null --implicit-check-not=error:
/// Expect errors for other architectures.
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv9a app -I %S/Inputs -o app4.o
// RUN: not ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app4 app4.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
// RUN: not ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app4 app4.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7-m app -I %S/Inputs -o app5.o
// RUN: not ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app5 app5.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
// RUN: not ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app5 app5.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv8-m app -I %S/Inputs -o app6.o
// RUN: not ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app6 app6.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
// RUN: not ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app6 app6.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
/// Invalid triple defaults to v4T. Error.
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumb app -I %S/Inputs -o app7.o
// RUN: not ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app7 app7.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
// RUN: not ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app7 app7.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
/// No build attributes. Error.
// RUN: llvm-mc -filetype=obj -triple=thumb app -I %S/Inputs -o app8.o
// RUN: not ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app8 app8.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
// RUN: not ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o app8 app8.o 2>&1 | FileCheck %s --check-prefixes=ERR_ARCH
// ERR_ARCH: CMSE is only supported by ARMv8-M architecture or later
@@ -62,20 +62,20 @@
/// Create a new import library with the secure gateway veneer and .gnu.sgstubs specified at the same address
// RUN: ld.lld --cmse-implib --section-start .gnu.sgstubs=0x10000 1.o -o 2 --out-implib=2.lib --in-implib=1.lib 2>&1 | FileCheck /dev/null --implicit-check-not=error:
/// Create a new import library with the secure gateway veneer specified at a same address but .gnu.sgstubs at a higher address.
// RUN: not ld.lld --cmse-implib --section-start .gnu.sgstubs=0x11000 1.o -o 3 --out-implib=3.lib --in-implib=1.lib 2>&1 | FileCheck %s --check-prefixes=ERR_ADDR
// RUN: not ld.lld --cmse-implib -pie --section-start .gnu.sgstubs=0x11000 1.o -o 3 --out-implib=3.lib --in-implib=1.lib 2>&1 | FileCheck %s --check-prefixes=ERR_ADDR
/// Create a new import library with the secure gateway veneer specified at a same address but .gnu.sgstubs at a lower address.
// RUN: not ld.lld --cmse-implib --section-start .gnu.sgstubs=0x9000 1.o -o 4 --out-implib=4.lib --in-implib=1.lib 2>&1 | FileCheck %s --check-prefixes=ERR_ADDR
// RUN: not ld.lld --cmse-implib -pie --section-start .gnu.sgstubs=0x9000 1.o -o 4 --out-implib=4.lib --in-implib=1.lib 2>&1 | FileCheck %s --check-prefixes=ERR_ADDR
// ERR_ADDR: error: start address of '.gnu.sgstubs' is different from previous link
/// Test that the address of .gnu.sgstubs can be specified via command line or linker script.
/// Test that the linker errors when the address of .gnu.sgstubs is not specified using either method.
// RUN: ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --script with_sgstubs.script 1.o -o 1 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --script wout_sgstubs.script 1.o -o 2 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 1.o -o 3 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: ld.lld --cmse-implib -Ttext=0x8000 --script with_sgstubs.script 1.o -o 4 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: not ld.lld --cmse-implib -Ttext=0x8000 --script wout_sgstubs.script 1.o -o 5 2>&1 | FileCheck %s --check-prefixes=ERR_NOADDR
// RUN: ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --script with_sgstubs.script 1.o -o 1 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --script wout_sgstubs.script 1.o -o 2 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 1.o -o 3 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --script with_sgstubs.script 1.o -o 4 2>&1 | FileCheck /dev/null --implicit-check-not=error:
// RUN: not ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --script wout_sgstubs.script 1.o -o 5 2>&1 | FileCheck %s --check-prefixes=ERR_NOADDR
// RUN: llvm-readelf -S 1 | FileCheck %s --check-prefixes=ADDRCMDLINE
// RUN: llvm-readelf -S 2 | FileCheck %s --check-prefixes=ADDRCMDLINE
@@ -110,9 +110,9 @@
/// Test diagnostics emitted when a symbol is removed from a later version of the import library.
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -I %S/Inputs --triple=thumbv8m.base libv1 -o libv1.o
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -I %S/Inputs --triple=thumbv8m.base libv2 -o libv2.o
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv1.o --out-implib=libv1.lib
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv2.o --in-implib=libv1.lib --out-implib=libv2.lib 2>&1 | FileCheck %s --check-prefixes=WARN_MISSING
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv1.o --in-implib=libv2.lib 2>&1 | FileCheck %s --check-prefixes=WARN_NEWENTRY
// RUN: ld.lld --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv1.o --out-implib=libv1.lib
// RUN: ld.lld --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv2.o --in-implib=libv1.lib --out-implib=libv2.lib 2>&1 | FileCheck %s --check-prefixes=WARN_MISSING
// RUN: ld.lld --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv1.o --in-implib=libv2.lib 2>&1 | FileCheck %s --check-prefixes=WARN_NEWENTRY
// WARN_MISSING: warning: entry function 'bar' from CMSE import library is not present in secure application
// WARN_NEWENTRY: warning: new entry function 'bar' introduced but no output import library specified

View File

@@ -6,10 +6,10 @@
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.base implib-v1 -I %S/Inputs -o 1.o
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.base implib-v2 -I %S/Inputs -o 2.o
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o 1 app.o --out-implib=1.lib --cmse-implib 1.o
// RUN: ld.lld --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o 1 app.o --out-implib=1.lib --cmse-implib 1.o
// RUN: llvm-readelf -s 1 1.lib | FileCheck %s --check-prefixes=CHECK1
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o 2 app.o --out-implib=2.lib --in-implib=1.lib --cmse-implib 2.o
// RUN: ld.lld --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o 2 app.o --out-implib=2.lib --in-implib=1.lib --cmse-implib 2.o
// RUN: llvm-readelf -s 2 2.lib | FileCheck %s --check-prefixes=CHECK2
//--- app

View File

@@ -6,7 +6,7 @@
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.main cmse-implib.s -o implib.o -I%S/Inputs/
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.main cmse-secure-app.s -o secureapp.o
/// Create the secure app and import library.
// RUN: ld.lld -e secure_entry --section-start .gnu.sgstubs=0x1000000 --section-start SECURE1=0x10 --section-start SECURE2=0x2000000 --cmse-implib implib.o secureapp.o --out-implib=implib.lib -o secureapp --gc-sections
// RUN: ld.lld -e secure_entry --image-base=0 --section-start .gnu.sgstubs=0x1000000 --section-start SECURE1=0x10 --section-start SECURE2=0x2000000 --cmse-implib implib.o secureapp.o --out-implib=implib.lib -o secureapp --gc-sections
// RUN: llvm-readelf -s implib.lib | FileCheck %s
// RUN: llvm-objdump -d --no-show-raw-insn secureapp | FileCheck %s --check-prefix=DISS

View File

@@ -3,7 +3,7 @@
/// Test that .gnu.sgstubs is size 0 when no linker synthesized secure gateway veneers are created.
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.main %s -I %S/Inputs -o %t.o
// RUN: ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 %t.o -o %t --out-implib=%t.lib
// RUN: ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 %t.o -o %t --out-implib=%t.lib
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
// RUN: llvm-readelf -S %t | FileCheck %s --check-prefixes=SGSTUBSSIZE
// RUN: llvm-readelf -s %t.lib | FileCheck %s --check-prefixes=IMPLIBSYMS

View File

@@ -9,7 +9,7 @@
/// Create the secure app and import library.
// RUN: ld.lld -e secure_entry --section-start .gnu.sgstubs=0x20000 --cmse-implib implib.o secureapp.o --out-implib=implib.lib -o secureapp
/// Link the non-secure app against the import library.
// RUN: ld.lld -e nonsecure_entry -Ttext=0x8000 implib.lib nonsecureapp.o -o nonsecureapp
// RUN: ld.lld -e nonsecure_entry --image-base=0x8000 -Ttext=0x8000 implib.lib nonsecureapp.o -o nonsecureapp
// RUN: llvm-readelf -s implib.lib | FileCheck %s
// RUN: llvm-objdump -d --no-show-raw-insn secureapp | FileCheck %s --check-prefixes=SECUREDISS
// RUN: llvm-objdump -d --no-show-raw-insn nonsecureapp | FileCheck %s --check-prefixes=NONSECUREDISS

View File

@@ -3,7 +3,7 @@
/// are preserved in the executable.
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.main %s -I %S/Inputs -o %t.o
// RUN: ld.lld --cmse-implib -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 %t.o -o %t
// RUN: ld.lld --cmse-implib --image-base=0x8000 -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 %t.o -o %t
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
// RUN: llvm-readelf -s %t | FileCheck %s --check-prefixes=SYM

View File

@@ -3,13 +3,13 @@
# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega328 avr-pcrel-7.s -o avr-pcrel-7.o
# RUN: not ld.lld avr-pcrel-7.o -Ttext=0x1000 --defsym=callee0=0x1040 --defsym=callee1=0x1084 --defsym=callee2=0x100f 2>&1 | \
# RUN: not ld.lld avr-pcrel-7.o --image-base=0x1000 -Ttext=0x1000 --defsym=callee0=0x1040 --defsym=callee1=0x1084 --defsym=callee2=0x100f 2>&1 | \
# RUN: FileCheck %s --check-prefix=PCREL7
# RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega328 avr-pcrel-13.s -o avr-pcrel-13.o
# RUN: not ld.lld avr-pcrel-13.o -Ttext=0x1000 --defsym=callee0=0x2000 --defsym=callee1=0x2004 --defsym=callee2=0x100f 2>&1 | \
# RUN: not ld.lld avr-pcrel-13.o --image-base=0x1000 -Ttext=0x1000 --defsym=callee0=0x2000 --defsym=callee1=0x2004 --defsym=callee2=0x100f 2>&1 | \
# RUN: FileCheck %s --check-prefix=PCREL13
# RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega328 avr-abs.s -o avr-abs.o
# RUN: not ld.lld avr-abs.o -Ttext=0x1000 --defsym=callee0=0x1009 --defsym=callee1=0x1010 2>&1 | \
# RUN: not ld.lld avr-abs.o --image-base=0x1000 -Ttext=0x1000 --defsym=callee0=0x1009 --defsym=callee1=0x1010 2>&1 | \
# RUN: FileCheck %s --check-prefix=ABS
#--- avr-pcrel-7.s

View File

@@ -1,6 +1,6 @@
# REQUIRES: avr
# RUN: llvm-mc -filetype=obj -triple=avr-unknown-linux -mcpu=atmega328p %s -o %t.o
# RUN: ld.lld %t.o -o %t.exe -Ttext=0
# RUN: ld.lld %t.o -o %t.exe --image-base=0 -Ttext=0
# RUN: llvm-objdump -d %t.exe --mcpu=atmega328 | FileCheck %s --check-prefix=ASM
# RUN: llvm-readelf --file-headers --sections -l --symbols %t.exe \
# RUN: | FileCheck %s --check-prefix=ELF
@@ -61,8 +61,8 @@ foo:
# ELF: Program Headers:
# ELF-NEXT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
# ELF-NEXT: PHDR 0x000034 0x00010034 0x00010034 0x00080 0x00080 R 0x4
# ELF-NEXT: LOAD 0x000000 0x00010000 0x00010000 0x000b4 0x000b4 R 0x1000
# ELF-NEXT: PHDR 0x000034 0x00000034 0x00000034 0x00080 0x00080 R 0x4
# ELF-NEXT: LOAD 0x000000 0x00000000 0x00000000 0x000b4 0x000b4 R 0x1000
# ELF-NEXT: LOAD 0x001000 0x00000000 0x00000000 0x0000c 0x0000c R E 0x1000
# ELF-NEXT: GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x0

View File

@@ -2,7 +2,7 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/compress-debug.s -o %t2.o
# RUN: ld.lld %t2.o %t.o -o %t1 --compress-debug-sections=zlib -Ttext=0
# RUN: ld.lld %t2.o %t.o -o %t1 --compress-debug-sections=zlib --image-base=0 -Ttext=0
# RUN: llvm-dwarfdump %t1 -debug-str | FileCheck %s
# These two checks correspond to the patched values of a_sym and a_debug_sym.
# D = 0x44 - address of .text input section for this file (the start address of

View File

@@ -1,7 +1,7 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: ld.lld --eh-frame-hdr --section-start .text=0x1000 %t.o -o %t
# RUN: ld.lld --eh-frame-hdr --image-base=0 -Ttext=0x1000 %t.o -o %t
# RUN: llvm-readobj -S --section-data %t | FileCheck %s
## Check we are able to handle DW_EH_PE_udata2 encoding.

View File

@@ -1,7 +1,7 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: ld.lld --eh-frame-hdr --section-start .text=0x1000 %t.o -o %t
# RUN: ld.lld --eh-frame-hdr --image-base=0 -Ttext=0x1000 %t.o -o %t
# RUN: llvm-readobj -S --section-data %t | FileCheck %s
## Check we are able to handle DW_EH_PE_absptr encoding.

View File

@@ -5,13 +5,13 @@
## consider every .debug_info a compile unit).
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
# RUN: ld.lld --gdb-index -Ttext=0x1000 %t.o -o %t
# RUN: ld.lld --gdb-index --image-base=0x1000 -Ttext=0x1000 %t.o -o %t
# RUN: llvm-dwarfdump --gdb-index %t | FileCheck %s
## Test we don't uncompress a section while another thread is concurrently
## accessing it. This would be detected by tsan as a data race.
# RUN: llvm-objcopy --compress-debug-sections %t.o
# RUN: ld.lld --gdb-index -Ttext=0x1000 %t.o -o %t1
# RUN: ld.lld --gdb-index --image-base=0x1000 -Ttext=0x1000 %t.o -o %t1
# RUN: llvm-dwarfdump --gdb-index %t1 | FileCheck %s
## In this test, there are actually two compile unit .debug_info (very uncommon;

View File

@@ -4,7 +4,7 @@
## range whose low address equals the start address of the output section.
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
# RUN: ld.lld --gdb-index --icf=all -Ttext=0x1000 %t.o -o %t
# RUN: ld.lld --gdb-index --icf=all --image-base=0x1000 -Ttext=0x1000 %t.o -o %t
# RUN: llvm-dwarfdump --gdb-index %t | FileCheck %s
# CHECK: Address area offset = 0x38, has 2 entries:

View File

@@ -1,7 +1,7 @@
# REQUIRES: x86
# RUN: yaml2obj %s -o %t.o
# RUN: ld.lld -Ttext 0x0 %t.o -o %t.exe
# RUN: ld.lld --image-base=0x0 -Ttext 0x0 %t.o -o %t.exe
# RUN: llvm-objdump -s --section=.text %t.exe 2>&1 | FileCheck %s
# CHECK: Contents of section .text:

View File

@@ -1,6 +1,6 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux-gnu %s -o %t1.o
# RUN: ld.lld -Ttext 0x0 %t1.o -o %t.out
# RUN: ld.lld --image-base=0x0 -Ttext 0x0 %t1.o -o %t.out
# RUN: llvm-objdump -s --section=.text %t.out | FileCheck %s
# CHECK: Contents of section .text:

View File

@@ -1,6 +1,6 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t
# RUN: ld.lld -Ttext 0x7c00 %t -o %t2
# RUN: ld.lld --image-base=0x7c00 -Ttext 0x7c00 %t -o %t2
# RUN: llvm-objdump -s %t2 | FileCheck %s
# CHECK: Contents of section .text:

View File

@@ -1,6 +1,6 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t
# RUN: ld.lld -Ttext 0x7c %t -o %t2
# RUN: ld.lld --image-base=0x7c -Ttext 0x7c %t -o %t2
# RUN: llvm-objdump -s %t2 | FileCheck %s
# CHECK: Contents of section .text:

View File

@@ -4,7 +4,7 @@
// RUN: echo ".global foo; foo = 0x1" > %t1.s
// RUN: llvm-mc %t1.s -o %t1.o -triple i386-pc-linux -filetype=obj
// RUN: ld.lld -Ttext 0x7000 %t.o %t1.o -o %t
// RUN: ld.lld --image-base=0x7000 -Ttext 0x7000 %t.o %t1.o -o %t
// RUN: llvm-objdump -d --triple=i386-pc-linux-code16 %t | FileCheck %s
// CHECK: Disassembly of section .text:

View File

@@ -6,7 +6,7 @@
// RUN: echo ".global foo; foo = 0x10203" > %t2.s
// RUN: llvm-mc %t2.s -o %t2.o -triple i386-pc-linux -filetype=obj
// RUN: ld.lld -Ttext 0x200 %t.o %t1.o -o %t1
// RUN: ld.lld --image-base=0x200 -Ttext 0x200 %t.o %t1.o -o %t1
// RUN: llvm-objdump -d --no-show-raw-insn --triple=i386-pc-linux-code16 %t1 | FileCheck %s
// CHECK: Disassembly of section .text:
@@ -15,7 +15,7 @@
// CHECK-NEXT: 200: jmp 0x202
// 0x10202 - 0x203 == 0xffff
// RUN: not ld.lld -Ttext 0x200 %t.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
// RUN: not ld.lld --image-base=0x200 -Ttext 0x200 %t.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
// ERR: {{.*}}:(.text+0x1): relocation R_386_PC16 out of range: 65536 is not in [-65536, 65535]; references 'foo'

View File

@@ -1,7 +1,7 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux-gnu %s -o %t1.o
# RUN: ld.lld -Ttext=0x0 %t1.o -o %t.out
# RUN: ld.lld --image-base=0x0 -Ttext=0x0 %t1.o -o %t.out
# RUN: llvm-objdump -s -t %t.out | FileCheck %s
## 0x3 + addend(-1) = 0x02
## 0x3 + addend(-2) = 0x0100

View File

@@ -1,7 +1,7 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t1.exe -Ttext=0x10000
# RUN: ld.lld %t.o -o %t1.exe --image-base=0x10000 -Ttext=0x10000
# RUN: ld.lld --just-symbols=%t1.exe -o %t2.exe --cref | FileCheck %s

View File

@@ -1,7 +1,7 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t1.exe -Ttext=0x10000
# RUN: ld.lld %t.o -o %t1.exe --image-base=0x10000 -Ttext=0x10000
# RUN: ld.lld -just-symbols=%t1.exe -o %t2.exe
# RUN: llvm-readelf -s %t2.exe | FileCheck %s

View File

@@ -6,7 +6,7 @@
# RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega328 %t/avr5.s -o %t/avr5.o
# RUN: ld.lld %t/avr5.o -T %t/avr5.lds -o %t/avr5a.out
# RUN: llvm-objdump --no-print-imm-hex --mcpu=atmega328 -d %t/avr5a.out | FileCheck %s --check-prefix=RELOC
# RUN: ld.lld %t/avr5.o -Ttext=0 -Tdata=0x800 -e _start -o %t/avr5b.out
# RUN: ld.lld %t/avr5.o --image-base=0 -Ttext=0 -Tdata=0x800 -e _start -o %t/avr5b.out
# RUN: llvm-objdump --no-print-imm-hex --mcpu=atmega328 -d %t/avr5b.out | FileCheck %s --check-prefix=RELOC
# RELOC: ldi r24, 2

View File

@@ -5,7 +5,7 @@ REQUIRES: x86
RUN: split-file %s %ts
RUN: llvm-mc -filetype=obj -triple=x86_64 %ts/asm.s -o %t.o
RUN: ld.lld -o %t -T %ts/script %t.o
RUN: ld.lld -o %t --image-base=0 -T %ts/script %t.o
RUN: llvm-readelf -S %t | FileCheck %s
CHECK: .text PROGBITS 0000000000001000

View File

@@ -5,64 +5,64 @@
# RUN: llvm-mc --filetype=obj --triple=loongarch64 %t/a.s -o %t/a.la64.o
# RUN: llvm-mc --filetype=obj --triple=loongarch64 %t/extreme.s -o %t/extreme.o
# RUN: ld.lld %t/a.la32.o --section-start=.rodata=0x11000 --section-start=.text=0x11ffc -o %t/case1.la32
# RUN: ld.lld %t/a.la64.o --section-start=.rodata=0x11000 --section-start=.text=0x11ffc -o %t/case1.la64
# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x11000 --section-start=.text=0x11ffc -o %t/case1.la32
# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x11000 --section-start=.text=0x11ffc -o %t/case1.la64
# RUN: llvm-objdump -d --no-show-raw-insn %t/case1.la32 | FileCheck %s --check-prefix=CASE1
# RUN: llvm-objdump -d --no-show-raw-insn %t/case1.la64 | FileCheck %s --check-prefix=CASE1
# CASE1: pcalau12i $a0, 0
# CASE1-NEXT: ld.w $a0, $a0, 0
# RUN: ld.lld %t/a.la32.o --section-start=.rodata=0x11000 --section-start=.text=0x12000 -o %t/case2.la32
# RUN: ld.lld %t/a.la64.o --section-start=.rodata=0x11000 --section-start=.text=0x12000 -o %t/case2.la64
# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x11000 --section-start=.text=0x12000 -o %t/case2.la32
# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x11000 --section-start=.text=0x12000 -o %t/case2.la64
# RUN: llvm-objdump -d --no-show-raw-insn %t/case2.la32 | FileCheck %s --check-prefix=CASE2
# RUN: llvm-objdump -d --no-show-raw-insn %t/case2.la64 | FileCheck %s --check-prefix=CASE2
# CASE2: pcalau12i $a0, -1
# CASE2-NEXT: ld.w $a0, $a0, 0
# RUN: ld.lld %t/a.la32.o --section-start=.rodata=0x117ff --section-start=.text=0x12000 -o %t/case3.la32
# RUN: ld.lld %t/a.la64.o --section-start=.rodata=0x117ff --section-start=.text=0x12000 -o %t/case3.la64
# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x117ff --section-start=.text=0x12000 -o %t/case3.la32
# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x117ff --section-start=.text=0x12000 -o %t/case3.la64
# RUN: llvm-objdump -d --no-show-raw-insn %t/case3.la32 | FileCheck %s --check-prefix=CASE3
# RUN: llvm-objdump -d --no-show-raw-insn %t/case3.la64 | FileCheck %s --check-prefix=CASE3
# CASE3: pcalau12i $a0, -1
# CASE3-NEXT: ld.w $a0, $a0, 2047
# RUN: ld.lld %t/a.la32.o --section-start=.rodata=0x11800 --section-start=.text=0x12000 -o %t/case4.la32
# RUN: ld.lld %t/a.la64.o --section-start=.rodata=0x11800 --section-start=.text=0x12000 -o %t/case4.la64
# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x11800 --section-start=.text=0x12000 -o %t/case4.la32
# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x11800 --section-start=.text=0x12000 -o %t/case4.la64
# RUN: llvm-objdump -d --no-show-raw-insn %t/case4.la32 | FileCheck %s --check-prefix=CASE4
# RUN: llvm-objdump -d --no-show-raw-insn %t/case4.la64 | FileCheck %s --check-prefix=CASE4
# CASE4: pcalau12i $a0, 0
# CASE4-NEXT: ld.w $a0, $a0, -2048
# RUN: ld.lld %t/a.la32.o --section-start=.rodata=0x12004 --section-start=.text=0x11ffc -o %t/case5.la32
# RUN: ld.lld %t/a.la64.o --section-start=.rodata=0x12004 --section-start=.text=0x11ffc -o %t/case5.la64
# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x12004 --section-start=.text=0x11ffc -o %t/case5.la32
# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x12004 --section-start=.text=0x11ffc -o %t/case5.la64
# RUN: llvm-objdump -d --no-show-raw-insn %t/case5.la32 | FileCheck %s --check-prefix=CASE5
# RUN: llvm-objdump -d --no-show-raw-insn %t/case5.la64 | FileCheck %s --check-prefix=CASE5
# CASE5: pcalau12i $a0, 1
# CASE5-NEXT: ld.w $a0, $a0, 4
# RUN: ld.lld %t/a.la32.o --section-start=.rodata=0x12800 --section-start=.text=0x11ffc -o %t/case6.la32
# RUN: ld.lld %t/a.la64.o --section-start=.rodata=0x12800 --section-start=.text=0x11ffc -o %t/case6.la64
# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x12800 --section-start=.text=0x11ffc -o %t/case6.la32
# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x12800 --section-start=.text=0x11ffc -o %t/case6.la64
# RUN: llvm-objdump -d --no-show-raw-insn %t/case6.la32 | FileCheck %s --check-prefix=CASE6
# RUN: llvm-objdump -d --no-show-raw-insn %t/case6.la64 | FileCheck %s --check-prefix=CASE6
# CASE6: pcalau12i $a0, 2
# CASE6-NEXT: ld.w $a0, $a0, -2048
# RUN: ld.lld %t/a.la32.o --section-start=.rodata=0x7ffff123 --section-start=.text=0x0 -o %t/case7.la32
# RUN: ld.lld %t/a.la64.o --section-start=.rodata=0x7ffff123 --section-start=.text=0x0 -o %t/case7.la64
# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x7ffff123 --section-start=.text=0x0 -o %t/case7.la32
# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x7ffff123 --section-start=.text=0x0 -o %t/case7.la64
# RUN: llvm-objdump -d --no-show-raw-insn %t/case7.la32 | FileCheck %s --check-prefix=CASE7
# RUN: llvm-objdump -d --no-show-raw-insn %t/case7.la64 | FileCheck %s --check-prefix=CASE7
# CASE7: pcalau12i $a0, 524287
# CASE7-NEXT: ld.w $a0, $a0, 291
# RUN: ld.lld %t/a.la32.o --section-start=.rodata=0x7ffffabc --section-start=.text=0x0 -o %t/case8.la32
# RUN: ld.lld %t/a.la64.o --section-start=.rodata=0x7ffffabc --section-start=.text=0x0 -o %t/case8.la64
# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x7ffffabc --section-start=.text=0x0 -o %t/case8.la32
# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x7ffffabc --section-start=.text=0x0 -o %t/case8.la64
# RUN: llvm-objdump -d --no-show-raw-insn %t/case8.la32 | FileCheck %s --check-prefix=CASE8
# RUN: llvm-objdump -d --no-show-raw-insn %t/case8.la64 | FileCheck %s --check-prefix=CASE8
# CASE8: pcalau12i $a0, -524288
# CASE8-NEXT: ld.w $a0, $a0, -1348
# RUN: ld.lld %t/a.la32.o --section-start=.rodata=0x10123 --section-start=.text=0x80010000 -o %t/case9.la32
# RUN: ld.lld %t/a.la64.o --section-start=.rodata=0x10123 --section-start=.text=0x80010000 -o %t/case9.la64
# RUN: ld.lld %t/a.la32.o --image-base=0 --section-start=.rodata=0x10123 --section-start=.text=0x80010000 -o %t/case9.la32
# RUN: ld.lld %t/a.la64.o --image-base=0 --section-start=.rodata=0x10123 --section-start=.text=0x80010000 -o %t/case9.la64
# RUN: llvm-objdump -d --no-show-raw-insn %t/case9.la32 | FileCheck %s --check-prefix=CASE9
# RUN: llvm-objdump -d --no-show-raw-insn %t/case9.la64 | FileCheck %s --check-prefix=CASE9
# CASE9: pcalau12i $a0, -524288
@@ -73,7 +73,7 @@
## %pc_hi20 = 0x22222 = 139810
## %pc64_lo20 = 0x33333 = 209715
## %pc64_hi12 = 0x444 = 1092
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x4443333334567111 --section-start=.text=0x0000000012345678 -o %t/extreme0
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x4443333334567111 --section-start=.text=0x0000000012345678 -o %t/extreme0
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme0 | FileCheck %s --check-prefix=EXTREME0
# EXTREME0: pcalau12i $t1, 139810
# EXTREME0-NEXT: addi.d $t0, $zero, 273
@@ -85,7 +85,7 @@
## %pc_hi20 = 0x22223 = 139811
## %pc64_lo20 = 0x33332 = 209714
## %pc64_hi12 = 0x444 = 1092
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x4443333334567888 --section-start=.text=0x0000000012345678 -o %t/extreme1
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x4443333334567888 --section-start=.text=0x0000000012345678 -o %t/extreme1
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme1 | FileCheck %s --check-prefix=EXTREME1
# EXTREME1: pcalau12i $t1, 139811
# EXTREME1-NEXT: addi.d $t0, $zero, -1912
@@ -97,7 +97,7 @@
## %pc_hi20 = 0x99999 = -419431
## %pc64_lo20 = 0x33334 = 209716
## %pc64_hi12 = 0x444 = 1092
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x44433333abcde111 --section-start=.text=0x0000000012345678 -o %t/extreme2
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x44433333abcde111 --section-start=.text=0x0000000012345678 -o %t/extreme2
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme2 | FileCheck %s --check-prefix=EXTREME2
# EXTREME2: pcalau12i $t1, -419431
# EXTREME2-NEXT: addi.d $t0, $zero, 273
@@ -109,7 +109,7 @@
## %pc_hi20 = 0x9999a = -419430
## %pc64_lo20 = 0x33333 = 209715
## %pc64_hi12 = 0x444 = 1092
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x44433333abcde888 --section-start=.text=0x0000000012345678 -o %t/extreme3
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x44433333abcde888 --section-start=.text=0x0000000012345678 -o %t/extreme3
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme3 | FileCheck %s --check-prefix=EXTREME3
# EXTREME3: pcalau12i $t1, -419430
# EXTREME3-NEXT: addi.d $t0, $zero, -1912
@@ -121,7 +121,7 @@
## %pc_hi20 = 0x22222 = 139810
## %pc64_lo20 = 0xaaaaa = -349526
## %pc64_hi12 = 0x444 = 1092
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x444aaaaa34567111 --section-start=.text=0x0000000012345678 -o %t/extreme4
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x444aaaaa34567111 --section-start=.text=0x0000000012345678 -o %t/extreme4
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme4 | FileCheck %s --check-prefix=EXTREME4
# EXTREME4: pcalau12i $t1, 139810
# EXTREME4-NEXT: addi.d $t0, $zero, 273
@@ -133,7 +133,7 @@
## %pc_hi20 = 0x22223 = 139811
## %pc64_lo20 = 0xaaaa9 = -349527
## %pc64_hi12 = 0x444 = 1092
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x444aaaaa34567888 --section-start=.text=0x0000000012345678 -o %t/extreme5
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x444aaaaa34567888 --section-start=.text=0x0000000012345678 -o %t/extreme5
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme5 | FileCheck %s --check-prefix=EXTREME5
# EXTREME5: pcalau12i $t1, 139811
# EXTREME5-NEXT: addi.d $t0, $zero, -1912
@@ -145,7 +145,7 @@
## %pc_hi20 = 0x99999 = -419431
## %pc64_lo20 = 0xaaaab = -349525
## %pc64_hi12 = 0x444 = 1092
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x444aaaaaabcde111 --section-start=.text=0x0000000012345678 -o %t/extreme6
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x444aaaaaabcde111 --section-start=.text=0x0000000012345678 -o %t/extreme6
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme6 | FileCheck %s --check-prefix=EXTREME6
# EXTREME6: pcalau12i $t1, -419431
# EXTREME6-NEXT: addi.d $t0, $zero, 273
@@ -157,7 +157,7 @@
## %pc_hi20 = 0x9999a = -419430
## %pc64_lo20 = 0xaaaaa = -349526
## %pc64_hi12 = 0x444 = 1092
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x444aaaaaabcde888 --section-start=.text=0x0000000012345678 -o %t/extreme7
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x444aaaaaabcde888 --section-start=.text=0x0000000012345678 -o %t/extreme7
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme7 | FileCheck %s --check-prefix=EXTREME7
# EXTREME7: pcalau12i $t1, -419430
# EXTREME7-NEXT: addi.d $t0, $zero, -1912
@@ -169,7 +169,7 @@
## %pc_hi20 = 0x22222 = 139810
## %pc64_lo20 = 0x33333 = 209715
## %pc64_hi12 = 0xbbb = -1093
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0xbbb3333334567111 --section-start=.text=0x0000000012345678 -o %t/extreme8
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbb3333334567111 --section-start=.text=0x0000000012345678 -o %t/extreme8
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme8 | FileCheck %s --check-prefix=EXTREME8
# EXTREME8: pcalau12i $t1, 139810
# EXTREME8-NEXT: addi.d $t0, $zero, 273
@@ -181,7 +181,7 @@
## %pc_hi20 = 0x22223 = 139811
## %pc64_lo20 = 0x33332 = 209714
## %pc64_hi12 = 0xbbb = -1093
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0xbbb3333334567888 --section-start=.text=0x0000000012345678 -o %t/extreme9
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbb3333334567888 --section-start=.text=0x0000000012345678 -o %t/extreme9
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme9 | FileCheck %s --check-prefix=EXTREME9
# EXTREME9: pcalau12i $t1, 139811
# EXTREME9-NEXT: addi.d $t0, $zero, -1912
@@ -193,7 +193,7 @@
## %pc_hi20 = 0x99999 = -419431
## %pc64_lo20 = 0x33334 = 209716
## %pc64_hi12 = 0xbbb = -1093
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0xbbb33333abcde111 --section-start=.text=0x0000000012345678 -o %t/extreme10
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbb33333abcde111 --section-start=.text=0x0000000012345678 -o %t/extreme10
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme10 | FileCheck %s --check-prefix=EXTREME10
# EXTREME10: pcalau12i $t1, -419431
# EXTREME10-NEXT: addi.d $t0, $zero, 273
@@ -205,7 +205,7 @@
## %pc_hi20 = 0x9999a = -419430
## %pc64_lo20 = 0x33333 = 209715
## %pc64_hi12 = 0xbbb = -1093
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0xbbb33333abcde888 --section-start=.text=0x0000000012345678 -o %t/extreme11
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbb33333abcde888 --section-start=.text=0x0000000012345678 -o %t/extreme11
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme11 | FileCheck %s --check-prefix=EXTREME11
# EXTREME11: pcalau12i $t1, -419430
# EXTREME11-NEXT: addi.d $t0, $zero, -1912
@@ -217,7 +217,7 @@
## %pc_hi20 = 0x22222 = 139810
## %pc64_lo20 = 0xaaaaa = -349526
## %pc64_hi12 = 0xbbb = -1093
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0xbbbaaaaa34567111 --section-start=.text=0x0000000012345678 -o %t/extreme12
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbbaaaaa34567111 --section-start=.text=0x0000000012345678 -o %t/extreme12
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme12 | FileCheck %s --check-prefix=EXTREME12
# EXTREME12: pcalau12i $t1, 139810
# EXTREME12-NEXT: addi.d $t0, $zero, 273
@@ -229,7 +229,7 @@
## %pc_hi20 = 0x22223 = 139811
## %pc64_lo20 = 0xaaaa9 = -349527
## %pc64_hi12 = 0xbbb = -1093
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0xbbbaaaaa34567888 --section-start=.text=0x0000000012345678 -o %t/extreme13
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbbaaaaa34567888 --section-start=.text=0x0000000012345678 -o %t/extreme13
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme13 | FileCheck %s --check-prefix=EXTREME13
# EXTREME13: pcalau12i $t1, 139811
# EXTREME13-NEXT: addi.d $t0, $zero, -1912
@@ -241,7 +241,7 @@
## %pc_hi20 = 0x99999 = -419431
## %pc64_lo20 = 0xaaaab = -349525
## %pc64_hi12 = 0xbbb = -1093
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0xbbbaaaaaabcde111 --section-start=.text=0x0000000012345678 -o %t/extreme14
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbbaaaaaabcde111 --section-start=.text=0x0000000012345678 -o %t/extreme14
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme14 | FileCheck %s --check-prefix=EXTREME14
# EXTREME14: pcalau12i $t1, -419431
# EXTREME14-NEXT: addi.d $t0, $zero, 273
@@ -253,7 +253,7 @@
## %pc_hi20 = 0x9999a = -419430
## %pc64_lo20 = 0xaaaaa = -349526
## %pc64_hi12 = 0xbbb = -1093
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0xbbbaaaaaabcde888 --section-start=.text=0x0000000012345678 -o %t/extreme15
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0xbbbaaaaaabcde888 --section-start=.text=0x0000000012345678 -o %t/extreme15
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme15 | FileCheck %s --check-prefix=EXTREME15
# EXTREME15: pcalau12i $t1, -419430
# EXTREME15-NEXT: addi.d $t0, $zero, -1912
@@ -265,7 +265,7 @@
## %pc_hi20 = 0x00000 = 0
## %pc64_lo20 = 0xfffff = -1
## %pc64_hi12 = 0xfff = -1
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x0000000012344888 --section-start=.text=0x0000000012345678 -o %t/extreme16
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x0000000012344888 --section-start=.text=0x0000000012345678 -o %t/extreme16
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme16 | FileCheck %s --check-prefix=EXTREME16
# EXTREME16: pcalau12i $t1, 0
# EXTREME16-NEXT: addi.d $t0, $zero, -1912
@@ -277,7 +277,7 @@
## %pc_hi20 = 0x80000 = -524288
## %pc64_lo20 = 0xfffff = 0
## %pc64_hi12 = 0xfff = 0
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x000071238ffff888 --section-start=.text=0x0000712310000678 -o %t/extreme17
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x000071238ffff888 --section-start=.text=0x0000712310000678 -o %t/extreme17
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme17 | FileCheck %s --check-prefix=EXTREME17
# EXTREME17: pcalau12i $t1, -524288
# EXTREME17-NEXT: addi.d $t0, $zero, -1912
@@ -290,7 +290,7 @@
## %pc_hi20 = 0x80000 = -524288
## %pc64_lo20 = 0x00001 = 1
## %pc64_hi12 = 0x000 = 0
# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x80000111 --section-start=.text=0xff8 -o %t/extreme18
# RUN: ld.lld %t/extreme.o --image-base=0 --section-start=.rodata=0x80000111 --section-start=.text=0xff8 -o %t/extreme18
# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme18 | FileCheck %s --check-prefix=EXTREME18
# EXTREME18: pcalau12i $t1, -524288
# EXTREME18-NEXT: addi.d $t0, $zero, 273

View File

@@ -1,7 +1,7 @@
; REQUIRES: msp430
; RUN: llvm-mc -filetype=obj -triple=msp430-elf -o %t1.o %s
; RUN: echo -e '.global _start\n _start: nop' | llvm-mc -filetype=obj -triple=msp430-elf -o %t2.o -
; RUN: ld.lld -o %t.exe --Tdata=0x2000 --Ttext=0x8000 --defsym=_byte=0x21 -z separate-code %t2.o %t1.o
; RUN: ld.lld -o %t.exe --image-base=0x1000 --Tdata=0x2000 --Ttext=0x8000 --defsym=_byte=0x21 -z separate-code %t2.o %t1.o
; RUN: llvm-objdump -s -d %t.exe | FileCheck %s
;; Check handling of basic msp430 relocation types.

View File

@@ -2,7 +2,7 @@
# Verify that .rodata is aligned to a 8 byte boundary.
# RUN: llvm-mc -filetype=obj -triple=i386 %s -o %t.o
# RUN: ld.lld %t.o -o %t.exe -n -Ttext 0
# RUN: ld.lld %t.o -o %t.exe -n --image-base=0 -Ttext 0
# RUN: llvm-readelf --section-headers %t.exe | FileCheck %s
# CHECK: [ 0] NULL 00000000 000000 000000 00 0 0 0

View File

@@ -1,14 +1,14 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: ld.lld -N -Ttext 0x100 -o %t.out %t --oformat binary
# RUN: ld.lld -N --image-base=0x100 -Ttext 0x100 -o %t.out %t --oformat binary
# RUN: od -t x1 -v %t.out | FileCheck %s --check-prefix=BIN
# BIN: 0000000 90
# BIN-NEXT: 0000001
## The same but without OMAGIC.
# RUN: ld.lld -Ttext 0x100 -o %t.out %t --oformat binary
# RUN: ld.lld --image-base=0x100 -Ttext 0x100 -o %t.out %t --oformat binary
# RUN: od -t x1 -v %t.out | FileCheck %s --check-prefix=BIN
.text

View File

@@ -1,6 +1,6 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: ld.lld %t.o --section-start .data=0x20 \
# RUN: ld.lld %t.o --image-base=0 --section-start .data=0x20 \
# RUN: --section-start .bss=0x30 --section-start .text=0x10 -o %t1
# RUN: llvm-objdump --section-headers %t1 | FileCheck %s

View File

@@ -3,9 +3,9 @@
# RUN: llvm-mc -filetype=obj -triple=s390x -defsym DISP=4095 %s -o %t2.o
# RUN: llvm-mc -filetype=obj -triple=s390x -defsym DISP=4096 %s -o %t3.o
# RUN: ld.lld --section-start=.text=0x0 %t1.o -o %t1out
# RUN: ld.lld --section-start=.text=0x0 %t2.o -o %t2out
# RUN: not ld.lld --section-start=.text=0x0 %t3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix RANGE
# RUN: ld.lld --image-base=0 -Ttext=0 %t1.o -o %t1out
# RUN: ld.lld --image-base=0 -Ttext=0 %t2.o -o %t2out
# RUN: not ld.lld --image-base=0 -Ttext=0 %t3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix RANGE
# RANGE: relocation R_390_12 out of range: 4096 is not in [0, 4095]

View File

@@ -3,9 +3,9 @@
# RUN: llvm-mc -filetype=obj -triple=s390x -defsym DISP=524287 %s -o %t2.o
# RUN: llvm-mc -filetype=obj -triple=s390x -defsym DISP=524288 %s -o %t3.o
# RUN: ld.lld --section-start=.text=0x0 %t1.o -o %t1out
# RUN: ld.lld --section-start=.text=0x0 %t2.o -o %t2out
# RUN: not ld.lld --section-start=.text=0x0 %t3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix RANGE
# RUN: ld.lld --image-base=0 -Ttext=0 %t1.o -o %t1out
# RUN: ld.lld --image-base=0 -Ttext=0 %t2.o -o %t2out
# RUN: not ld.lld --image-base=0 -Ttext=0 %t3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix RANGE
# RANGE: relocation R_390_20 out of range: 524288 is not in [-524288, 524287]

View File

@@ -15,9 +15,9 @@
# RUN: llvm-mc -filetype=obj -triple=s390x -defsym ADDEND=32768 %t/addend.s -o %t/2.o
# RUN: llvm-mc -filetype=obj -triple=s390x -defsym ADDEND=32769 %t/addend.s -o %t/3.o
# RUN: ld.lld --section-start=.text=0x0 %t/1.o -o %t/1out
# RUN: ld.lld --section-start=.text=0x0 %t/2.o -o %t/2out
# RUN: not ld.lld --section-start=.text=0x0 %t/3.o -o /dev/null 2>&1 | FileCheck %s -DFILE=%t/3.o --check-prefix RANGE
# RUN: ld.lld --image-base=0 -Ttext=0 %t/1.o -o %t/1out
# RUN: ld.lld --image-base=0 -Ttext=0 %t/2.o -o %t/2out
# RUN: not ld.lld --image-base=0 -Ttext=0 %t/3.o -o /dev/null 2>&1 | FileCheck %s -DFILE=%t/3.o --check-prefix RANGE
# RANGE: error: [[FILE]]:(.text+0x0): relocation R_390_PC16 out of range

View File

@@ -15,9 +15,9 @@
# RUN: llvm-mc -filetype=obj -triple=s390x -defsym ADDEND=2147483648 %t/addend.s -o %t/2.o
# RUN: llvm-mc -filetype=obj -triple=s390x -defsym ADDEND=2147483649 %t/addend.s -o %t/3.o
# RUN: ld.lld --section-start=.text=0x0 %t/1.o -o %t/1out
# RUN: ld.lld --section-start=.text=0x0 %t/2.o -o %t/2out
# RUN: not ld.lld --section-start=.text=0x0 %t/3.o -o /dev/null 2>&1 | FileCheck %s -DFILE=%t/3.o --check-prefix RANGE
# RUN: ld.lld --image-base=0 -Ttext=0 %t/1.o -o %t/1out
# RUN: ld.lld --image-base=0 -Ttext=0 %t/2.o -o %t/2out
# RUN: not ld.lld --image-base=0 -Ttext=0 %t/3.o -o /dev/null 2>&1 | FileCheck %s -DFILE=%t/3.o --check-prefix RANGE
# RANGE: error: [[FILE]]:(.text+0x0): relocation R_390_PC32 out of range

View File

@@ -8,7 +8,7 @@
## Check patching of negative addends
# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/addend.s -o %t/addend.o
# RUN: not ld.lld --section-start=.text=0x0 %t/addend.o -o /dev/null 2>&1 | FileCheck %s --check-prefix RANGE
# RUN: not ld.lld --image-base=0 --section-start=.text=0x0 %t/addend.o -o /dev/null 2>&1 | FileCheck %s --check-prefix RANGE
# RANGE: relocation R_X86_64_32 out of range

View File

@@ -15,9 +15,9 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64 -defsym ADDEND=2147483648 %t/addend.s -o %t/2.o
# RUN: llvm-mc -filetype=obj -triple=x86_64 -defsym ADDEND=2147483649 %t/addend.s -o %t/3.o
# RUN: ld.lld --section-start=.text=0x0 %t/1.o -o %t/1out
# RUN: ld.lld --section-start=.text=0x0 %t/2.o -o %t/2out
# RUN: not ld.lld --section-start=.text=0x0 %t/3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix RANGE
# RUN: ld.lld --image-base=0 --section-start=.text=0x0 %t/1.o -o %t/1out
# RUN: ld.lld --image-base=0 --section-start=.text=0x0 %t/2.o -o %t/2out
# RUN: not ld.lld --image-base=0 --section-start=.text=0x0 %t/3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix RANGE
# RANGE: relocation R_X86_64_PC32 out of range