[PATCH] Handle llvm::Triple::GNU and llvm::Triple::Hurd in several places.
Thomas Schwinge
thomas at codesourcery.com
Mon Mar 25 09:15:33 PDT 2013
---
lib/Driver/Tools.cpp | 30 ++++++++++++++++++++++--------
lib/Frontend/InitHeaderSearch.cpp | 3 +++
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git lib/Driver/Tools.cpp lib/Driver/Tools.cpp
index b80765f..d517a7f 100644
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1693,10 +1693,12 @@ static bool shouldUseFramePointer(const ArgList &Args,
options::OPT_fomit_frame_pointer))
return A->getOption().matches(options::OPT_fno_omit_frame_pointer);
- // Don't use a frame pointer on linux x86 and x86_64 if optimizing.
+ // Don't use a frame pointer on GNU/Linux and GNU/Hurd x86 and x86_64 if
+ // optimizing.
if ((Triple.getArch() == llvm::Triple::x86_64 ||
Triple.getArch() == llvm::Triple::x86) &&
- Triple.getOS() == llvm::Triple::Linux) {
+ (Triple.getOS() == llvm::Triple::Linux ||
+ Triple.getOS() == llvm::Triple::Hurd)) {
if (Arg *A = Args.getLastArg(options::OPT_O_Group))
if (!A->getOption().matches(options::OPT_O0))
return false;
@@ -2330,8 +2332,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// -gsplit-dwarf should turn on -g and enable the backend dwarf
// splitting and extraction.
- // FIXME: Currently only works on Linux.
- if (getToolChain().getTriple().getOS() == llvm::Triple::Linux &&
+ // FIXME: Currently only works for certain targets.
+ if ((getToolChain().getTriple().getOS() == llvm::Triple::Linux ||
+ getToolChain().getTriple().getEnvironment() == llvm::Triple::GNU) &&
Args.hasArg(options::OPT_gsplit_dwarf)) {
CmdArgs.push_back("-g");
CmdArgs.push_back("-backend-option");
@@ -3295,7 +3298,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Add the split debug info name to the command lines here so we
// can propagate it to the backend.
bool SplitDwarf = Args.hasArg(options::OPT_gsplit_dwarf) &&
- (getToolChain().getTriple().getOS() == llvm::Triple::Linux) &&
+ (getToolChain().getTriple().getOS() == llvm::Triple::Linux ||
+ getToolChain().getTriple().getEnvironment() == llvm::Triple::GNU) &&
(isa<AssembleJobAction>(JA) || isa<CompileJobAction>(JA));
const char *SplitDwarfOut;
if (SplitDwarf) {
@@ -3309,7 +3313,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Handle the debug info splitting at object creation time if we're
// creating an object.
- // TODO: Currently only works on linux with newer objcopy.
+ // TODO: Currently only works for certain targets with newer objcopy.
if (SplitDwarf && !isa<CompileJobAction>(JA))
SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output, SplitDwarfOut);
@@ -5794,8 +5798,18 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-dynamic-linker");
if (isAndroid)
CmdArgs.push_back("/system/bin/linker");
- else if (ToolChain.getArch() == llvm::Triple::x86)
- CmdArgs.push_back("/lib/ld-linux.so.2");
+ else if (ToolChain.getArch() == llvm::Triple::x86) {
+ switch (ToolChain.getTriple().getOS()) {
+ case llvm::Triple::Linux:
+ CmdArgs.push_back("/lib/ld-linux.so.2");
+ break;
+ case llvm::Triple::Hurd:
+ CmdArgs.push_back("/lib/ld.so.1");
+ break;
+ default:
+ assert(0 && "Unsupported operating system");
+ }
+ }
else if (ToolChain.getArch() == llvm::Triple::aarch64)
CmdArgs.push_back("/lib/ld-linux-aarch64.so.1");
else if (ToolChain.getArch() == llvm::Triple::arm ||
diff --git lib/Frontend/InitHeaderSearch.cpp lib/Frontend/InitHeaderSearch.cpp
index 35eec56..c42519c 100644
--- lib/Frontend/InitHeaderSearch.cpp
+++ lib/Frontend/InitHeaderSearch.cpp
@@ -267,6 +267,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
switch (os) {
case llvm::Triple::Linux:
+ case llvm::Triple::Hurd:
case llvm::Triple::Win32:
llvm_unreachable("Include management is handled in the driver.");
@@ -376,6 +377,7 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOp
switch (os) {
case llvm::Triple::Linux:
+ case llvm::Triple::Hurd:
case llvm::Triple::Win32:
llvm_unreachable("Include management is handled in the driver.");
@@ -458,6 +460,7 @@ void InitHeaderSearch::AddDefaultIncludePaths(const LangOptions &Lang,
break; // Everything else continues to use this routine's logic.
case llvm::Triple::Linux:
+ case llvm::Triple::Hurd:
case llvm::Triple::Win32:
return;
}
--
1.7.9.5
More information about the cfe-commits
mailing list