Add some initial bits for mips64 to pass down the proper flags

to the assembler and linker. Still work in progress.

ok sthen@
This commit is contained in:
brad 2013-01-08 10:14:13 +00:00
parent ec1e74d43d
commit c54dae5771
2 changed files with 49 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.58 2013/01/08 09:53:46 brad Exp $
# $OpenBSD: Makefile,v 1.59 2013/01/08 10:14:13 brad 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.2
DISTNAME = llvm-${LLVM_V}.src
PKGNAME = llvm-${LLVM_V}
REVISION = 0
REVISION = 1
CATEGORIES = devel
MASTER_SITES = http://llvm.org/releases/${LLVM_V}/

View File

@ -1,10 +1,47 @@
$OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.14 2013/01/04 01:10:30 brad Exp $
$OpenBSD: patch-tools_clang_lib_Driver_Tools_cpp,v 1.15 2013/01/08 10:14:13 brad Exp $
Silence some warnings and allow passing down some feature flags to the linker. r171329
--- tools/clang/lib/Driver/Tools.cpp.orig Mon Dec 24 18:44:21 2012
+++ tools/clang/lib/Driver/Tools.cpp Mon Dec 31 18:01:11 2012
@@ -5125,6 +5125,17 @@ void openbsd::Link::ConstructJob(Compilation &C, const
--- tools/clang/lib/Driver/Tools.cpp.orig Wed Nov 21 02:56:23 2012
+++ tools/clang/lib/Driver/Tools.cpp Mon Jan 7 22:48:10 2013
@@ -5100,6 +5100,36 @@ void openbsd::Assemble::ConstructJob(Compilation &C, c
const char *LinkingOutput) const {
ArgStringList CmdArgs;
+ if (getToolChain().getArch() == llvm::Triple::mips64 ||
+ getToolChain().getArch() == llvm::Triple::mips64el) {
+ StringRef CPUName;
+ StringRef ABIName;
+ getMipsCPUAndABI(Args, getToolChain(), CPUName, ABIName);
+
+ // Convert ABI name to the GNU tools acceptable variant.
+ ABIName = "64";
+
+ CmdArgs.push_back("-mabi");
+ CmdArgs.push_back(ABIName.data());
+
+ if (getToolChain().getArch() == llvm::Triple::mips64)
+ CmdArgs.push_back("-EB");
+ else
+ CmdArgs.push_back("-EL");
+
+ Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
+ options::OPT_fpic, options::OPT_fno_pic,
+ options::OPT_fPIE, options::OPT_fno_PIE,
+ options::OPT_fpie, options::OPT_fno_pie);
+ if (LastPICArg &&
+ (LastPICArg->getOption().matches(options::OPT_fPIC) ||
+ LastPICArg->getOption().matches(options::OPT_fpic) ||
+ LastPICArg->getOption().matches(options::OPT_fPIE) ||
+ LastPICArg->getOption().matches(options::OPT_fpie))) {
+ CmdArgs.push_back("-KPIC");
+ }
+ }
+
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
options::OPT_Xassembler);
@@ -5125,6 +5155,22 @@ void openbsd::Link::ConstructJob(Compilation &C, const
const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
@ -16,13 +53,18 @@ Silence some warnings and allow passing down some feature flags to the linker. r
+ // handled somewhere else.
+ Args.ClaimAllArgs(options::OPT_w);
+
+ if (getToolChain().getArch() == llvm::Triple::mips64)
+ CmdArgs.push_back("-EB");
+ else if (getToolChain().getArch() == llvm::Triple::mips64el)
+ CmdArgs.push_back("-EL");
+
+ // XXX
+ CmdArgs.push_back("-nopie");
+
if ((!Args.hasArg(options::OPT_nostdlib)) &&
(!Args.hasArg(options::OPT_shared))) {
CmdArgs.push_back("-e");
@@ -5178,6 +5189,10 @@ void openbsd::Link::ConstructJob(Compilation &C, const
@@ -5179,6 +5225,10 @@ void openbsd::Link::ConstructJob(Compilation &C, const
Args.AddAllArgs(CmdArgs, options::OPT_L);
Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
Args.AddAllArgs(CmdArgs, options::OPT_e);