[lld] 443baed - [ELF,test] Update tests that depend on --export-dynamic creating dynamic sections
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 27 20:01:35 PDT 2024
Author: Fangrui Song
Date: 2024-03-27T20:01:30-07:00
New Revision: 443baed56c770aca050d27581d5d6f0c5c168285
URL: https://github.com/llvm/llvm-project/commit/443baed56c770aca050d27581d5d6f0c5c168285
DIFF: https://github.com/llvm/llvm-project/commit/443baed56c770aca050d27581d5d6f0c5c168285.diff
LOG: [ELF,test] Update tests that depend on --export-dynamic creating dynamic sections
The CloudABI change from https://reviews.llvm.org/D30175 does not make sense.
Update tests not to rely on the --export-dynamic behavior.
Added:
Modified:
lld/test/ELF/common-gc2.s
lld/test/ELF/executable-undefined-ignoreall.s
lld/test/ELF/relro-non-contiguous-script-data.s
lld/test/ELF/riscv-undefined-weak.s
lld/test/ELF/x86-64-dyn-rel-error.s
Removed:
################################################################################
diff --git a/lld/test/ELF/common-gc2.s b/lld/test/ELF/common-gc2.s
index fec1c4be86b5ee..1ecaef7d9af5aa 100644
--- a/lld/test/ELF/common-gc2.s
+++ b/lld/test/ELF/common-gc2.s
@@ -1,7 +1,9 @@
# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
-# RUN: ld.lld -gc-sections -export-dynamic %t -o %t1
-# RUN: llvm-readobj --dyn-symbols %t1 | FileCheck %s
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o %t2.o
+# RUN: ld.lld -shared -soname=t2 %t2.o -o %t2.so
+# RUN: ld.lld -gc-sections -export-dynamic %t.o %t2.so -o %t
+# RUN: llvm-readobj --dyn-symbols %t | FileCheck %s
# CHECK: Name: bar
# CHECK: Name: foo
diff --git a/lld/test/ELF/executable-undefined-ignoreall.s b/lld/test/ELF/executable-undefined-ignoreall.s
index cc38e17cdf619b..073b22bd84543a 100644
--- a/lld/test/ELF/executable-undefined-ignoreall.s
+++ b/lld/test/ELF/executable-undefined-ignoreall.s
@@ -7,8 +7,6 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t --unresolved-symbols=ignore-all -pie
# RUN: llvm-readobj -r %t | FileCheck %s
-# RUN: ld.lld %t.o -o %t --unresolved-symbols=ignore-all --export-dynamic
-# RUN: llvm-readobj -r %t | FileCheck %s
# CHECK: Relocations [
# CHECK-NEXT: Section ({{.*}}) .rela.plt {
diff --git a/lld/test/ELF/relro-non-contiguous-script-data.s b/lld/test/ELF/relro-non-contiguous-script-data.s
index fd485e89167fcc..530fc7c84eb91e 100644
--- a/lld/test/ELF/relro-non-contiguous-script-data.s
+++ b/lld/test/ELF/relro-non-contiguous-script-data.s
@@ -1,19 +1,21 @@
// REQUIRES: x86
+// RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o %t2.o
+// RUN: ld.lld -shared -soname=t2 %t2.o -o %t2.so
// RUN: echo "SECTIONS { \
// RUN: .dynamic : { *(.dynamic) } \
// RUN: .non_ro : { . += 1; } \
// RUN: .jcr : { *(.jcr) } \
// RUN: } " > %t.script
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: not ld.lld --export-dynamic %t.o -o /dev/null --script=%t.script 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o %t2.so -o /dev/null --script=%t.script 2>&1 | FileCheck %s
// RUN: echo "SECTIONS { \
// RUN: .dynamic : { *(.dynamic) } \
// RUN: .non_ro : { BYTE(1); } \
// RUN: .jcr : { *(.jcr) } \
// RUN: } " > %t2.script
-// RUN: not ld.lld --export-dynamic %t.o -o /dev/null --script=%t2.script 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o %t2.so -o /dev/null --script=%t2.script 2>&1 | FileCheck %s
// CHECK: error: section: .jcr is not contiguous with other relro sections
diff --git a/lld/test/ELF/riscv-undefined-weak.s b/lld/test/ELF/riscv-undefined-weak.s
index 303a27f920c57c..8a78e1f8383386 100644
--- a/lld/test/ELF/riscv-undefined-weak.s
+++ b/lld/test/ELF/riscv-undefined-weak.s
@@ -1,4 +1,6 @@
# REQUIRES: riscv
+# RUN: llvm-mc -filetype=obj -triple=riscv64 /dev/null -o %t2.o
+# RUN: ld.lld -shared -soname=t2 %t2.o -o %t2.so
# RUN: llvm-mc -filetype=obj -triple=riscv64 -riscv-asm-relax-branches=0 %s -o %t.o
# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=RELOC %s
@@ -6,7 +8,7 @@
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PC %s
# RUN: llvm-readelf -x .data %t | FileCheck --check-prefixes=HEX,HEX-WITHOUT-PLT %s
-# RUN: ld.lld -e absolute %t.o -o %t --export-dynamic
+# RUN: ld.lld -e absolute %t.o -o %t %t2.so
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PLT %s
# RUN: llvm-readelf -x .data %t | FileCheck --check-prefixes=HEX,HEX-WITH-PLT %s
@@ -34,11 +36,11 @@ absolute:
# CHECK-LABEL: <relative>:
# CHECK-NEXT: 11{{...}}: auipc a1, 0xfffef
# PC-NEXT: addi a1, a1, -0x160
-# PLT-NEXT: addi a1, a1, -0x318
+# PLT-NEXT: addi a1, a1, -0x290
# CHECK-LABEL: <.Lpcrel_hi1>:
# CHECK-NEXT: 11{{...}}: auipc t1, 0xfffef
# PC-NEXT: sd a2, -0x166(t1)
-# PLT-NEXT: sd a2, -0x31e(t1)
+# PLT-NEXT: sd a2, -0x296(t1)
relative:
la a1, target
sd a2, target+2, t1
@@ -62,7 +64,7 @@ relative:
## We create a PLT entry and redirect the reference to it.
# PLT-LABEL: <branch>:
# PLT-NEXT: auipc ra, 0x0
-# PLT-NEXT: jalr 0x38(ra)
+# PLT-NEXT: jalr 0x30(ra)
# PLT-NEXT: [[#%x,ADDR:]]:
# PLT-SAME: j 0x[[#ADDR]]
# PLT-NEXT: [[#%x,ADDR:]]:
@@ -84,12 +86,8 @@ branch:
## A plt entry is created for target, so this is the offset between the
## plt entry and this address.
##
-## S = 0x11360 (the address of the plt entry for target)
-## A = 0
-## P = 0x1343c (the address of `.`)
-##
-## S - A + P = -0x0x20dc = 0xffffdf24
-# HEX-WITH-PLT-SAME: 24dfffff
+## S - A + P = -0x0x20ec = 0xffffdf14
+# HEX-WITH-PLT-SAME: 14dfffff
.data
.p2align 3
diff --git a/lld/test/ELF/x86-64-dyn-rel-error.s b/lld/test/ELF/x86-64-dyn-rel-error.s
index a03adf89072f31..1590045312d4a3 100644
--- a/lld/test/ELF/x86-64-dyn-rel-error.s
+++ b/lld/test/ELF/x86-64-dyn-rel-error.s
@@ -19,7 +19,7 @@
# CHECK-NOT: error:
# RUN: ld.lld --noinhibit-exec %t.o %t2.so -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
-# RUN: not ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
+# RUN: not ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o %t2.so -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
# WARN: relocation R_X86_64_32 cannot be used against symbol 'zed'; recompile with -fPIC
# WARN: relocation R_X86_64_PC32 cannot be used against symbol 'zed'; recompile with -fPIC
More information about the llvm-commits
mailing list