After discussing the previous patch with David Chisnall I have updated
the patch.
In this patch I have:
1. Stopped defining __FreeBSD_ARCH_armv6__ as it is unneeded, the
FreeBSD source that relies on it will be fixed
2. Updated a comment to make it clearer the floating point abi is the
default and can be overridden.
This patch also contains the tests from the previous one and should be
ready to commit.
Andrew
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp (revision 169366)
+++ lib/Basic/Targets.cpp (working copy)
@@ -3094,7 +3094,10 @@ public:
// name.
if (Name == "apcs-gnu") {
DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 32;
- SizeType = UnsignedLong;
+ // size_t is unsigned int on FreeBSD.
+ if (getTriple().getOS() != llvm::Triple::FreeBSD) {
+ SizeType = UnsignedLong;
+ }
// Revert to using SignedInt on apcs-gnu to comply with existing behaviour.
WCharType = SignedInt;
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp (revision 169366)
+++ lib/Driver/ToolChains.cpp (working copy)
@@ -1683,6 +1683,19 @@ Tool &FreeBSD::SelectTool(const Compilat
return *T;
}
+bool FreeBSD::UseSjLjExceptions() const {
+ // FreeBSD uses SjLj exceptions on ARM oabi.
+ switch (getTriple().getEnvironment()) {
+ case llvm::Triple::GNUEABI:
+ case llvm::Triple::EABI:
+ return false;
+
+ default:
+ return (getTriple().getArch() == llvm::Triple::arm ||
+ getTriple().getArch() == llvm::Triple::thumb);
+ }
+}
+
/// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp (revision 169366)
+++ lib/Driver/Tools.cpp (working copy)
@@ -662,6 +662,11 @@ static StringRef getARMFloatABI(const Dr
break;
}
+ case llvm::Triple::FreeBSD:
+ // FreeBSD defaults soft float
+ FloatABI = "soft";
+ break;
+
default:
switch(Triple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
@@ -4833,6 +4838,17 @@ void freebsd::Assemble::ConstructJob(Com
LastPICArg->getOption().matches(options::OPT_fpie))) {
CmdArgs.push_back("-KPIC");
}
+ } else if (getToolChain().getArch() == llvm::Triple::arm ||
+ getToolChain().getArch() == llvm::Triple::thumb) {
+ CmdArgs.push_back("-mfpu=softvfp");
+ switch(getToolChain().getTriple().getEnvironment()) {
+ case llvm::Triple::GNUEABI:
+ case llvm::Triple::EABI:
+ break;
+
+ default:
+ CmdArgs.push_back("-matpcs");
+ }
}
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
Index: lib/Driver/ToolChains.h
===================================================================
--- lib/Driver/ToolChains.h (revision 169366)
+++ lib/Driver/ToolChains.h (working copy)
@@ -467,6 +467,7 @@ public:
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA,
const ActionList &Inputs) const;
+ virtual bool UseSjLjExceptions() const;
};
class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
Index: test/Misc/freebsd-arm-size_t.c
===================================================================
--- test/Misc/freebsd-arm-size_t.c (revision 0)
+++ test/Misc/freebsd-arm-size_t.c (working copy)
@@ -0,0 +1,9 @@
+// RUN: %clang %s -S -o %t.s -Werror 2>&1 \
+// RUN: -target arm-unknown-freebsd10.0
+
+/* Define a size_t as expected for FreeBSD ARM */
+typedef unsigned int size_t;
+
+/* Declare a builtin function that uses size_t */
+void *malloc(size_t);
+
Index: test/Driver/freebsd.c
===================================================================
--- test/Driver/freebsd.c (revision 169366)
+++ test/Driver/freebsd.c (working copy)
@@ -96,3 +96,16 @@
// RUN: | FileCheck --check-prefix=CHECK-NORMAL %s
// CHECK-NORMAL: crt1.o
// CHECK-NORMAL: crtbegin.o
+
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: -target arm-unknown-freebsd10.0 \
+// RUN: | FileCheck --check-prefix=CHECK-ARM %s
+// CHECK-ARM: clang{{.*}}" "-cc1"{{.*}}" "-fsjlj-exceptions"
+// CHECK-ARM: as{{.*}}" "-matpcs"
+
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: -target arm-gnueabi-freebsd10.0 \
+// RUN: | FileCheck --check-prefix=CHECK-ARM-EABI %s
+// CHECK-ARM-EABI-NOT: clang{{.*}}" "-cc1"{{.*}}" "-fsjlj-exceptions"
+// CHECK-ARM-EABI-NOT: as{{.*}}" "-matpcs"
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits