Skip to content

Commit c747b7d

Browse files
[llvm] Fix lto tests that requires ld64
Since Xcode 13, ld64 requires linking libSystem for all the executable. Fix the tests that needs to run ld64 by linking libSystem from sysroot. rdar://77332728 Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D104332
1 parent 3accff2 commit c747b7d

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

llvm/test/lit.cfg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def get_asan_rtlib():
115115
asan_rtlib = get_asan_rtlib()
116116
if asan_rtlib:
117117
ld64_cmd = 'DYLD_INSERT_LIBRARIES={} {}'.format(asan_rtlib, ld64_cmd)
118+
if config.osx_sysroot:
119+
ld64_cmd = '{} -syslibroot {}'.format(ld64_cmd, config.osx_sysroot)
118120

119121
ocamlc_command = '%s ocamlc -cclib -L%s %s' % (
120122
config.ocamlfind_executable, config.llvm_lib_dir, config.ocaml_flags)

llvm/test/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ config.errc_messages = "@LLVM_LIT_ERRC_MESSAGES@"
1717
config.python_executable = "@Python3_EXECUTABLE@"
1818
config.gold_executable = "@GOLD_EXECUTABLE@"
1919
config.ld64_executable = "@LD64_EXECUTABLE@"
20+
config.osx_sysroot = "@CMAKE_OSX_SYSROOT@"
2021
config.ocamlfind_executable = "@OCAMLFIND@"
2122
config.have_ocamlopt = @HAVE_OCAMLOPT@
2223
config.have_ocaml_ounit = @HAVE_OCAML_OUNIT@

llvm/test/tools/lto/hide-linkonce-odr.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: llvm-as %s -o %t.o
2-
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -dylib -arch x86_64 -macosx_version_min 10.10.0 -o %t.dylib %t.o -save-temps -undefined dynamic_lookup -exported_symbol _c -exported_symbol _b -exported_symbol _GlobLinkonce
2+
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -dylib -arch x86_64 -macosx_version_min 10.10.0 -o %t.dylib %t.o -save-temps -undefined dynamic_lookup -exported_symbol _c -exported_symbol _b -exported_symbol _GlobLinkonce -lSystem
33

44
; RUN: llvm-dis %t.dylib.lto.opt.bc -o - | FileCheck --check-prefix=IR %s
55
; check that @a is no longer a linkonce_odr definition

llvm/test/tools/lto/no-bitcode.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
; libLTO.dylib shouldn't assert on invalid inputs.
33
; RUN: llvm-mc -triple=arm64-apple-ios7.0.0 -filetype=obj -o %t.o
44
; RUN: llvm-ar r %t.a %t.o
5-
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -mllvm -O0 -o %t.dylib %t.a
5+
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -mllvm -O0 -o %t.dylib %t.a -lSystem

llvm/test/tools/lto/opt-level.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; RUN: llvm-as %s -o %t.o
2-
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -mllvm -O0 -o %t.dylib %t.o
2+
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -mllvm -O0 -o %t.dylib %t.o -lSystem
33
; RUN: llvm-nm --no-llvm-bc %t.dylib | FileCheck --check-prefix=CHECK-O0 %s
4-
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -mllvm -O2 -o %t.dylib %t.o
4+
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -mllvm -O2 -o %t.dylib %t.o -lSystem
55
; RUN: llvm-nm --no-llvm-bc %t.dylib | FileCheck --check-prefix=CHECK-O2 %s
66

77
target triple = "x86_64-apple-macosx10.8.0"

llvm/test/tools/lto/print-stats.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: llvm-as %s -o %t.o
2-
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -mllvm -stats -o %t.dylib %t.o 2>&1 | FileCheck --check-prefix=STATS %s
3-
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -o %t.dylib %t.o 2>&1 | FileCheck --check-prefix=NO_STATS %s
2+
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -mllvm -stats -o %t.dylib %t.o -lSystem 2>&1 | FileCheck --check-prefix=STATS %s
3+
; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -o %t.dylib %t.o -lSystem 2>&1 | FileCheck --check-prefix=NO_STATS %s
44
; REQUIRES: asserts
55

66
target triple = "x86_64-apple-macosx10.8.0"

0 commit comments

Comments
 (0)