Backport commit from upstream Clang/LLVM, from Brad (maintainer).
r211785 Implement the -fuse-ld= option. This commit implements the -fuse-ld= option, so that the user can specify -fuse-ld=bfd to use ld.bfd.
This commit is contained in:
parent
dd1b3f933a
commit
38e151ecc1
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.100 2015/02/11 00:29:05 brad Exp $
|
||||
# $OpenBSD: Makefile,v 1.101 2015/04/09 22:25:02 sthen Exp $
|
||||
|
||||
# XXX: Remember to bump MODCLANG_VERSION in lang/clang/clang.port.mk when
|
||||
# updating this port.
|
||||
@ -10,7 +10,7 @@ COMMENT = modular, fast C/C++/ObjC compiler, static analyzer and tools
|
||||
|
||||
LLVM_V = 3.5
|
||||
DISTNAME = llvm-${LLVM_V}.20140228
|
||||
REVISION = 27
|
||||
REVISION = 28
|
||||
CATEGORIES = devel
|
||||
MASTER_SITES = http://comstyle.com/source/
|
||||
EXTRACT_SUFX = .tar.xz
|
||||
|
@ -0,0 +1,19 @@
|
||||
$OpenBSD: patch-tools_clang_include_clang_Basic_DiagnosticDriverKinds_td,v 1.1 2015/04/09 22:25:02 sthen Exp $
|
||||
|
||||
r211785
|
||||
Implement the -fuse-ld= option.
|
||||
|
||||
This commit implements the -fuse-ld= option, so that the user
|
||||
can specify -fuse-ld=bfd to use ld.bfd.
|
||||
|
||||
--- tools/clang/include/clang/Basic/DiagnosticDriverKinds.td.orig Thu Feb 26 07:01:37 2015
|
||||
+++ tools/clang/include/clang/Basic/DiagnosticDriverKinds.td Thu Feb 26 07:02:16 2015
|
||||
@@ -22,6 +22,8 @@ def err_drv_unknown_stdin_type_clang_cl : Error<
|
||||
def err_drv_unknown_language : Error<"language not recognized: '%0'">;
|
||||
def err_drv_invalid_arch_name : Error<
|
||||
"invalid arch name '%0'">;
|
||||
+def err_drv_invalid_linker_name : Error<
|
||||
+ "invalid linker name in argument '%0'">;
|
||||
def err_drv_invalid_rtlib_name : Error<
|
||||
"invalid runtime library name in argument '%0'">;
|
||||
def err_drv_unsupported_rtlib_for_platform : Error<
|
@ -1,9 +1,15 @@
|
||||
$OpenBSD: patch-tools_clang_include_clang_Driver_Options_td,v 1.3 2014/06/13 22:29:40 brad Exp $
|
||||
$OpenBSD: patch-tools_clang_include_clang_Driver_Options_td,v 1.4 2015/04/09 22:25:02 sthen Exp $
|
||||
|
||||
Alias the command line parameter -p to -pg.
|
||||
|
||||
r211785
|
||||
Implement the -fuse-ld= option.
|
||||
|
||||
This commit implements the -fuse-ld= option, so that the user
|
||||
can specify -fuse-ld=bfd to use ld.bfd.
|
||||
|
||||
--- tools/clang/include/clang/Driver/Options.td.orig Sun Mar 2 22:03:58 2014
|
||||
+++ tools/clang/include/clang/Driver/Options.td Thu Jun 5 00:23:11 2014
|
||||
+++ tools/clang/include/clang/Driver/Options.td Thu Feb 26 07:03:04 2015
|
||||
@@ -253,7 +253,7 @@ def Qn : Flag<["-"], "Qn">;
|
||||
def Qunused_arguments : Flag<["-"], "Qunused-arguments">, Flags<[DriverOption, CoreOption]>,
|
||||
HelpText<"Don't emit warning for unused driver arguments">;
|
||||
@ -22,3 +28,12 @@ Alias the command line parameter -p to -pg.
|
||||
def pie : Flag<["-"], "pie">;
|
||||
def read__only__relocs : Separate<["-"], "read_only_relocs">;
|
||||
def remap : Flag<["-"], "remap">;
|
||||
@@ -1495,7 +1495,7 @@ def fprofile_dir : Joined<["-"], "fprofile-dir=">, Gro
|
||||
|
||||
defm profile_use : BooleanFFlag<"profile-use">, Group<clang_ignored_f_Group>;
|
||||
def fprofile_use_EQ : Joined<["-"], "fprofile-use=">, Group<clang_ignored_f_Group>;
|
||||
-def fuse_ld_EQ : Joined<["-"], "fuse-ld=">, Group<clang_ignored_f_Group>;
|
||||
+def fuse_ld_EQ : Joined<["-"], "fuse-ld=">, Group<f_Group>;
|
||||
|
||||
defm align_functions : BooleanFFlag<"align-functions">, Group<clang_ignored_f_Group>;
|
||||
def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group<clang_ignored_f_Group>;
|
||||
|
@ -0,0 +1,21 @@
|
||||
$OpenBSD: patch-tools_clang_include_clang_Driver_ToolChain_h,v 1.1 2015/04/09 22:25:02 sthen Exp $
|
||||
|
||||
r211785
|
||||
Implement the -fuse-ld= option.
|
||||
|
||||
This commit implements the -fuse-ld= option, so that the user
|
||||
can specify -fuse-ld=bfd to use ld.bfd.
|
||||
|
||||
--- tools/clang/include/clang/Driver/ToolChain.h.orig Thu Feb 26 07:03:30 2015
|
||||
+++ tools/clang/include/clang/Driver/ToolChain.h Thu Feb 26 07:03:53 2015
|
||||
@@ -158,6 +158,10 @@ class ToolChain { (public)
|
||||
std::string GetFilePath(const char *Name) const;
|
||||
std::string GetProgramPath(const char *Name) const;
|
||||
|
||||
+ /// Returns the linker path, respecting the -fuse-ld= argument to determine
|
||||
+ /// the linker suffix or name.
|
||||
+ std::string GetLinkerPath() const;
|
||||
+
|
||||
/// \brief Dispatch to the specific toolchain for verbose printing.
|
||||
///
|
||||
/// This is used when handling the verbose option to print detailed,
|
@ -0,0 +1,48 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChain_cpp,v 1.1 2015/04/09 22:25:02 sthen Exp $
|
||||
|
||||
r211785
|
||||
Implement the -fuse-ld= option.
|
||||
|
||||
This commit implements the -fuse-ld= option, so that the user
|
||||
can specify -fuse-ld=bfd to use ld.bfd.
|
||||
|
||||
--- tools/clang/lib/Driver/ToolChain.cpp.orig Thu Feb 26 07:04:19 2015
|
||||
+++ tools/clang/lib/Driver/ToolChain.cpp Thu Feb 26 07:05:21 2015
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "clang/Driver/Options.h"
|
||||
#include "clang/Driver/SanitizerArgs.h"
|
||||
#include "clang/Driver/ToolChain.h"
|
||||
+#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/Option/Arg.h"
|
||||
#include "llvm/Option/ArgList.h"
|
||||
@@ -145,6 +146,29 @@ std::string ToolChain::GetFilePath(const char *Name) c
|
||||
|
||||
std::string ToolChain::GetProgramPath(const char *Name) const {
|
||||
return D.GetProgramPath(Name, *this);
|
||||
+}
|
||||
+
|
||||
+std::string ToolChain::GetLinkerPath() const {
|
||||
+ if (Arg *A = Args.getLastArg(options::OPT_fuse_ld_EQ)) {
|
||||
+ StringRef Suffix = A->getValue();
|
||||
+
|
||||
+ // If we're passed -fuse-ld= with no argument, or with the argument ld,
|
||||
+ // then use whatever the default system linker is.
|
||||
+ if (Suffix.empty() || Suffix == "ld")
|
||||
+ return GetProgramPath("ld");
|
||||
+
|
||||
+ llvm::SmallString<8> LinkerName("ld.");
|
||||
+ LinkerName.append(Suffix);
|
||||
+
|
||||
+ std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
|
||||
+ if (llvm::sys::fs::exists(LinkerPath))
|
||||
+ return LinkerPath;
|
||||
+
|
||||
+ getDriver().Diag(diag::err_drv_invalid_linker_name) << A->getAsString(Args);
|
||||
+ return "";
|
||||
+ }
|
||||
+
|
||||
+ return GetProgramPath("ld");
|
||||
}
|
||||
|
||||
types::ID ToolChain::LookupTypeForExtension(const char *Ext) const {
|
@ -1,10 +1,16 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_cpp,v 1.3 2015/02/11 00:29:05 brad Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_ToolChains_cpp,v 1.4 2015/04/09 22:25:02 sthen Exp $
|
||||
|
||||
r225958
|
||||
Use the integrated assembler by default on 32-bit PowerPC and SPARC.
|
||||
|
||||
--- tools/clang/lib/Driver/ToolChains.cpp.orig Mon Feb 2 11:00:57 2015
|
||||
+++ tools/clang/lib/Driver/ToolChains.cpp Mon Feb 2 11:03:43 2015
|
||||
r211785
|
||||
Implement the -fuse-ld= option.
|
||||
|
||||
This commit implements the -fuse-ld= option, so that the user
|
||||
can specify -fuse-ld=bfd to use ld.bfd.
|
||||
|
||||
--- tools/clang/lib/Driver/ToolChains.cpp.orig Sun Mar 2 22:03:41 2014
|
||||
+++ tools/clang/lib/Driver/ToolChains.cpp Thu Feb 26 07:06:45 2015
|
||||
@@ -2035,7 +2035,12 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const
|
||||
getTriple().getArch() == llvm::Triple::aarch64 ||
|
||||
getTriple().getArch() == llvm::Triple::aarch64_be ||
|
||||
@ -19,3 +25,12 @@ Use the integrated assembler by default on 32-bit PowerPC and SPARC.
|
||||
}
|
||||
|
||||
void Generic_ELF::addClangTargetOptions(const ArgList &DriverArgs,
|
||||
@@ -2850,7 +2855,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Trip
|
||||
PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
|
||||
GCCInstallation.getTriple().str() + "/bin").str());
|
||||
|
||||
- Linker = GetProgramPath("ld");
|
||||
+ Linker = GetLinkerPath();
|
||||
|
||||
Distro Distro = DetectDistro(Arch);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.23 2014/08/29 14:28:32 brad Exp $
|
||||
$OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.24 2015/04/09 22:25:02 sthen Exp $
|
||||
|
||||
r212838
|
||||
Handle SPARC float command line parameters for SPARCv9.
|
||||
@ -15,8 +15,14 @@ Use dwarf-2 by default on OpenBSD and FreeBSD.
|
||||
r209479
|
||||
Don't reduce the stack protector level given -fstack-protector.
|
||||
|
||||
r211785
|
||||
Implement the -fuse-ld= option.
|
||||
|
||||
This commit implements the -fuse-ld= option, so that the user
|
||||
can specify -fuse-ld=bfd to use ld.bfd.
|
||||
|
||||
--- tools/clang/lib/Driver/Tools.cpp.orig Sun Mar 2 22:03:41 2014
|
||||
+++ tools/clang/lib/Driver/Tools.cpp Thu Aug 7 19:57:25 2014
|
||||
+++ tools/clang/lib/Driver/Tools.cpp Thu Feb 26 07:09:54 2015
|
||||
@@ -1150,7 +1150,7 @@ static std::string getR600TargetGPU(const ArgList &Arg
|
||||
}
|
||||
|
||||
@ -119,6 +125,33 @@ Don't reduce the stack protector level given -fstack-protector.
|
||||
StackProtectorLevel = LangOptions::SSPStrong;
|
||||
else if (A->getOption().matches(options::OPT_fstack_protector_all))
|
||||
StackProtectorLevel = LangOptions::SSPReq;
|
||||
@@ -5281,7 +5309,7 @@ void darwin::Link::ConstructJob(Compilation &C, const
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_F);
|
||||
|
||||
const char *Exec =
|
||||
- Args.MakeArgString(getToolChain().GetProgramPath("ld"));
|
||||
+ Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
@@ -5478,7 +5506,7 @@ void solaris::Link::ConstructJob(Compilation &C, const
|
||||
addProfileRT(getToolChain(), Args, CmdArgs);
|
||||
|
||||
const char *Exec =
|
||||
- Args.MakeArgString(getToolChain().GetProgramPath("ld"));
|
||||
+ Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
@@ -5590,7 +5618,7 @@ void auroraux::Link::ConstructJob(Compilation &C, cons
|
||||
addProfileRT(getToolChain(), Args, CmdArgs);
|
||||
|
||||
const char *Exec =
|
||||
- Args.MakeArgString(getToolChain().GetProgramPath("ld"));
|
||||
+ Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
@@ -5743,6 +5771,7 @@ void openbsd::Link::ConstructJob(Compilation &C, const
|
||||
"/4.2.1"));
|
||||
|
||||
@ -127,3 +160,57 @@ Don't reduce the stack protector level given -fstack-protector.
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_e);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_s);
|
||||
@@ -5795,7 +5824,7 @@ void openbsd::Link::ConstructJob(Compilation &C, const
|
||||
}
|
||||
|
||||
const char *Exec =
|
||||
- Args.MakeArgString(getToolChain().GetProgramPath("ld"));
|
||||
+ Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
@@ -5935,7 +5964,7 @@ void bitrig::Link::ConstructJob(Compilation &C, const
|
||||
}
|
||||
|
||||
const char *Exec =
|
||||
- Args.MakeArgString(getToolChain().GetProgramPath("ld"));
|
||||
+ Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
@@ -6200,7 +6229,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const
|
||||
addProfileRT(ToolChain, Args, CmdArgs);
|
||||
|
||||
const char *Exec =
|
||||
- Args.MakeArgString(ToolChain.GetProgramPath("ld"));
|
||||
+ Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
@@ -6448,7 +6477,7 @@ void netbsd::Link::ConstructJob(Compilation &C, const
|
||||
|
||||
addProfileRT(getToolChain(), Args, CmdArgs);
|
||||
|
||||
- const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("ld"));
|
||||
+ const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
@@ -6964,7 +6993,7 @@ void minix::Link::ConstructJob(Compilation &C, const J
|
||||
Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
|
||||
}
|
||||
|
||||
- const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("ld"));
|
||||
+ const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
@@ -7148,7 +7177,7 @@ void dragonfly::Link::ConstructJob(Compilation &C, con
|
||||
addProfileRT(getToolChain(), Args, CmdArgs);
|
||||
|
||||
const char *Exec =
|
||||
- Args.MakeArgString(getToolChain().GetProgramPath("ld"));
|
||||
+ Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user