[llvm-bugs] [Bug 42892] New: After r356631, Sanitizer-i386-Test faills to link on FreeBSD

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 5 12:47:55 PDT 2019


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

            Bug ID: 42892
           Summary: After r356631, Sanitizer-i386-Test faills to link on
                    FreeBSD
           Product: new-bugs
           Version: 9.0
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Because we are still missing a proper libatomic on FreeBSD (see
https://bugs.freebsd.org/230888), we do not have many of the builtins that
clang is calling after r356631 ("[X86] Add CMPXCHG8B feature flag. Set it for
all CPUs except i386/i486 including 'generic'. Disable use of CMPXCHG8B when
this flag isn't set.").

Specifically, this occurs because for the 32-bit x86 architecture (aka "i386")
FreeBSD still targets the i486 CPU by default, which does not support
cmpxchg8b.  (But note that it can also occur for e.g. 128-bit atomic loads on
64-bit architectures which do not have cmpxchg16b.)

To be able to build and test 9.0.0 rc1, I had to apply the following hack,
which basically sets the default target CPU for i386-unknown-freebsd to i586:

diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp
b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index 34be226b69e..f29948dab54 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -93,10 +93,10 @@ const char *x86::getX86TargetCPU(const ArgList &Args,
     return "x86-64";

   switch (Triple.getOS()) {
-  case llvm::Triple::FreeBSD:
   case llvm::Triple::NetBSD:
   case llvm::Triple::OpenBSD:
     return "i486";
+  case llvm::Triple::FreeBSD:
   case llvm::Triple::Haiku:
     return "i586";
   default:

I do not know a good way out of this conundrum.  We cannot come up with a quick
implementation of libatomic, as it has been an issue for years and nobody has
such an implementation.  On the other hand, our default target CPU has always
been i486, but realistically nobody in their right mind will run modern FreeBSD
on such CPUs.  Raising it to i586 (or even i686, woohoo) is most likely not
going to affect anybody, except for a few people insisting on running museum
hardware.

-- 
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/20190805/abaafdc5/attachment.html>


More information about the llvm-bugs mailing list