[llvm-bugs] [Bug 51585] New: Clang by default creates ELFv1 binaries for powerpc64-unknown-freebsd target

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 23 08:11:17 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51585

            Bug ID: 51585
           Summary: Clang by default creates ELFv1 binaries for
                    powerpc64-unknown-freebsd target
           Product: clang
           Version: unspecified
          Hardware: Other
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pkubaj at anongoth.pl
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

When passed --target=powerpc64-unknown-freebsd, clang creates ELFv1 binaries,
even on a ELFv2 system. ELFv2 binaries are created only when the version is
appended, like --target=powerpc64-unknown-freebsd13.0.

Since ELFv1 is generally considered legacy on FreeBSD and on life support, it's
fine to just default to ELFv2. Clang never worked properly on FreeBSD on ELFv1
anyway.

The following patch fixes this issue.

--- clang/lib/Driver/ToolChains/Clang.cpp.orig  2021-08-11 19:51:00.122735000
+0200
+++ clang/lib/Driver/ToolChains/Clang.cpp       2021-08-11 19:51:24.346107000
+0200
@@ -1921,8 +1921,7 @@
   if (T.isOSBinFormatELF()) {
     switch (getToolChain().getArch()) {
     case llvm::Triple::ppc64: {
-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
-          T.isOSOpenBSD() || T.isMusl())
+      if (T.isOSFreeBSD() || T.isOSOpenBSD() || T.isMusl())
         ABIName = "elfv2";
       else
         ABIName = "elfv1";

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210823/cc3d6034/attachment.html>


More information about the llvm-bugs mailing list