[PATCH] D124018: [compiler-rt] Use ld64 flag -lto_library instead of DYLD_LIBRARY_PATH
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 10:34:06 PDT 2022
thakis created this revision.
thakis added a reviewer: aeubanks.
Herald added subscribers: kristof.beyls, inglorion, dberris.
Herald added a project: All.
thakis requested review of this revision.
Makes
bin/llvm-lit \
projects/compiler-rt/test/profile/Profile-arm64/instrprof-darwin-dead-strip.c
pass on my machine.
Without this change, ld64 complains that the bitcode was generated by LLVM 15
while the reader is 13.1 -- the version of Xcode on my machine. Looks like the
DYLD_LIBRARY_PATH technique isn't working.
-lto_library was added back in ld64-136, which was in Xcode 4.6, which was
released over 10 years ago. So relying on it should be safe by now.
https://reviews.llvm.org/D124018
Files:
compiler-rt/test/lit.common.cfg.py
compiler-rt/test/profile/lit.cfg.py
compiler-rt/test/safestack/lit.cfg.py
Index: compiler-rt/test/safestack/lit.cfg.py
===================================================================
--- compiler-rt/test/safestack/lit.cfg.py
+++ compiler-rt/test/safestack/lit.cfg.py
@@ -16,7 +16,7 @@
config.substitutions.append( ("%clang_safestack ", config.clang + " -O0 -fsanitize=safe-stack ") )
if config.lto_supported:
- config.substitutions.append((r"%clang_lto_safestack ", ' '.join(config.lto_launch + [config.clang] + config.lto_flags + ['-fsanitize=safe-stack '])))
+ config.substitutions.append((r"%clang_lto_safestack ", ' '.join([config.clang] + config.lto_flags + ['-fsanitize=safe-stack '])))
if config.host_os not in ['Linux', 'FreeBSD', 'NetBSD']:
config.unsupported = True
Index: compiler-rt/test/profile/lit.cfg.py
===================================================================
--- compiler-rt/test/profile/lit.cfg.py
+++ compiler-rt/test/profile/lit.cfg.py
@@ -44,11 +44,9 @@
def build_invocation(compile_flags, with_lto = False):
lto_flags = []
- lto_prefix = []
if with_lto and config.lto_supported:
lto_flags += config.lto_flags
- lto_prefix += config.lto_launch
- return " " + " ".join(lto_prefix + [config.clang] + lto_flags + compile_flags) + " "
+ return " " + " ".join([config.clang] + lto_flags + compile_flags) + " "
def exclude_unsupported_files_for_aix(dirname):
for filename in os.listdir(dirname):
Index: compiler-rt/test/lit.common.cfg.py
===================================================================
--- compiler-rt/test/lit.common.cfg.py
+++ compiler-rt/test/lit.common.cfg.py
@@ -520,8 +520,11 @@
config.available_features.add("has_sancovcc")
config.substitutions.append( ("%sancovcc ", sancovcc_path) )
+def liblto_path():
+ return os.path.join(config.llvm_shlib_dir, 'libLTO.dylib')
+
def is_darwin_lto_supported():
- return os.path.exists(os.path.join(config.llvm_shlib_dir, 'libLTO.dylib'))
+ return os.path.exists(liblto_path())
def is_binutils_lto_supported():
if not os.path.exists(os.path.join(config.llvm_shlib_dir, 'LLVMgold.so')):
@@ -543,8 +546,7 @@
if config.host_os == 'Darwin' and is_darwin_lto_supported():
config.lto_supported = True
- config.lto_launch = ["env", "DYLD_LIBRARY_PATH=" + config.llvm_shlib_dir]
- config.lto_flags = []
+ config.lto_flags = [ '-Wl,-lto_library,' + liblto_path() ]
elif config.host_os in ['Linux', 'FreeBSD', 'NetBSD']:
config.lto_supported = False
if config.use_lld:
@@ -554,14 +556,12 @@
config.lto_supported = True
if config.lto_supported:
- config.lto_launch = []
if config.use_lld:
config.lto_flags = ["-fuse-ld=lld"]
else:
config.lto_flags = ["-fuse-ld=gold"]
elif config.host_os == 'Windows' and is_windows_lto_supported():
config.lto_supported = True
- config.lto_launch = []
config.lto_flags = ["-fuse-ld=lld"]
else:
config.lto_supported = False
@@ -692,7 +692,6 @@
extra_cflags = []
if config.use_lto and config.lto_supported:
- run_wrapper += config.lto_launch
extra_cflags += config.lto_flags
elif config.use_lto and (not config.lto_supported):
config.unsupported = True
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124018.423668.patch
Type: text/x-patch
Size: 3129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220419/542ae4e7/attachment.bin>
More information about the llvm-commits
mailing list