From 07e2300a8c9c8a70384ddfe310cf3495fab1821c Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 16 May 2025 23:57:44 -0700 Subject: [PATCH] [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. --- .../ELF/aarch64-reloc-implicit-addend.test | 4 +- lld/test/ELF/aarch64-thunk-align.s | 2 +- lld/test/ELF/arm-cmse-diagnostics.s | 36 ++++----- lld/test/ELF/arm-cmse-implib.s | 4 +- lld/test/ELF/arm-cmse-keep-sections.s | 2 +- lld/test/ELF/arm-cmse-noveneers.s | 2 +- lld/test/ELF/arm-cmse-secure.s | 2 +- lld/test/ELF/arm-cmse-veneers.s | 2 +- lld/test/ELF/avr-reloc-error.s | 6 +- lld/test/ELF/basic-avr.s | 6 +- lld/test/ELF/compress-debug-sections-reloc.s | 2 +- lld/test/ELF/eh-frame-value-format7.s | 2 +- lld/test/ELF/eh-frame-value-format8.s | 2 +- lld/test/ELF/gdb-index-dwarf5-type-unit.s | 4 +- lld/test/ELF/gdb-index-icf.s | 2 +- lld/test/ELF/i386-pc16.test | 2 +- lld/test/ELF/i386-pc8.s | 2 +- lld/test/ELF/i386-reloc-16-large-addend.s | 2 +- lld/test/ELF/i386-reloc-8-large-addend.s | 2 +- lld/test/ELF/i386-reloc-large-addend.s | 2 +- lld/test/ELF/i386-reloc-range.s | 4 +- lld/test/ELF/i386-reloc8-reloc16-addend.s | 2 +- lld/test/ELF/just-symbols-cref.s | 2 +- lld/test/ELF/just-symbols.s | 2 +- lld/test/ELF/linkerscript/avr5.test | 2 +- .../ELF/linkerscript/memory-no-sections.test | 2 +- lld/test/ELF/loongarch-pc-aligned.s | 74 +++++++++---------- lld/test/ELF/msp430.s | 2 +- lld/test/ELF/nmagic.s | 2 +- lld/test/ELF/oformat-binary-ttext.s | 4 +- lld/test/ELF/sectionstart-noallochdr.s | 2 +- lld/test/ELF/systemz-reloc-disp12.s | 6 +- lld/test/ELF/systemz-reloc-disp20.s | 6 +- lld/test/ELF/systemz-reloc-pc16.s | 6 +- lld/test/ELF/systemz-reloc-pc32.s | 6 +- lld/test/ELF/x86-64-reloc-32.s | 2 +- lld/test/ELF/x86-64-reloc-pc32.s | 6 +- 37 files changed, 109 insertions(+), 109 deletions(-) diff --git a/lld/test/ELF/aarch64-reloc-implicit-addend.test b/lld/test/ELF/aarch64-reloc-implicit-addend.test index 4ad8d23744c3..ba18a5eec421 100644 --- a/lld/test/ELF/aarch64-reloc-implicit-addend.test +++ b/lld/test/ELF/aarch64-reloc-implicit-addend.test @@ -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 diff --git a/lld/test/ELF/aarch64-thunk-align.s b/lld/test/ELF/aarch64-thunk-align.s index 425a00c7564a..584c02fb8f7f 100644 --- a/lld/test/ELF/aarch64-thunk-align.s +++ b/lld/test/ELF/aarch64-thunk-align.s @@ -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 diff --git a/lld/test/ELF/arm-cmse-diagnostics.s b/lld/test/ELF/arm-cmse-diagnostics.s index 4c8a4097e825..c15cf357a756 100644 --- a/lld/test/ELF/arm-cmse-diagnostics.s +++ b/lld/test/ELF/arm-cmse-diagnostics.s @@ -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 diff --git a/lld/test/ELF/arm-cmse-implib.s b/lld/test/ELF/arm-cmse-implib.s index 60a68b0226c3..d528c861db21 100644 --- a/lld/test/ELF/arm-cmse-implib.s +++ b/lld/test/ELF/arm-cmse-implib.s @@ -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 diff --git a/lld/test/ELF/arm-cmse-keep-sections.s b/lld/test/ELF/arm-cmse-keep-sections.s index 5c5c7b8ca803..4130869bb1f1 100644 --- a/lld/test/ELF/arm-cmse-keep-sections.s +++ b/lld/test/ELF/arm-cmse-keep-sections.s @@ -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 diff --git a/lld/test/ELF/arm-cmse-noveneers.s b/lld/test/ELF/arm-cmse-noveneers.s index 19e7a45e356b..39bfcdfad29b 100644 --- a/lld/test/ELF/arm-cmse-noveneers.s +++ b/lld/test/ELF/arm-cmse-noveneers.s @@ -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 diff --git a/lld/test/ELF/arm-cmse-secure.s b/lld/test/ELF/arm-cmse-secure.s index d6fb661c4649..77edf48f17a8 100644 --- a/lld/test/ELF/arm-cmse-secure.s +++ b/lld/test/ELF/arm-cmse-secure.s @@ -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 diff --git a/lld/test/ELF/arm-cmse-veneers.s b/lld/test/ELF/arm-cmse-veneers.s index 7b5b29308114..3e9147b82906 100644 --- a/lld/test/ELF/arm-cmse-veneers.s +++ b/lld/test/ELF/arm-cmse-veneers.s @@ -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 diff --git a/lld/test/ELF/avr-reloc-error.s b/lld/test/ELF/avr-reloc-error.s index b36a24d764c5..4fe6cb9d473f 100644 --- a/lld/test/ELF/avr-reloc-error.s +++ b/lld/test/ELF/avr-reloc-error.s @@ -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 diff --git a/lld/test/ELF/basic-avr.s b/lld/test/ELF/basic-avr.s index 71b8412bb2ac..57b48f0ea072 100644 --- a/lld/test/ELF/basic-avr.s +++ b/lld/test/ELF/basic-avr.s @@ -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 diff --git a/lld/test/ELF/compress-debug-sections-reloc.s b/lld/test/ELF/compress-debug-sections-reloc.s index e8e3dadcf222..3ebe4b4688b1 100644 --- a/lld/test/ELF/compress-debug-sections-reloc.s +++ b/lld/test/ELF/compress-debug-sections-reloc.s @@ -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 diff --git a/lld/test/ELF/eh-frame-value-format7.s b/lld/test/ELF/eh-frame-value-format7.s index 99eff108026a..2291f90f7c04 100644 --- a/lld/test/ELF/eh-frame-value-format7.s +++ b/lld/test/ELF/eh-frame-value-format7.s @@ -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. diff --git a/lld/test/ELF/eh-frame-value-format8.s b/lld/test/ELF/eh-frame-value-format8.s index 6d5da05c2bfa..6e053ad55813 100644 --- a/lld/test/ELF/eh-frame-value-format8.s +++ b/lld/test/ELF/eh-frame-value-format8.s @@ -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. diff --git a/lld/test/ELF/gdb-index-dwarf5-type-unit.s b/lld/test/ELF/gdb-index-dwarf5-type-unit.s index 5cd6778fe7e4..e8371efa09fd 100644 --- a/lld/test/ELF/gdb-index-dwarf5-type-unit.s +++ b/lld/test/ELF/gdb-index-dwarf5-type-unit.s @@ -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; diff --git a/lld/test/ELF/gdb-index-icf.s b/lld/test/ELF/gdb-index-icf.s index 3f0f12361d3f..9df5fa0dad87 100644 --- a/lld/test/ELF/gdb-index-icf.s +++ b/lld/test/ELF/gdb-index-icf.s @@ -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: diff --git a/lld/test/ELF/i386-pc16.test b/lld/test/ELF/i386-pc16.test index e0ae31d2da00..cce14cb6ab4f 100644 --- a/lld/test/ELF/i386-pc16.test +++ b/lld/test/ELF/i386-pc16.test @@ -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: diff --git a/lld/test/ELF/i386-pc8.s b/lld/test/ELF/i386-pc8.s index db3bcac2aa63..99ff5a6b6737 100644 --- a/lld/test/ELF/i386-pc8.s +++ b/lld/test/ELF/i386-pc8.s @@ -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: diff --git a/lld/test/ELF/i386-reloc-16-large-addend.s b/lld/test/ELF/i386-reloc-16-large-addend.s index ceb4862d7935..73e757934471 100644 --- a/lld/test/ELF/i386-reloc-16-large-addend.s +++ b/lld/test/ELF/i386-reloc-16-large-addend.s @@ -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: diff --git a/lld/test/ELF/i386-reloc-8-large-addend.s b/lld/test/ELF/i386-reloc-8-large-addend.s index 61d638040847..dc3dd78e0dcd 100644 --- a/lld/test/ELF/i386-reloc-8-large-addend.s +++ b/lld/test/ELF/i386-reloc-8-large-addend.s @@ -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: diff --git a/lld/test/ELF/i386-reloc-large-addend.s b/lld/test/ELF/i386-reloc-large-addend.s index bcdc99115b7a..adf9ef4bae8b 100644 --- a/lld/test/ELF/i386-reloc-large-addend.s +++ b/lld/test/ELF/i386-reloc-large-addend.s @@ -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: diff --git a/lld/test/ELF/i386-reloc-range.s b/lld/test/ELF/i386-reloc-range.s index 1ca6dbabecba..104353256356 100644 --- a/lld/test/ELF/i386-reloc-range.s +++ b/lld/test/ELF/i386-reloc-range.s @@ -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' diff --git a/lld/test/ELF/i386-reloc8-reloc16-addend.s b/lld/test/ELF/i386-reloc8-reloc16-addend.s index b86654c6429d..85982a5f7427 100644 --- a/lld/test/ELF/i386-reloc8-reloc16-addend.s +++ b/lld/test/ELF/i386-reloc8-reloc16-addend.s @@ -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 diff --git a/lld/test/ELF/just-symbols-cref.s b/lld/test/ELF/just-symbols-cref.s index c58e0ce9d6dd..0ad1b2c6eb98 100644 --- a/lld/test/ELF/just-symbols-cref.s +++ b/lld/test/ELF/just-symbols-cref.s @@ -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 diff --git a/lld/test/ELF/just-symbols.s b/lld/test/ELF/just-symbols.s index 974358a00709..20973d56c09f 100644 --- a/lld/test/ELF/just-symbols.s +++ b/lld/test/ELF/just-symbols.s @@ -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 diff --git a/lld/test/ELF/linkerscript/avr5.test b/lld/test/ELF/linkerscript/avr5.test index 5e52c945bae8..4353eecb8ed2 100644 --- a/lld/test/ELF/linkerscript/avr5.test +++ b/lld/test/ELF/linkerscript/avr5.test @@ -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 diff --git a/lld/test/ELF/linkerscript/memory-no-sections.test b/lld/test/ELF/linkerscript/memory-no-sections.test index c5ce9cd1a4af..6a1beabfb282 100644 --- a/lld/test/ELF/linkerscript/memory-no-sections.test +++ b/lld/test/ELF/linkerscript/memory-no-sections.test @@ -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 diff --git a/lld/test/ELF/loongarch-pc-aligned.s b/lld/test/ELF/loongarch-pc-aligned.s index 0405961e5f74..6dc1cd1116d5 100644 --- a/lld/test/ELF/loongarch-pc-aligned.s +++ b/lld/test/ELF/loongarch-pc-aligned.s @@ -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 diff --git a/lld/test/ELF/msp430.s b/lld/test/ELF/msp430.s index 72bc9d28edc9..39079ed59697 100644 --- a/lld/test/ELF/msp430.s +++ b/lld/test/ELF/msp430.s @@ -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. diff --git a/lld/test/ELF/nmagic.s b/lld/test/ELF/nmagic.s index 4b548d089dd1..c7ce73bc8ea1 100644 --- a/lld/test/ELF/nmagic.s +++ b/lld/test/ELF/nmagic.s @@ -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 diff --git a/lld/test/ELF/oformat-binary-ttext.s b/lld/test/ELF/oformat-binary-ttext.s index 240f1f2f3244..f062da3f138d 100644 --- a/lld/test/ELF/oformat-binary-ttext.s +++ b/lld/test/ELF/oformat-binary-ttext.s @@ -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 diff --git a/lld/test/ELF/sectionstart-noallochdr.s b/lld/test/ELF/sectionstart-noallochdr.s index 9b9cac257e5c..e3425bd7ff68 100644 --- a/lld/test/ELF/sectionstart-noallochdr.s +++ b/lld/test/ELF/sectionstart-noallochdr.s @@ -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 diff --git a/lld/test/ELF/systemz-reloc-disp12.s b/lld/test/ELF/systemz-reloc-disp12.s index 3d32707d149f..ec61d0cf3430 100644 --- a/lld/test/ELF/systemz-reloc-disp12.s +++ b/lld/test/ELF/systemz-reloc-disp12.s @@ -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] diff --git a/lld/test/ELF/systemz-reloc-disp20.s b/lld/test/ELF/systemz-reloc-disp20.s index 88cd657c6ae3..dad86f65d862 100644 --- a/lld/test/ELF/systemz-reloc-disp20.s +++ b/lld/test/ELF/systemz-reloc-disp20.s @@ -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] diff --git a/lld/test/ELF/systemz-reloc-pc16.s b/lld/test/ELF/systemz-reloc-pc16.s index e1dad5af239d..034b0765ab02 100644 --- a/lld/test/ELF/systemz-reloc-pc16.s +++ b/lld/test/ELF/systemz-reloc-pc16.s @@ -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 diff --git a/lld/test/ELF/systemz-reloc-pc32.s b/lld/test/ELF/systemz-reloc-pc32.s index 0cb9322eb1c1..d5fb03b3f92c 100644 --- a/lld/test/ELF/systemz-reloc-pc32.s +++ b/lld/test/ELF/systemz-reloc-pc32.s @@ -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 diff --git a/lld/test/ELF/x86-64-reloc-32.s b/lld/test/ELF/x86-64-reloc-32.s index bf2fc26a5820..088b64675613 100644 --- a/lld/test/ELF/x86-64-reloc-32.s +++ b/lld/test/ELF/x86-64-reloc-32.s @@ -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 diff --git a/lld/test/ELF/x86-64-reloc-pc32.s b/lld/test/ELF/x86-64-reloc-pc32.s index 78bfd8e56488..011554891900 100644 --- a/lld/test/ELF/x86-64-reloc-pc32.s +++ b/lld/test/ELF/x86-64-reloc-pc32.s @@ -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