LLVM Minix changes
- import libcxx - reduce targets to the one when compiled as a tools Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
This commit is contained in:
Vendored
+26
@@ -65,6 +65,7 @@ LDFLAGS+= -Wl,--gc-sections
|
||||
CPPFLAGS+= -I${LLVM_INCLUDE_OBJDIR} -I${LLVM_INCLUDE_CONFIG} \
|
||||
-I${CLANG_INCLUDE_CONFIG} -I${MCLINKER_INCLUDE_CONFIG}
|
||||
|
||||
.if !defined(__MINIX)
|
||||
LLVM_CONFIGURE_ARGS= \
|
||||
--enable-targets=x86,powerpc,sparc,aarch64,arm,mips \
|
||||
--with-c-include-dirs=/usr/include/clang-${CLANG_VERSION}:/usr/include \
|
||||
@@ -72,6 +73,31 @@ LLVM_CONFIGURE_ARGS= \
|
||||
--with-clang-srcdir=${CLANG_SRCDIR} \
|
||||
--host=${MACHINE_GNU_PLATFORM} \
|
||||
llvm_cv_gnu_make_command=${MAKE}
|
||||
.else
|
||||
# LSC: Compile LLVM only with the target platform
|
||||
.if ${MACHINE_ARCH:Mi*86} != ""
|
||||
_LLVM_TARGET:=x86
|
||||
.elif ${MACHINE_ARCH:M*arm*} != ""
|
||||
_LLVM_TARGET:=arm
|
||||
.else
|
||||
.error Modify this or add support for all platform, at your convenience.
|
||||
.endif
|
||||
|
||||
LLVM_CONFIGURE_ARGS= \
|
||||
--enable-targets=${_LLVM_TARGET} \
|
||||
--with-c-include-dirs=/usr/include/clang-${CLANG_VERSION}:/usr/include \
|
||||
--disable-timestamps --prefix=/usr --sysconfdir=/etc/llvm \
|
||||
--with-clang-srcdir=${CLANG_SRCDIR} \
|
||||
--host=${MACHINE_GNU_PLATFORM} \
|
||||
--with-binutils-include=${NETBSDSRCDIR}/external/gpl3/binutils/dist/include \
|
||||
--disable-debug-symbols --enable-assertions --enable-bindings=none \
|
||||
llvm_cv_gnu_make_command=${MAKE}
|
||||
|
||||
.if ${HOST_OSTYPE:C/\-.*//} == "Minix"
|
||||
LLVM_CONFIGURE_ARGS+= --disable-threads
|
||||
CPPFLAGS+= -D_NLS_PRIVATE=1
|
||||
.endif # ${HOST_OSTYPE:C/\-.*//} == "Minix"
|
||||
.endif # !defined(__MINIX)
|
||||
|
||||
.for tool in circo dot dotty fdp neato twopi xdot
|
||||
LLVM_CONFIGURE_ARGS+= ac_cv_path_${tool:tu}="echo ${tool}"
|
||||
|
||||
+12
-12
@@ -218,7 +218,7 @@
|
||||
/* #undef HAVE_LIBPSAPI */
|
||||
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#define HAVE_LIBPTHREAD 1
|
||||
/* MINIX: #define HAVE_LIBPTHREAD 1 */
|
||||
|
||||
/* Define to 1 if you have the `shell32' library (-lshell32). */
|
||||
/* #undef HAVE_LIBSHELL32 */
|
||||
@@ -289,7 +289,7 @@
|
||||
/* #undef HAVE_MMAP_ANONYMOUS */
|
||||
|
||||
/* Define if mmap() can map files into memory */
|
||||
#define HAVE_MMAP_FILE
|
||||
#define HAVE_MMAP_FILE 1
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
/* #undef HAVE_NDIR_H */
|
||||
@@ -304,7 +304,7 @@
|
||||
#define HAVE_OPENDIR 1
|
||||
|
||||
/* Define to 1 if you have the `posix_spawn' function. */
|
||||
#define HAVE_POSIX_SPAWN 1
|
||||
/* MINIX: #define HAVE_POSIX_SPAWN 1 */
|
||||
|
||||
/* Define to 1 if you have the `powf' function. */
|
||||
#define HAVE_POWF 1
|
||||
@@ -319,16 +319,16 @@
|
||||
#define HAVE_PRINTF_A 1
|
||||
|
||||
/* Have pthread_getspecific */
|
||||
#define HAVE_PTHREAD_GETSPECIFIC 1
|
||||
/* MINIX: #define HAVE_PTHREAD_GETSPECIFIC 1 */
|
||||
|
||||
/* Define to 1 if you have the <pthread.h> header file. */
|
||||
#define HAVE_PTHREAD_H 1
|
||||
/* MINIX: #define HAVE_PTHREAD_H 1 */
|
||||
|
||||
/* Have pthread_mutex_lock */
|
||||
#define HAVE_PTHREAD_MUTEX_LOCK 1
|
||||
/* MINIX: #define HAVE_PTHREAD_MUTEX_LOCK 1 */
|
||||
|
||||
/* Have pthread_rwlock_init */
|
||||
#define HAVE_PTHREAD_RWLOCK_INIT 1
|
||||
/* MINIX: #define HAVE_PTHREAD_RWLOCK_INIT 1 */
|
||||
|
||||
/* Define to 1 if srand48/lrand48/drand48 exist in <stdlib.h> */
|
||||
#define HAVE_RAND48 1
|
||||
@@ -361,7 +361,7 @@
|
||||
#define HAVE_SETJMP_H 1
|
||||
|
||||
/* Define to 1 if you have the `setrlimit' function. */
|
||||
#define HAVE_SETRLIMIT 1
|
||||
/* MINIX: #define HAVE_SETRLIMIT 1 */
|
||||
|
||||
/* Define if you have the shl_load function. */
|
||||
/* #undef HAVE_SHL_LOAD */
|
||||
@@ -409,7 +409,7 @@
|
||||
#define HAVE_STRTOQ 1
|
||||
|
||||
/* Define to 1 if you have the `sysconf' function. */
|
||||
#define HAVE_SYSCONF 1
|
||||
/* #define HAVE_SYSCONF 1 */
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
@@ -543,13 +543,13 @@
|
||||
#define LLVM_DATADIR "/usr/share/llvm"
|
||||
|
||||
/* Target triple LLVM will generate code for by default */
|
||||
#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64--netbsd"
|
||||
#define LLVM_DEFAULT_TARGET_TRIPLE "i586-elf32-minix"
|
||||
|
||||
/* Installation directory for documentation */
|
||||
#define LLVM_DOCSDIR "/usr/share/doc/llvm"
|
||||
|
||||
/* Define if threads enabled */
|
||||
#define LLVM_ENABLE_THREADS 1
|
||||
/* MINIX: #define LLVM_ENABLE_THREADS 1 */
|
||||
|
||||
/* Define if zlib is enabled */
|
||||
#define LLVM_ENABLE_ZLIB 1
|
||||
@@ -561,7 +561,7 @@
|
||||
#define LLVM_HAS_ATOMICS 1
|
||||
|
||||
/* Host triple LLVM will be executed on */
|
||||
#define LLVM_HOST_TRIPLE "x86_64--netbsd"
|
||||
#define LLVM_HOST_TRIPLE "i586-elf32-minix"
|
||||
|
||||
/* Installation directory for include files */
|
||||
#define LLVM_INCLUDEDIR "/usr/include"
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@
|
||||
#define LLVM_DATADIR "/usr/share/llvm"
|
||||
|
||||
/* Target triple LLVM will generate code for by default */
|
||||
#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64--netbsd"
|
||||
#define LLVM_DEFAULT_TARGET_TRIPLE "i586-elf32-minix"
|
||||
|
||||
/* Installation directory for documentation */
|
||||
#define LLVM_DOCSDIR "/usr/share/doc/llvm"
|
||||
@@ -42,7 +42,7 @@
|
||||
#define LLVM_HAS_ATOMICS 1
|
||||
|
||||
/* Host triple LLVM will be executed on */
|
||||
#define LLVM_HOST_TRIPLE "x86_64--netbsd"
|
||||
#define LLVM_HOST_TRIPLE "i586-elf32-minix"
|
||||
|
||||
/* Installation directory for include files */
|
||||
#define LLVM_INCLUDEDIR "/usr/include"
|
||||
|
||||
+6
-7
@@ -321,14 +321,11 @@ protected:
|
||||
// Minix defines
|
||||
|
||||
Builder.defineMacro("__minix", "3");
|
||||
Builder.defineMacro("_EM_WSIZE", "4");
|
||||
Builder.defineMacro("_EM_PSIZE", "4");
|
||||
Builder.defineMacro("_EM_SSIZE", "2");
|
||||
Builder.defineMacro("_EM_LSIZE", "4");
|
||||
Builder.defineMacro("_EM_FSIZE", "4");
|
||||
Builder.defineMacro("_EM_DSIZE", "8");
|
||||
Builder.defineMacro("__minix__", "3");
|
||||
Builder.defineMacro("__unix__");
|
||||
Builder.defineMacro("__ELF__");
|
||||
DefineStd(Builder, "unix", Opts);
|
||||
if (Opts.POSIXThreads)
|
||||
Builder.defineMacro("_POSIX_THREADS");
|
||||
}
|
||||
public:
|
||||
MinixTargetInfo(const llvm::Triple &Triple) : OSTargetInfo<Target>(Triple) {
|
||||
@@ -5554,6 +5551,8 @@ static TargetInfo *AllocateTarget(const llvm::Triple &Triple) {
|
||||
return new FreeBSDTargetInfo<ARMTargetInfo>(Triple);
|
||||
case llvm::Triple::NetBSD:
|
||||
return new NetBSDTargetInfo<ARMTargetInfo>(Triple);
|
||||
case llvm::Triple::Minix:
|
||||
return new MinixTargetInfo<ARMTargetInfo>(Triple);
|
||||
case llvm::Triple::OpenBSD:
|
||||
return new OpenBSDTargetInfo<ARMTargetInfo>(Triple);
|
||||
case llvm::Triple::Bitrig:
|
||||
|
||||
+1
-2
@@ -1889,8 +1889,7 @@ static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple,
|
||||
|
||||
// Skip further flag support on OSes which don't support '-m32' or '-m64'.
|
||||
if (Target.getArchName() == "tce" ||
|
||||
Target.getOS() == llvm::Triple::AuroraUX ||
|
||||
Target.getOS() == llvm::Triple::Minix)
|
||||
Target.getOS() == llvm::Triple::AuroraUX)
|
||||
return Target;
|
||||
|
||||
// Handle pseudo-target flags '-m32' and '-m64'.
|
||||
|
||||
+57
-2
@@ -2078,8 +2078,17 @@ void NetBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
|
||||
|
||||
Minix::Minix(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
|
||||
: Generic_ELF(D, Triple, Args) {
|
||||
getFilePaths().push_back(getDriver().Dir + "/../lib");
|
||||
getFilePaths().push_back("/usr/lib");
|
||||
if (getDriver().UseStdLib) {
|
||||
// When targeting a 32-bit platform, try the special directory used on
|
||||
// 64-bit hosts, and only fall back to the main library directory if that
|
||||
// doesn't work.
|
||||
// FIXME: It'd be nicer to test if this directory exists, but I'm not sure
|
||||
// what all logic is needed to emulate the '=' prefix here.
|
||||
if (Triple.getArch() == llvm::Triple::x86)
|
||||
getFilePaths().push_back("=/usr/lib/i386");
|
||||
|
||||
getFilePaths().push_back("=/usr/lib");
|
||||
}
|
||||
}
|
||||
|
||||
Tool *Minix::buildAssembler() const {
|
||||
@@ -2090,6 +2099,52 @@ Tool *Minix::buildLinker() const {
|
||||
return new tools::minix::Link(*this);
|
||||
}
|
||||
|
||||
ToolChain::CXXStdlibType
|
||||
Minix::GetCXXStdlibType(const ArgList &Args) const {
|
||||
if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
|
||||
StringRef Value = A->getValue();
|
||||
if (Value == "libstdc++")
|
||||
return ToolChain::CST_Libstdcxx;
|
||||
if (Value == "libc++")
|
||||
return ToolChain::CST_Libcxx;
|
||||
|
||||
getDriver().Diag(diag::err_drv_invalid_stdlib_name)
|
||||
<< A->getAsString(Args);
|
||||
}
|
||||
|
||||
#if 0 /* LSC: We only us libcxx by default */
|
||||
unsigned Major, Minor, Micro;
|
||||
getTriple().getOSVersion(Major, Minor, Micro);
|
||||
if (Major >= 7 || (Major == 6 && Minor == 99 && Micro >= 23) || Major == 0) {
|
||||
if (getArch() == llvm::Triple::x86 || getArch() == llvm::Triple::x86_64)
|
||||
return ToolChain::CST_Libcxx;
|
||||
}
|
||||
return ToolChain::CST_Libstdcxx;
|
||||
#else
|
||||
return ToolChain::CST_Libcxx;
|
||||
#endif /* 0 */
|
||||
}
|
||||
|
||||
void Minix::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 + "/usr/include/c++/");
|
||||
break;
|
||||
case ToolChain::CST_Libstdcxx:
|
||||
addSystemInclude(DriverArgs, CC1Args,
|
||||
getDriver().SysRoot + "/usr/include/g++");
|
||||
addSystemInclude(DriverArgs, CC1Args,
|
||||
getDriver().SysRoot + "/usr/include/g++/backward");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// AuroraUX - AuroraUX tool chain which can call as(1) and ld(1) directly.
|
||||
|
||||
AuroraUX::AuroraUX(const Driver &D, const llvm::Triple& Triple,
|
||||
|
||||
@@ -552,6 +552,23 @@ public:
|
||||
Minix(const Driver &D, const llvm::Triple &Triple,
|
||||
const llvm::opt::ArgList &Args);
|
||||
|
||||
virtual bool IsMathErrnoDefault() const { return false; }
|
||||
virtual bool IsObjCNonFragileABIDefault() const { return true; }
|
||||
|
||||
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
|
||||
|
||||
virtual void
|
||||
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const;
|
||||
virtual bool IsUnwindTablesDefault() const {
|
||||
return true;
|
||||
}
|
||||
virtual bool IsIntegratedAssemblerDefault() const {
|
||||
if (getTriple().getArch() == llvm::Triple::ppc)
|
||||
return true;
|
||||
return Generic_ELF::IsIntegratedAssemblerDefault();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual Tool *buildAssembler() const;
|
||||
virtual Tool *buildLinker() const;
|
||||
|
||||
+112
-22
@@ -1318,6 +1318,7 @@ static const char *getX86TargetCPU(const ArgList &Args,
|
||||
case llvm::Triple::OpenBSD:
|
||||
return "i486";
|
||||
case llvm::Triple::Haiku:
|
||||
case llvm::Triple::Minix:
|
||||
return "i586";
|
||||
case llvm::Triple::Bitrig:
|
||||
return "i686";
|
||||
@@ -6543,12 +6544,25 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
}
|
||||
|
||||
void minix::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
const InputInfo &Output,
|
||||
const InputInfoList &Inputs,
|
||||
const ArgList &Args,
|
||||
const char *LinkingOutput) const {
|
||||
const InputInfo &Output,
|
||||
const InputInfoList &Inputs,
|
||||
const ArgList &Args,
|
||||
const char *LinkingOutput) const {
|
||||
ArgStringList CmdArgs;
|
||||
|
||||
// When building 32-bit code on NetBSD/amd64, we have to explicitly
|
||||
// instruct as in the base system to assemble 32-bit code.
|
||||
if (getToolChain().getArch() == llvm::Triple::x86)
|
||||
CmdArgs.push_back("--32");
|
||||
|
||||
#if 0 /* LSC: Not needed for MINIX (no mips port) but kept to ease comparison with NetBSD. */
|
||||
// Set byte order explicitly
|
||||
if (getToolChain().getArch() == llvm::Triple::mips)
|
||||
CmdArgs.push_back("-EB");
|
||||
else if (getToolChain().getArch() == llvm::Triple::mipsel)
|
||||
CmdArgs.push_back("-EL");
|
||||
#endif /* 0 */
|
||||
|
||||
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
|
||||
options::OPT_Xassembler);
|
||||
|
||||
@@ -6561,19 +6575,44 @@ void minix::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
CmdArgs.push_back(II.getFilename());
|
||||
}
|
||||
|
||||
const char *Exec =
|
||||
Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
const char *Exec = Args.MakeArgString((getToolChain().GetProgramPath("as")));
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
void minix::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
const InputInfo &Output,
|
||||
const InputInfoList &Inputs,
|
||||
const ArgList &Args,
|
||||
const char *LinkingOutput) const {
|
||||
const InputInfo &Output,
|
||||
const InputInfoList &Inputs,
|
||||
const ArgList &Args,
|
||||
const char *LinkingOutput) const {
|
||||
const Driver &D = getToolChain().getDriver();
|
||||
ArgStringList CmdArgs;
|
||||
|
||||
if (!D.SysRoot.empty())
|
||||
CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
|
||||
|
||||
if (Args.hasArg(options::OPT_static)) {
|
||||
CmdArgs.push_back("-Bstatic");
|
||||
} else {
|
||||
if (Args.hasArg(options::OPT_rdynamic))
|
||||
CmdArgs.push_back("-export-dynamic");
|
||||
CmdArgs.push_back("--eh-frame-hdr");
|
||||
if (Args.hasArg(options::OPT_shared)) {
|
||||
CmdArgs.push_back("-Bshareable");
|
||||
} else {
|
||||
CmdArgs.push_back("-dynamic-linker");
|
||||
// LSC: Small deviation from the NetBSD version.
|
||||
// Use the same linker path as gcc.
|
||||
CmdArgs.push_back("/usr/libexec/ld.elf_so");
|
||||
}
|
||||
}
|
||||
|
||||
// When building 32-bit code on NetBSD/amd64, we have to explicitly
|
||||
// instruct ld in the base system to link 32-bit code.
|
||||
if (getToolChain().getArch() == llvm::Triple::x86) {
|
||||
CmdArgs.push_back("-m");
|
||||
CmdArgs.push_back("elf_i386_minix");
|
||||
}
|
||||
|
||||
if (Output.isFilename()) {
|
||||
CmdArgs.push_back("-o");
|
||||
CmdArgs.push_back(Output.getFilename());
|
||||
@@ -6583,39 +6622,90 @@ void minix::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
||||
if (!Args.hasArg(options::OPT_nostdlib) &&
|
||||
!Args.hasArg(options::OPT_nostartfiles)) {
|
||||
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crt1.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
|
||||
if (!Args.hasArg(options::OPT_shared)) {
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
getToolChain().GetFilePath("crt0.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
getToolChain().GetFilePath("crti.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
getToolChain().GetFilePath("crtbegin.o")));
|
||||
} else {
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
getToolChain().GetFilePath("crti.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
getToolChain().GetFilePath("crtbeginS.o")));
|
||||
}
|
||||
}
|
||||
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_L);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_e);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_s);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_t);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_r);
|
||||
|
||||
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
|
||||
|
||||
addProfileRT(getToolChain(), Args, CmdArgs, getToolChain().getTriple());
|
||||
#if 0 /* LSC: Not needed for MINIX, but kept to ease comparison with NetBSD. */
|
||||
unsigned Major, Minor, Micro;
|
||||
getToolChain().getTriple().getOSVersion(Major, Minor, Micro);
|
||||
bool useLibgcc = true;
|
||||
if (Major >= 7 || (Major == 6 && Minor == 99 && Micro >= 23) || Major == 0) {
|
||||
if (getToolChain().getArch() == llvm::Triple::x86 ||
|
||||
getToolChain().getArch() == llvm::Triple::x86_64)
|
||||
useLibgcc = false;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
if (!Args.hasArg(options::OPT_nostdlib) &&
|
||||
!Args.hasArg(options::OPT_nodefaultlibs)) {
|
||||
if (D.CCCIsCXX()) {
|
||||
getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
|
||||
CmdArgs.push_back("-lm");
|
||||
|
||||
/* LSC: Hack as lc++ is linked against mthread. */
|
||||
CmdArgs.push_back("-lmthread");
|
||||
}
|
||||
if (Args.hasArg(options::OPT_pthread))
|
||||
CmdArgs.push_back("-lpthread");
|
||||
CmdArgs.push_back("-lc");
|
||||
|
||||
#if 0 /* LSC: Minix always use CompilerRT-Generic. */
|
||||
if (useLibgcc) {
|
||||
if (Args.hasArg(options::OPT_static)) {
|
||||
// libgcc_eh depends on libc, so resolve as much as possible,
|
||||
// pull in any new requirements from libc and then get the rest
|
||||
// of libgcc.
|
||||
CmdArgs.push_back("-lgcc_eh");
|
||||
CmdArgs.push_back("-lc");
|
||||
CmdArgs.push_back("-lgcc");
|
||||
} else {
|
||||
CmdArgs.push_back("-lgcc");
|
||||
CmdArgs.push_back("--as-needed");
|
||||
CmdArgs.push_back("-lgcc_s");
|
||||
CmdArgs.push_back("--no-as-needed");
|
||||
}
|
||||
}
|
||||
#else
|
||||
//CmdArgs.push_back("-lCompilerRT-Generic");
|
||||
#endif /* 0 */
|
||||
}
|
||||
|
||||
if (!Args.hasArg(options::OPT_nostdlib) &&
|
||||
!Args.hasArg(options::OPT_nostartfiles)) {
|
||||
if (Args.hasArg(options::OPT_pthread))
|
||||
CmdArgs.push_back("-lpthread");
|
||||
CmdArgs.push_back("-lc");
|
||||
CmdArgs.push_back("-lCompilerRT-Generic");
|
||||
CmdArgs.push_back("-L/usr/pkg/compiler-rt/lib");
|
||||
CmdArgs.push_back(
|
||||
Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
|
||||
if (!Args.hasArg(options::OPT_shared))
|
||||
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(
|
||||
"crtend.o")));
|
||||
else
|
||||
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(
|
||||
"crtendS.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(
|
||||
"crtn.o")));
|
||||
}
|
||||
|
||||
addProfileRT(getToolChain(), Args, CmdArgs, getToolChain().getTriple());
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("ld"));
|
||||
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
|
||||
}
|
||||
|
||||
+6
-3
@@ -474,9 +474,10 @@ namespace gnutools {
|
||||
/// minix -- Directly call GNU Binutils assembler and linker
|
||||
namespace minix {
|
||||
class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
|
||||
|
||||
public:
|
||||
Assemble(const ToolChain &TC) : Tool("minix::Assemble", "assembler",
|
||||
TC) {}
|
||||
Assemble(const ToolChain &TC)
|
||||
: Tool("minix::Assemble", "assembler", TC) {}
|
||||
|
||||
virtual bool hasIntegratedCPP() const { return false; }
|
||||
|
||||
@@ -487,8 +488,10 @@ namespace minix {
|
||||
const char *LinkingOutput) const;
|
||||
};
|
||||
class LLVM_LIBRARY_VISIBILITY Link : public Tool {
|
||||
|
||||
public:
|
||||
Link(const ToolChain &TC) : Tool("minix::Link", "linker", TC) {}
|
||||
Link(const ToolChain &TC)
|
||||
: Tool("minix::Link", "linker", TC) {}
|
||||
|
||||
virtual bool hasIntegratedCPP() const { return false; }
|
||||
virtual bool isLinkJob() const { return true; }
|
||||
|
||||
@@ -230,6 +230,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
||||
case llvm::Triple::FreeBSD:
|
||||
case llvm::Triple::NetBSD:
|
||||
case llvm::Triple::OpenBSD:
|
||||
case llvm::Triple::Minix:
|
||||
case llvm::Triple::Bitrig:
|
||||
break;
|
||||
default:
|
||||
@@ -436,10 +437,6 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOp
|
||||
t, "", "", triple);
|
||||
break;
|
||||
}
|
||||
case llvm::Triple::Minix:
|
||||
AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3",
|
||||
"", "", "", triple);
|
||||
break;
|
||||
case llvm::Triple::Solaris:
|
||||
AddGnuCPlusPlusIncludePaths("/usr/gcc/4.5/include/c++/4.5.2/",
|
||||
"i386-pc-solaris2.11", "", "", triple);
|
||||
|
||||
@@ -161,8 +161,12 @@ Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) {
|
||||
|
||||
int Protect = getPosixProtectionFlags(Flags);
|
||||
|
||||
#if !defined(__minix)
|
||||
int Result = ::mprotect(M.Address, M.Size, Protect);
|
||||
if (Result != 0)
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
#endif /* !defined(__minix) */
|
||||
return error_code(errno, system_category());
|
||||
|
||||
if (Flags & MF_EXEC)
|
||||
|
||||
@@ -562,7 +562,11 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) {
|
||||
return error_code(errno, system_category());
|
||||
}
|
||||
|
||||
#if !defined(__minix)
|
||||
int flags = (Mode == readwrite) ? MAP_SHARED : MAP_PRIVATE;
|
||||
#else
|
||||
int flags = MAP_PRIVATE;
|
||||
#endif /* ! defined(__minix) */
|
||||
int prot = (Mode == readonly) ? PROT_READ : (PROT_READ | PROT_WRITE);
|
||||
#ifdef MAP_FILE
|
||||
flags |= MAP_FILE;
|
||||
@@ -737,7 +741,11 @@ error_code map_file_pages(const Twine &path, off_t file_offset, size_t size,
|
||||
if ( ofd == -1 )
|
||||
return error_code(errno, system_category());
|
||||
AutoFD fd(ofd);
|
||||
#if !defined(__minix)
|
||||
int flags = map_writable ? MAP_SHARED : MAP_PRIVATE;
|
||||
#else
|
||||
int flags = MAP_PRIVATE;
|
||||
#endif /* !defined(__minix) */
|
||||
int prot = map_writable ? (PROT_READ|PROT_WRITE) : PROT_READ;
|
||||
#ifdef MAP_FILE
|
||||
flags |= MAP_FILE;
|
||||
|
||||
+2
-2
@@ -576,8 +576,8 @@ uint64_t raw_fd_ostream::seek(uint64_t off) {
|
||||
}
|
||||
|
||||
size_t raw_fd_ostream::preferred_buffer_size() const {
|
||||
#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__minix)
|
||||
// Windows and Minix have no st_blksize.
|
||||
#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
||||
// Windows has no st_blksize.
|
||||
assert(FD >= 0 && "File not yet open!");
|
||||
struct stat statbuf;
|
||||
if (fstat(FD, &statbuf) != 0)
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ PARALLEL_DIRS = Utils Instrumentation Scalar InstCombine IPO Vectorize Hello Obj
|
||||
include $(LEVEL)/Makefile.config
|
||||
|
||||
# No support for plugins on windows targets
|
||||
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW Minix))
|
||||
ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
|
||||
PARALLEL_DIRS := $(filter-out Hello, $(PARALLEL_DIRS))
|
||||
endif
|
||||
|
||||
|
||||
@@ -112,9 +112,11 @@ void LLIChildTarget::makeSectionExecutable(uint64_t Addr, uint32_t Size) {
|
||||
// FIXME: We have to mark the memory as RWX because multiple code chunks may
|
||||
// be on the same page. The RemoteTarget interface should be changed to
|
||||
// work around that.
|
||||
#if !defined(__minix)
|
||||
int Result = ::mprotect((void*)Addr, Size, PROT_READ | PROT_WRITE | PROT_EXEC);
|
||||
if (Result != 0)
|
||||
InvalidateInstructionCache((const void *)Addr, Size);
|
||||
#endif /* !defined(__minix) */
|
||||
}
|
||||
|
||||
/// InvalidateInstructionCache - Before the JIT can run a block of code
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ ifeq ($(HOST_OS),Darwin)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD OpenBSD GNU Bitrig))
|
||||
ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD OpenBSD GNU Bitrig Minix))
|
||||
# Include everything from the .a's into the shared library.
|
||||
LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
|
||||
-Wl,--no-whole-archive
|
||||
|
||||
Vendored
+6
@@ -97,6 +97,12 @@ SUBDIR+= \
|
||||
libLLVMLTO
|
||||
.endif
|
||||
|
||||
.if defined(__MINIX)
|
||||
SUBDIR+= \
|
||||
libLLVMLTO \
|
||||
libLLVMgold
|
||||
.endif # defined(__MINIX)
|
||||
|
||||
SUBDIR+= \
|
||||
libclangAnalysis \
|
||||
libclangARCMigrate \
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
# $NetBSD: Makefile,v 1.1 2013/09/29 12:12:00 joerg Exp $
|
||||
|
||||
LIB= LLVMgold
|
||||
|
||||
.include <bsd.init.mk>
|
||||
|
||||
.PATH: ${LLVM_SRCDIR}/tools/gold
|
||||
|
||||
SRCS+= gold-plugin.cpp
|
||||
|
||||
# LSC: ensure the dynamic module is built
|
||||
LOADABLE_MODULE:= 1
|
||||
LINK_COMPONENTS := support
|
||||
LINK_LIBS_IN_SHARED := 1
|
||||
SHARED_LIBRARY := 1
|
||||
EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/gold.exports
|
||||
|
||||
# LIBS += -lLTO
|
||||
|
||||
CPPFLAGS+= -I ${NETBSDSRCDIR}/external/gpl3/binutils/dist/include
|
||||
|
||||
.if defined(HOSTLIB)
|
||||
.include <bsd.hostlib.mk>
|
||||
.else
|
||||
.include <bsd.lib.mk>
|
||||
.endif
|
||||
Vendored
+4
@@ -47,4 +47,8 @@ LDADD+= -lterminfo
|
||||
DPADD+= ${LIBTERMINFO}
|
||||
.endif
|
||||
|
||||
.if defined(__MINIX) && defined(HOSTPROG) && ${HOST_OSTYPE:C/\-.*//} != "Minix"
|
||||
LDADD+= -lpthread
|
||||
.else
|
||||
LDADD+= -lc++ -lmthread
|
||||
.endif # defined(__MINIX)
|
||||
|
||||
Reference in New Issue
Block a user