# 24378340 clang -fopenmp must include the path to the omp.h header file
# 24378393 clang -fopenmp must define _OPENMP to 201307
# Solaris GCC Toolchain.
# 3.9.X upstream.
--- tools/clang/lib/Frontend/CompilerInvocation.cpp 2016-01-12 13:01:56.000000000 -0800
+++ tools/clang/lib/Frontend/CompilerInvocation.cpp 2016-08-08 08:15:38.179011582 -0700
@@ -1424,7 +1424,7 @@
return DefaultVisibility;
}
-static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
+static void ParseLangArgs(LangOptions &Opts, InputArgList &Args, InputKind IK,
DiagnosticsEngine &Diags) {
// FIXME: Cleanup per-file based stuff.
LangStandard::Kind LangStd = LangStandard::lang_unspecified;
@@ -1718,6 +1718,7 @@
Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
Opts.PackStruct = getLastArgIntValue(Args, OPT_fpack_struct_EQ, 0, Diags);
Opts.MaxTypeAlign = getLastArgIntValue(Args, OPT_fmax_type_align_EQ, 0, Diags);
+ Opts.GXXABIVersion = getLastArgIntValue(Args, OPT_fabi_version_EQ, 0, Diags);
Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
Opts.PIELevel = getLastArgIntValue(Args, OPT_pie_level, 0, Diags);
Opts.Static = Args.hasArg(OPT_static_define);
@@ -1811,7 +1812,13 @@
}
// Check if -fopenmp is specified.
- Opts.OpenMP = Args.hasArg(options::OPT_fopenmp);
+ Opts.OpenMP = Args.getLastArgNoClaim(options::OPT_fopenmp) ||
+ Args.getLastArgNoClaim(options::OPT_fopenmp_EQ);
+
+ // OpenMP implies threads.
+ if (Opts.OpenMP)
+ Opts.POSIXThreads = Opts.OpenMP;
+
Opts.OpenMPUseTLS =
Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls);
Opts.OpenMPIsDevice =
@@ -1819,7 +1826,6 @@
// Get the OpenMP target triples if any.
if (Arg *A = Args.getLastArg(options::OPT_omptargets_EQ)) {
-
for (unsigned i = 0; i < A->getNumValues(); ++i) {
llvm::Triple TT(A->getValue(i));
###
--- tools/clang/lib/Frontend/InitHeaderSearch.cpp 2015-12-29 22:40:23.000000000 -0500
+++ tools/clang/lib/Frontend/InitHeaderSearch.cpp 2016-05-08 23:19:20.575431798 -0400
@@ -118,7 +118,7 @@
// Add the path with sysroot prepended, if desired and this is a system header
// group.
if (HasSysroot) {
- SmallString<256> MappedPathStorage;
+ SmallString<PATH_MAX> MappedPathStorage;
StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
if (CanPrefixSysroot(MappedPathStr)) {
AddUnmappedPath(IncludeSysroot + Path, Group, isFramework);
@@ -134,7 +134,7 @@
assert(!Path.isTriviallyEmpty() && "can't handle empty path here");
FileManager &FM = Headers.getFileMgr();
- SmallString<256> MappedPathStorage;
+ SmallString<PATH_MAX> MappedPathStorage;
StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
// Compute the DirectoryLookup type.
@@ -183,12 +183,16 @@
// Add the multilib dirs
llvm::Triple::ArchType arch = triple.getArch();
- bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64;
+ bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64 ||
+ arch == llvm::Triple::sparcv9;
if (is64bit)
AddPath(Base + "/" + ArchDir + "/" + Dir64, CXXSystem, false);
else
AddPath(Base + "/" + ArchDir + "/" + Dir32, CXXSystem, false);
+ // Add GCC's "C" include dir
+ AddPath(Base + "/include", CXXSystem, false);
+
// Add the backward dir
AddPath(Base + "/backward", CXXSystem, false);
}
@@ -442,6 +446,7 @@
break; // Everything else continues to use this routine's logic.
case llvm::Triple::Linux:
+ case llvm::Triple::Solaris:
return;
case llvm::Triple::Win32:
@@ -463,7 +468,7 @@
// Remove clang from foo/lib/clang
StringRef Lib = llvm::sys::path::parent_path(NoVer);
// Remove lib from foo/lib
- SmallString<128> P = llvm::sys::path::parent_path(Lib);
+ SmallString<PATH_MAX> P = llvm::sys::path::parent_path(Lib);
// Get foo/include/c++/v1
llvm::sys::path::append(P, "include", "c++", "v1");
--- tools/clang/lib/Frontend/InitPreprocessor.cpp 2015-11-17 17:28:55.000000000 -0500
+++ tools/clang/lib/Frontend/InitPreprocessor.cpp 2016-05-08 23:19:20.575431798 -0400
@@ -484,17 +484,51 @@
Builder.defineMacro("__clang_patchlevel__", "0");
#endif
Builder.defineMacro("__clang_version__",
- "\"" CLANG_VERSION_STRING " "
- + getClangFullRepositoryVersion() + "\"");
+ "\"" CLANG_VERSION_STRING " " CLANG_VERSION_TAGGED_STRING "\"");
+
#undef TOSTR
#undef TOSTR2
if (!LangOpts.MSVCCompat) {
// Currently claim to be compatible with GCC 4.2.1-5621, but only if we're
// not compiling for MSVC compatibility
- Builder.defineMacro("__GNUC_MINOR__", "2");
- Builder.defineMacro("__GNUC_PATCHLEVEL__", "1");
+ if (TI.getTriple().getOS() == llvm::Triple::Solaris) {
+ Builder.defineMacro("__GNUC_MINOR__", "8");
+ Builder.defineMacro("__GNUC_PATCHLEVEL__", "0");
+ } else {
+ Builder.defineMacro("__GNUC_MINOR__", "2");
+ Builder.defineMacro("__GNUC_PATCHLEVEL__", "1");
+ }
+
Builder.defineMacro("__GNUC__", "4");
- Builder.defineMacro("__GXX_ABI_VERSION", "1002");
+
+ // GCC provides a number of C++ ABI Versions in:
+ // ${top_srcdir}/gcc/c-family/c-cppbuiltin.c
+ // Currently valid GXX ABI Versions are documented here:
+ // https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html
+ // clang only supports a subset.
+ switch (LangOpts.GXXABIVersion) {
+ default:
+ Builder.defineMacro("__GXX_ABI_VERSION", "1002");
+ break;
+ case 4:
+ Builder.defineMacro("__GXX_ABI_VERSION", "1004");
+ break;
+ case 5:
+ Builder.defineMacro("__GXX_ABI_VERSION", "1005");
+ break;
+ case 6:
+ Builder.defineMacro("__GXX_ABI_VERSION", "1006");
+ break;
+ case 7:
+ Builder.defineMacro("__GXX_ABI_VERSION", "1007");
+ break;
+ case 8:
+ Builder.defineMacro("__GXX_ABI_VERSION", "1008");
+ break;
+ case 9:
+ Builder.defineMacro("__GXX_ABI_VERSION", "1009");
+ break;
+ }
}
// Define macros for the C11 / C++11 memory orderings