Append appropriate -rpath when using shared compiler-rt runtimes,
e.g. '-fsanitize=address -shared-libasan'. There's already a similar
logic in CommonArgs.cpp but it uses non-standard arch-suffixed
installation directory while we want our driver to work with standard
installation paths.
Details
- Reviewers
krytarowski joerg phosek dlj vitalybuka - Commits
- rG88481d545c3e: Merging r352610: --------------------------------------------------------------…
rG3a901b47ba00: [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
rL352650: Merging r352610:
rC352610: [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
rL352610: [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
Diff Detail
- Repository
- rL LLVM
Event Timeline
As a point of reference, we use shared runtimes on Fuchsia but we don't use rpath so this is not something we want for every system.
DT_NEEDED aren't treated as paths, they are used as object names (keys); dynamic linker passes those to the loader service which is responsible for resolving them and returning back the corresponding memory objects.
I see, I was more thinking about UNIX-like OSes as I haven't even treated -rpath here as applicable for other OSes.
Given that this path changes with every clang release, so you're effectively making a hard dependency on the clang version used to build the program, I dare say some systems may either decide not to support shared runtimes at all or use ld.so.conf or equivalent that can be dynamically changed.
Yeah, I don't think we should be stamping an -rpath unconditionally across targets. On top of static builds and ld.so.conf, this could end up nominating the wrong one of DT_RPATH and DT_RUNPATH, which is, unfortunately, still a target-specific distinction. By my quick reading of Driver/ToolChains/Linux.cpp, I think the combination of where we pass --enable-new-dtags and where we would pass -rpath would get this wrong on some systems (which would, infuriatingly, only maybe cause problems; and if so, only at runtime).