[PATCH] D158476: [driver] Search for compatible Android runtime directories

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 21 18:55:46 PDT 2023


smeenai created this revision.
smeenai added reviewers: collinbaker, thakis, MaskRay, phosek, danalbert, srhines.
Herald added subscribers: danielkiss, kristof.beyls.
Herald added a project: All.
smeenai requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Android triples include a version number, which makes direct triple
comparisons for per-target runtime directory searching not always work.
Instead, look for the triple with the highest compatible version number
and use that per-target runtime directory instead. This maintains the
existing fallback to a triple without any version number, but I'm hoping
we can remove that in the future. https://discourse.llvm.org/t/62717
discusses this further.

The one remaining triple mismatch after this is that Android armv7
triples usually have an environment of `androideabi`, which Clang
normalizes to `android`. If you use the `androideabi` triple when
building the runtimes with a per-target runtimes dir, the directory will
get created with `androideabi` in its name, but Clang's triple search
uses the normalized triple and will look for an `android` directory
instead. https://reviews.llvm.org/D140925 will fix that by normalizing
triples when creating the per-target runtimes directories as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158476

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-linux-android21/libclang_rt.builtins.a
  clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-linux-android23/libclang_rt.builtins.a
  clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-linux-android29/libclang_rt.builtins.a
  clang/test/Driver/linux-per-target-runtime-dir.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158476.552186.patch
Type: text/x-patch
Size: 5229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230822/5fa92d04/attachment.bin>


More information about the cfe-commits mailing list