Pull in r170096 from upstream clang trunk:

Initial support for FreeBSD on ARM.
This commit is contained in:
andrew 2012-12-23 21:41:39 +00:00
parent 7653472013
commit edc5efb0c3
4 changed files with 33 additions and 1 deletions

View File

@ -3078,7 +3078,9 @@ class ARMTargetInfo : public TargetInfo {
// 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;

View File

@ -1667,6 +1667,19 @@ Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,
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)

View File

@ -468,6 +468,7 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF {
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 {

View File

@ -665,6 +665,11 @@ static StringRef getARMFloatABI(const Driver &D,
break;
}
case llvm::Triple::FreeBSD:
// FreeBSD defaults to soft float
FloatABI = "soft";
break;
default:
switch(Triple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
@ -5422,6 +5427,17 @@ void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
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,