I have attached a new patch that updates the tests.
On Fri, 7 Dec 2012 09:24:08 -0500
Rafael Espíndola <[email protected]> wrote:
> > I have reviewed this patch (over three iterations) and am happy
> > with it. I'd be happy to commit it if none of the driver people
> > want to give it another look.
>
> You pass -mfpu=softvfp even when you have a hard float abi
> (llvm::Triple::GNUEABIHF), no? Is that really correct?
There is currently no support in FreeBSD for any of the the ARM EABI
variants or for hard float. I am working on adding support to FreeBSD
for the ARM EABI but it is not yet in the main development tree. I
included the EABI changes so, when this support is included, we will
not need to update clang again to use it.
For hard float we have support for vfp in the kernel however it is not
enabled in any of the kernel configs and I'm not sure about the state
of it. Because of this I consider llvm::Triple::GNUEABIHF to be
unsupported on FreeBSD.
I can update the code to handle the llvm::Triple::GNUEABIHF however it
will be untested and unable to be used on any FreeBSD system. I intend
to fix this when FreeBSD supports the ARM EABI however until then I
would like to get clang working in the currently supported and soon to
be supported ABIs.
>
> test/Misc/freebsd-arm-size_t.c:
>
> Nit: Use "clang -cc1" and -verify instead of "clang -Werror".
>
> Please make sure that you have a test where -mfpu=softvfp shows up.
> Please add a test with the hard float environment.
I've updated the tests to ensure -mfpu=softvfp shows up, and changed it
to use %clang_cc1.
Andrew
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp (revision 169674)
+++ 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 169674)
+++ lib/Driver/ToolChains.cpp (working copy)
@@ -1861,6 +1861,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 169674)
+++ lib/Driver/Tools.cpp (working copy)
@@ -662,6 +662,11 @@ static StringRef getARMFloatABI(const Dr
break;
}
+ case llvm::Triple::FreeBSD:
+ // FreeBSD defaults to soft float
+ FloatABI = "soft";
+ break;
+
default:
switch(Triple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
@@ -4923,6 +4928,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 169674)
+++ lib/Driver/ToolChains.h (working copy)
@@ -452,6 +452,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_cc1 -triple arm-unknown-freebsd10.0 -verify %s
+// expected-no-diagnostics
+
+/* 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 169674)
+++ test/Driver/freebsd.c (working copy)
@@ -96,3 +96,15 @@
// RUN: | FileCheck --check-prefix=CHECK-NORMAL %s
// CHECK-NORMAL: crt1.o
// CHECK-NORMAL: crtbegin.o
+
+// RUN: %clang %s -### -o %t.o -target arm-unknown-freebsd10.0 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-ARM %s
+// CHECK-ARM: clang{{.*}}" "-cc1"{{.*}}" "-fsjlj-exceptions"
+// CHECK-ARM: as{{.*}}" "-mfpu=softvfp"{{.*}}"-matpcs"
+
+// RUN: %clang %s -### -o %t.o -target arm-gnueabi-freebsd10.0 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-ARM-EABI %s
+// CHECK-ARM-EABI-NOT: clang{{.*}}" "-cc1"{{.*}}" "-fsjlj-exceptions"
+// CHECK-ARM-EABI: as{{.*}}" "-mfpu=softvfp"
+// CHECK-ARM-EABI-NOT: as{{.*}}" "-matpcs"
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits