Skip to content

Commit

Permalink
[Driver][FreeBSD] Generalise lib32 handling to support arm
Browse files Browse the repository at this point in the history
The current code maintains its own list of 32-bit architectures for
which there is a 64-bit FreeBSD architecture that supports it for lib32.
This is unnecessary (if it's not supported, the directory just won't
exist), and means that, when FreeBSD gains lib32 support for a new
architecture, you need an updated toolchain that knows about it.
Instead we can check for any 32-bit architecture and have forwards
compatibility.

This is motivated by FreeBSD adding support for building arm lib32
libraries on aarch64.

Co-authored-by: Mike Karels <karels@FreeBSD.org>
  • Loading branch information
jrtc27 and Mike Karels committed Jul 10, 2023
1 parent b8bb547 commit 3450272
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions clang/lib/Driver/ToolChains/FreeBSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,7 @@ FreeBSD::FreeBSD(const Driver &D, const llvm::Triple &Triple,

// When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall
// back to '/usr/lib' if it doesn't exist.
if ((Triple.getArch() == llvm::Triple::x86 || Triple.isMIPS32() ||
Triple.isPPC32()) &&
if (Triple.isArch32Bit() &&
D.getVFS().exists(concat(getDriver().SysRoot, "/usr/lib32/crt1.o")))
getFilePaths().push_back(concat(getDriver().SysRoot, "/usr/lib32"));
else
Expand Down

0 comments on commit 3450272

Please sign in to comment.