Skip to content

Commit 443baed

Browse files
committed
[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.
1 parent 0c1c0d5 commit 443baed

5 files changed

+18
-18
lines changed

lld/test/ELF/common-gc2.s

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# REQUIRES: x86
2-
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
3-
# RUN: ld.lld -gc-sections -export-dynamic %t -o %t1
4-
# RUN: llvm-readobj --dyn-symbols %t1 | FileCheck %s
2+
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3+
# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o %t2.o
4+
# RUN: ld.lld -shared -soname=t2 %t2.o -o %t2.so
5+
# RUN: ld.lld -gc-sections -export-dynamic %t.o %t2.so -o %t
6+
# RUN: llvm-readobj --dyn-symbols %t | FileCheck %s
57

68
# CHECK: Name: bar
79
# CHECK: Name: foo

lld/test/ELF/executable-undefined-ignoreall.s

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
88
# RUN: ld.lld %t.o -o %t --unresolved-symbols=ignore-all -pie
99
# RUN: llvm-readobj -r %t | FileCheck %s
10-
# RUN: ld.lld %t.o -o %t --unresolved-symbols=ignore-all --export-dynamic
11-
# RUN: llvm-readobj -r %t | FileCheck %s
1210

1311
# CHECK: Relocations [
1412
# CHECK-NEXT: Section ({{.*}}) .rela.plt {

lld/test/ELF/relro-non-contiguous-script-data.s

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
// REQUIRES: x86
22

3+
// RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o %t2.o
4+
// RUN: ld.lld -shared -soname=t2 %t2.o -o %t2.so
35
// RUN: echo "SECTIONS { \
46
// RUN: .dynamic : { *(.dynamic) } \
57
// RUN: .non_ro : { . += 1; } \
68
// RUN: .jcr : { *(.jcr) } \
79
// RUN: } " > %t.script
810
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
9-
// RUN: not ld.lld --export-dynamic %t.o -o /dev/null --script=%t.script 2>&1 | FileCheck %s
11+
// RUN: not ld.lld %t.o %t2.so -o /dev/null --script=%t.script 2>&1 | FileCheck %s
1012

1113
// RUN: echo "SECTIONS { \
1214
// RUN: .dynamic : { *(.dynamic) } \
1315
// RUN: .non_ro : { BYTE(1); } \
1416
// RUN: .jcr : { *(.jcr) } \
1517
// RUN: } " > %t2.script
16-
// RUN: not ld.lld --export-dynamic %t.o -o /dev/null --script=%t2.script 2>&1 | FileCheck %s
18+
// RUN: not ld.lld %t.o %t2.so -o /dev/null --script=%t2.script 2>&1 | FileCheck %s
1719

1820
// CHECK: error: section: .jcr is not contiguous with other relro sections
1921

lld/test/ELF/riscv-undefined-weak.s

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# REQUIRES: riscv
2+
# RUN: llvm-mc -filetype=obj -triple=riscv64 /dev/null -o %t2.o
3+
# RUN: ld.lld -shared -soname=t2 %t2.o -o %t2.so
24
# RUN: llvm-mc -filetype=obj -triple=riscv64 -riscv-asm-relax-branches=0 %s -o %t.o
35
# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=RELOC %s
46

57
# RUN: ld.lld -e absolute %t.o -o %t
68
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PC %s
79
# RUN: llvm-readelf -x .data %t | FileCheck --check-prefixes=HEX,HEX-WITHOUT-PLT %s
810

9-
# RUN: ld.lld -e absolute %t.o -o %t --export-dynamic
11+
# RUN: ld.lld -e absolute %t.o -o %t %t2.so
1012
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PLT %s
1113
# RUN: llvm-readelf -x .data %t | FileCheck --check-prefixes=HEX,HEX-WITH-PLT %s
1214

@@ -34,11 +36,11 @@ absolute:
3436
# CHECK-LABEL: <relative>:
3537
# CHECK-NEXT: 11{{...}}: auipc a1, 0xfffef
3638
# PC-NEXT: addi a1, a1, -0x160
37-
# PLT-NEXT: addi a1, a1, -0x318
39+
# PLT-NEXT: addi a1, a1, -0x290
3840
# CHECK-LABEL: <.Lpcrel_hi1>:
3941
# CHECK-NEXT: 11{{...}}: auipc t1, 0xfffef
4042
# PC-NEXT: sd a2, -0x166(t1)
41-
# PLT-NEXT: sd a2, -0x31e(t1)
43+
# PLT-NEXT: sd a2, -0x296(t1)
4244
relative:
4345
la a1, target
4446
sd a2, target+2, t1
@@ -62,7 +64,7 @@ relative:
6264
## We create a PLT entry and redirect the reference to it.
6365
# PLT-LABEL: <branch>:
6466
# PLT-NEXT: auipc ra, 0x0
65-
# PLT-NEXT: jalr 0x38(ra)
67+
# PLT-NEXT: jalr 0x30(ra)
6668
# PLT-NEXT: [[#%x,ADDR:]]:
6769
# PLT-SAME: j 0x[[#ADDR]]
6870
# PLT-NEXT: [[#%x,ADDR:]]:
@@ -84,12 +86,8 @@ branch:
8486
## A plt entry is created for target, so this is the offset between the
8587
## plt entry and this address.
8688
##
87-
## S = 0x11360 (the address of the plt entry for target)
88-
## A = 0
89-
## P = 0x1343c (the address of `.`)
90-
##
91-
## S - A + P = -0x0x20dc = 0xffffdf24
92-
# HEX-WITH-PLT-SAME: 24dfffff
89+
## S - A + P = -0x0x20ec = 0xffffdf14
90+
# HEX-WITH-PLT-SAME: 14dfffff
9391

9492
.data
9593
.p2align 3

lld/test/ELF/x86-64-dyn-rel-error.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# CHECK-NOT: error:
2020

2121
# RUN: ld.lld --noinhibit-exec %t.o %t2.so -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
22-
# RUN: not ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
22+
# RUN: not ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o %t2.so -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
2323

2424
# WARN: relocation R_X86_64_32 cannot be used against symbol 'zed'; recompile with -fPIC
2525
# WARN: relocation R_X86_64_PC32 cannot be used against symbol 'zed'; recompile with -fPIC

0 commit comments

Comments
 (0)