[clang] 3450272 - [Driver][FreeBSD] Generalise lib32 handling to support arm

Jessica Clarke via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 9 17:46:38 PDT 2023


Author: Jessica Clarke
Date: 2023-07-10T01:40:58+01:00
New Revision: 3450272fc281979388bb845a9fffb59b42cc2e7e

URL: https://github.com/llvm/llvm-project/commit/3450272fc281979388bb845a9fffb59b42cc2e7e
DIFF: https://github.com/llvm/llvm-project/commit/3450272fc281979388bb845a9fffb59b42cc2e7e.diff

LOG: [Driver][FreeBSD] Generalise lib32 handling to support arm

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 at FreeBSD.org>

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/FreeBSD.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index ac336598a78c94..84e257741702ce 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -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


        


More information about the cfe-commits mailing list