[PATCH] D131563: [clang] Fix clang multiarch isssue with musl

Brahmajit via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 05:46:27 PDT 2022


listout created this revision.
listout added reviewers: dlj, atanasyan, MaskRay, Bdragon28.
Herald added subscribers: StephenFan, pengfei, fedor.sergeev, kristof.beyls.
Herald added a project: All.
listout requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

>From clang 13.0.0 has a new option -print-multiarch, matching gcc. On
linux-musl systems this outputs x86_64-linux-gnu (or aarch64-linux-gnu, etc)
instead of x86_64-linux-musl (or aarch64-linux-musl, etc).

Amongst other things, this bug breaks compiling python with clang on musl
hosts, as the python configure script does a sanity check and notices the
output of -print-multiarch is inconsistent with the linux-musl platform triplet
it (correctly) deduces for the host by other means. (The configure script
errors out with "internal configure error for the platform triplet, please file
a bug report" FWIW. This worked okay in clang 12.0.1 because python only checks
the multiarch target for consistency if $CC -print-multiarch isn't an error.)

The implementation in Linux::getMultiarchTriple() of
clang/lib/Driver/ToolChains/Linux.cpp special-cases -linux-android targets, and
assumes -linux-gnu for anything else.

Credit for this patch goes to arachsys <Chris Webb>
Please also reffer:
https://bugs.llvm.org/show_bug.cgi?id=52127 and
llvm/llvm-project#51469


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131563

Files:
  clang/lib/Driver/ToolChains/Linux.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131563.451416.patch
Type: text/x-patch
Size: 4868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220810/366cca55/attachment-0001.bin>


More information about the cfe-commits mailing list