Skip to content

Commit f6fad0d

Browse files
committed
Change the runpath to an architecture-specific directory on ELF platforms
This is needed for swiftlang/swift#63782, which changes the Unix toolchain to look for libraries in architecture-specific directories.
1 parent 495b4be commit f6fad0d

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

lit.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ config.test_exec_root = lit_config.params.get(
7878
# target and stick it in here.
7979
if platform.system() == 'Linux':
8080
config.target_triple = 'linux'
81+
linux_run_arch = subprocess.check_output(["uname", "-m"]).strip().decode("utf-8")
8182
elif platform.system() == 'Darwin':
8283
config.target_triple = 'darwin'
8384

@@ -234,6 +235,7 @@ config.substitutions.append( ('%{not}', os.path.join(srcroot, "not")) )
234235
config.substitutions.append( ('%{lldb}', lldb_path) )
235236
if platform.system() == 'Linux':
236237
config.substitutions.append( ('%{repl_swift}', repl_swift_dummy_path) )
238+
config.substitutions.append( ('%{linux_arch}', linux_run_arch) )
237239
config.substitutions.append( ('%{swift}', swift_path) )
238240
config.substitutions.append( ('%{swiftc}', swiftc_path) )
239241
config.substitutions.append( ('%{FileCheck}', filecheck_path) )

test-snapshot-binaries/test-rpath-linux.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
# Tests that DT_RPATH is correct for the dummy repl executable on Linux.
22
# REQUIRES: platform=Linux
33
# RUN: %{readelf} -d %{repl_swift} | %{FileCheck} %s
4-
# CHECK: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN/../lib/swift/linux
4+
# CHECK: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN/../lib/swift/linux/
55
#
66
# Tests that DT_RUNPATH is correct for the Swift stdlib and other libraries on Linux.
7-
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftCore.so | %{FileCheck} --check-prefix CHECK-CORE %s
7+
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/%{linux_arch}/libswiftCore.so | %{FileCheck} --check-prefix CHECK-CORE %s
8+
# CHECK-CORE: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN{{[^/]}}
89
# CHECK-CORE-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux
910
#
1011
# RUN: %{readelf} -d %{package_path}/usr/lib/libsourcekitdInProc.so | %{FileCheck} --check-prefix CHECK-SK %s
12+
# CHECK-SK: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN/swift/linux/
1113
# CHECK-SK-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux
1214
#
13-
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftRemoteMirror.so | %{FileCheck} --check-prefix CHECK-RM %s
15+
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/%{linux_arch}/libswiftRemoteMirror.so | %{FileCheck} --check-prefix CHECK-RM %s
16+
# CHECK-RM: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN{{[^/]}}
1417
# CHECK-RM-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux
1518
#
16-
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswift_Differentiation.so | %{FileCheck} --check-prefix CHECK-SD %s
19+
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/%{linux_arch}/libswift_Differentiation.so | %{FileCheck} --check-prefix CHECK-SD %s
20+
# CHECK-SD: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN{{[^/]}}
1721
# CHECK-SD-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux
1822
#
19-
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftGlibc.so | %{FileCheck} --check-prefix CHECK-SG %s
23+
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/%{linux_arch}/libswiftGlibc.so | %{FileCheck} --check-prefix CHECK-SG %s
24+
# CHECK-SG: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN{{[^/]}}
2025
# CHECK-SG-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux
2126
#
22-
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/libswiftSwiftOnoneSupport.so | %{FileCheck} --check-prefix CHECK-SON %s
27+
# RUN: %{readelf} -d %{package_path}/usr/lib/swift/linux/%{linux_arch}/libswiftSwiftOnoneSupport.so | %{FileCheck} --check-prefix CHECK-SON %s
28+
# CHECK-SON: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN{{[^/]}}
2329
# CHECK-SON-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}:/usr/lib/swift/linux
2430
#
2531
# RUN: %{readelf} -d %{package_path}/usr/lib/libswiftDemangle.so | %{FileCheck} --check-prefix CHECK-SDE %s

0 commit comments

Comments
 (0)