forked from OSchip/llvm-project
Update clang support on recent Haiku
[ Copied from https://llvm.org/bugs/show_bug.cgi?id=26404 ] clang support on Haiku is lagging a bit, and missing on x86_64. This patch updates support for x86 and add support for x86_64. It should apply directly to trunk and it's harmless in the sense that it only affects Haiku. Reviewers: rnk, rsmith Patch by Jérôme Duval Differential Revision: http://reviews.llvm.org/D16797 llvm-svn: 269201
This commit is contained in:
parent
338b98fc88
commit
330fb175d4
|
@ -382,6 +382,29 @@ public:
|
|||
: OSTargetInfo<Target>(Triple, Opts) {}
|
||||
};
|
||||
|
||||
// Haiku Target
|
||||
template<typename Target>
|
||||
class HaikuTargetInfo : public OSTargetInfo<Target> {
|
||||
protected:
|
||||
void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
|
||||
MacroBuilder &Builder) const override {
|
||||
// Haiku defines; list based off of gcc output
|
||||
Builder.defineMacro("__HAIKU__");
|
||||
Builder.defineMacro("__ELF__");
|
||||
DefineStd(Builder, "unix", Opts);
|
||||
}
|
||||
public:
|
||||
HaikuTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
||||
: OSTargetInfo<Target>(Triple, Opts) {
|
||||
this->SizeType = TargetInfo::UnsignedLong;
|
||||
this->IntPtrType = TargetInfo::SignedLong;
|
||||
this->PtrDiffType = TargetInfo::SignedLong;
|
||||
this->ProcessIDType = TargetInfo::SignedLong;
|
||||
this->TLSSupported = false;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// Minix Target
|
||||
template<typename Target>
|
||||
class MinixTargetInfo : public OSTargetInfo<Target> {
|
||||
|
@ -4088,21 +4111,15 @@ public:
|
|||
};
|
||||
|
||||
// x86-32 Haiku target
|
||||
class HaikuX86_32TargetInfo : public X86_32TargetInfo {
|
||||
class HaikuX86_32TargetInfo : public HaikuTargetInfo<X86_32TargetInfo> {
|
||||
public:
|
||||
HaikuX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
||||
: X86_32TargetInfo(Triple, Opts) {
|
||||
SizeType = UnsignedLong;
|
||||
IntPtrType = SignedLong;
|
||||
PtrDiffType = SignedLong;
|
||||
ProcessIDType = SignedLong;
|
||||
this->TLSSupported = false;
|
||||
: HaikuTargetInfo<X86_32TargetInfo>(Triple, Opts) {
|
||||
}
|
||||
void getTargetDefines(const LangOptions &Opts,
|
||||
MacroBuilder &Builder) const override {
|
||||
X86_32TargetInfo::getTargetDefines(Opts, Builder);
|
||||
HaikuTargetInfo<X86_32TargetInfo>::getTargetDefines(Opts, Builder);
|
||||
Builder.defineMacro("__INTEL__");
|
||||
Builder.defineMacro("__HAIKU__");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -8360,6 +8377,8 @@ static TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
|||
return new MicrosoftX86_64TargetInfo(Triple, Opts);
|
||||
}
|
||||
}
|
||||
case llvm::Triple::Haiku:
|
||||
return new HaikuTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::NaCl:
|
||||
return new NaClTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||
case llvm::Triple::PS4:
|
||||
|
|
|
@ -2425,6 +2425,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
|
|||
ToolChain *&TC = ToolChains[Target.str()];
|
||||
if (!TC) {
|
||||
switch (Target.getOS()) {
|
||||
case llvm::Triple::Haiku:
|
||||
TC = new toolchains::Haiku(*this, Target, Args);
|
||||
break;
|
||||
case llvm::Triple::CloudABI:
|
||||
TC = new toolchains::CloudABI(*this, Target, Args);
|
||||
break;
|
||||
|
|
|
@ -3040,6 +3040,38 @@ SanitizerMask CloudABI::getDefaultSanitizers() const {
|
|||
return SanitizerKind::SafeStack;
|
||||
}
|
||||
|
||||
/// Haiku - Haiku tool chain which can call as(1) and ld(1) directly.
|
||||
|
||||
Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
|
||||
: Generic_ELF(D, Triple, Args) {
|
||||
|
||||
}
|
||||
|
||||
void Haiku::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
|
||||
ArgStringList &CC1Args) const {
|
||||
if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
|
||||
DriverArgs.hasArg(options::OPT_nostdincxx))
|
||||
return;
|
||||
|
||||
switch (GetCXXStdlibType(DriverArgs)) {
|
||||
case ToolChain::CST_Libcxx:
|
||||
addSystemInclude(DriverArgs, CC1Args,
|
||||
getDriver().SysRoot + "/system/develop/headers/c++/v1");
|
||||
break;
|
||||
case ToolChain::CST_Libstdcxx:
|
||||
addSystemInclude(DriverArgs, CC1Args,
|
||||
getDriver().SysRoot + "/system/develop/headers/c++");
|
||||
addSystemInclude(DriverArgs, CC1Args,
|
||||
getDriver().SysRoot + "/system/develop/headers/c++/backward");
|
||||
|
||||
StringRef Triple = getTriple().str();
|
||||
addSystemInclude(DriverArgs, CC1Args,
|
||||
getDriver().SysRoot + "/system/develop/headers/c++/" +
|
||||
Triple);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// OpenBSD - OpenBSD tool chain which can call as(1) and ld(1) directly.
|
||||
|
||||
OpenBSD::OpenBSD(const Driver &D, const llvm::Triple &Triple,
|
||||
|
|
|
@ -680,6 +680,18 @@ private:
|
|||
void findGccLibDir();
|
||||
};
|
||||
|
||||
class LLVM_LIBRARY_VISIBILITY Haiku : public Generic_ELF {
|
||||
public:
|
||||
Haiku(const Driver &D, const llvm::Triple &Triple,
|
||||
const llvm::opt::ArgList &Args);
|
||||
|
||||
bool isPIEDefault() const override { return getTriple().getArch() == llvm::Triple::x86_64; }
|
||||
|
||||
void
|
||||
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
};
|
||||
|
||||
class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
|
||||
public:
|
||||
OpenBSD(const Driver &D, const llvm::Triple &Triple,
|
||||
|
|
|
@ -267,38 +267,39 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
|||
}
|
||||
|
||||
case llvm::Triple::Haiku:
|
||||
AddPath("/boot/common/include", System, false);
|
||||
AddPath("/boot/develop/headers/os", System, false);
|
||||
AddPath("/boot/develop/headers/os/app", System, false);
|
||||
AddPath("/boot/develop/headers/os/arch", System, false);
|
||||
AddPath("/boot/develop/headers/os/device", System, false);
|
||||
AddPath("/boot/develop/headers/os/drivers", System, false);
|
||||
AddPath("/boot/develop/headers/os/game", System, false);
|
||||
AddPath("/boot/develop/headers/os/interface", System, false);
|
||||
AddPath("/boot/develop/headers/os/kernel", System, false);
|
||||
AddPath("/boot/develop/headers/os/locale", System, false);
|
||||
AddPath("/boot/develop/headers/os/mail", System, false);
|
||||
AddPath("/boot/develop/headers/os/media", System, false);
|
||||
AddPath("/boot/develop/headers/os/midi", System, false);
|
||||
AddPath("/boot/develop/headers/os/midi2", System, false);
|
||||
AddPath("/boot/develop/headers/os/net", System, false);
|
||||
AddPath("/boot/develop/headers/os/storage", System, false);
|
||||
AddPath("/boot/develop/headers/os/support", System, false);
|
||||
AddPath("/boot/develop/headers/os/translation", System, false);
|
||||
AddPath("/boot/develop/headers/os/add-ons/graphics", System, false);
|
||||
AddPath("/boot/develop/headers/os/add-ons/input_server", System, false);
|
||||
AddPath("/boot/develop/headers/os/add-ons/screen_saver", System, false);
|
||||
AddPath("/boot/develop/headers/os/add-ons/tracker", System, false);
|
||||
AddPath("/boot/develop/headers/os/be_apps/Deskbar", System, false);
|
||||
AddPath("/boot/develop/headers/os/be_apps/NetPositive", System, false);
|
||||
AddPath("/boot/develop/headers/os/be_apps/Tracker", System, false);
|
||||
AddPath("/boot/develop/headers/cpp", System, false);
|
||||
AddPath("/boot/develop/headers/cpp/i586-pc-haiku", System, false);
|
||||
AddPath("/boot/develop/headers/3rdparty", System, false);
|
||||
AddPath("/boot/develop/headers/bsd", System, false);
|
||||
AddPath("/boot/develop/headers/glibc", System, false);
|
||||
AddPath("/boot/develop/headers/posix", System, false);
|
||||
AddPath("/boot/develop/headers", System, false);
|
||||
AddPath("/boot/system/non-packaged/develop/headers", System, false);
|
||||
AddPath("/boot/system/develop/headers/os", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/app", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/arch", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/device", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/drivers", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/game", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/interface", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/kernel", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/locale", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/mail", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/media", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/midi", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/midi2", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/net", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/opengl", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/storage", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/support", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/translation", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/add-ons/graphics", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/add-ons/input_server", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/add-ons/mail_daemon", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/add-ons/registrar", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/add-ons/screen_saver", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/add-ons/tracker", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/be_apps/Deskbar", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/be_apps/NetPositive", System, false);
|
||||
AddPath("/boot/system/develop/headers/os/be_apps/Tracker", System, false);
|
||||
AddPath("/boot/system/develop/headers/3rdparty", System, false);
|
||||
AddPath("/boot/system/develop/headers/bsd", System, false);
|
||||
AddPath("/boot/system/develop/headers/glibc", System, false);
|
||||
AddPath("/boot/system/develop/headers/posix", System, false);
|
||||
AddPath("/boot/system/develop/headers", System, false);
|
||||
break;
|
||||
case llvm::Triple::RTEMS:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue