[clang] [llvm] [OpenEmbedded] Fix include and lib paths for multilib targets (PR #121302)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 23 10:31:47 PST 2025
MaskRay wrote:
The include and library path code in the driver needs more love. I have cleaned up some a few years ago but there is still quite a bit tech debt.
In particular, the 2018 commit you mentioned (https://reviews.llvm.org/D48862) introduced
```
if (Triple.getVendor() == llvm::Triple::OpenEmbedded &&
Triple.isArch64Bit())
addPathIfExists(D, SysRoot + "/usr/" + OSLibDir, Paths);
else
addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
```
which could be simplified to `/usr/ + OSLibDir`, and the latter `/usr/lib` could be removed if OSLibDir is "lib".
I am testing https://github.com/llvm/llvm-project/pull/128428 and will push it when the Windows tests pass (it's annoying but Windows uses \\, making a lot of tests ugly..)
---
A lot of ELF-specific Triple::VendorType should not have been added in the first place.
Can you confirm whether you added new OpenEmbedded VendorType due to the following customization?
This is an unfortunate special case and I hope that OpenEmbedded moves away from the difference. Just pick gcc/ or gcc-cross/ or install symlinks so that Clang doesn't need to more probing.
It does not scale if there are similar projects like OpenEmbedded that do a similar thing and want to add a new VendorType to LLVM just to make their upstream divergent customization working.
```
// This is the normal place.
{"gcc/" + CandidateTriple.str(), "../..", GCCDirExists},
// Debian puts cross-compilers in gcc-cross.
{"gcc-cross/" + CandidateTriple.str(), "../..", GCCCrossDirExists},
// The Freescale PPC SDK has the gcc libraries in
// <sysroot>/usr/lib/<triple>/x.y.z so have a look there as well. Only do
// this on Freescale triples, though, since some systems put a *lot* of
// files in that location, not just GCC installation data.
{CandidateTriple.str(), "..",
TargetTriple.getVendor() == llvm::Triple::Freescale ||
TargetTriple.getVendor() == llvm::Triple::OpenEmbedded}};
```
https://github.com/llvm/llvm-project/pull/121302
More information about the cfe-commits
mailing list