[Darwin] [compiler-rt] Normalize DYLD_LIBRARY_PATH to workaround LD bug (#175685)

There is an issue in certain versions of LD which causes the wrong
libLTO to be used if the DYLD_LIBRARY_PATH is not normalized.

Will fix these failures:
```
AddressSanitizer-x86_64-darwin.TestCases/Darwin.odr-lto.cpp
AddressSanitizer-x86_64h-darwin.TestCases/Darwin.odr-lto.cpp
```

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-cmake-RA-incremental/13428/

rdar://168024431
This commit is contained in:
Andrew Haberlandt 2026-01-12 16:44:41 -08:00 committed by GitHub
parent 998e0aed7b
commit 12ecbfb59b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,6 +90,12 @@ def push_dynamic_library_lookup_path(config, new_path):
new_ld_library_path = os.path.pathsep.join(
(new_path, config.environment.get(dynamic_library_lookup_var, ""))
)
if platform.system() == "Darwin":
# Workaround an issue in LD which does not use the correct libLTO
# if the DYLD_LIBRARY_PATH is not normalized.
new_ld_library_path = os.path.normpath(new_ld_library_path)
config.environment[dynamic_library_lookup_var] = new_ld_library_path
if platform.system() == "FreeBSD":