head 1.4; access; symbols pkgsrc-2013Q2:1.3.0.4 pkgsrc-2013Q2-base:1.3 pkgsrc-2013Q1:1.3.0.2 pkgsrc-2013Q1-base:1.3 pkgsrc-2012Q4:1.2.0.2 pkgsrc-2012Q4-base:1.2; locks; strict; comment @// @; 1.4 date 2013.07.02.10.33.02; author adam; state dead; branches; next 1.3; commitid RhzwaVrnJ34UNSVw; 1.3 date 2013.01.03.15.19.53; author adam; state Exp; branches; next 1.2; 1.2 date 2012.11.29.11.42.25; author marino; state Exp; branches; next 1.1; 1.1 date 2012.11.22.22.45.15; author marino; state Exp; branches; next ; desc @@ 1.4 log @Changes 3.3: The CellSPU port has been removed. It can still be found in older versions. The IR-level extended linker APIs (for example, to link bitcode files out of archives) have been removed. Any existing clients of these features should move to using a linker with integrated LTO support. LLVM and Clang’s documentation has been migrated to the Sphinx documentation generation system which uses easy-to-write reStructuredText. See llvm/docs/README.txt for more information. TargetTransformInfo (TTI) is a new interface that can be used by IR-level passes to obtain target-specific information, such as the costs of instructions. Only “Lowering” passes such as LSR and the vectorizer are allowed to use the TTI infrastructure. We’ve improved the X86 and ARM cost model. The Attributes classes have been completely rewritten and expanded. They now support not only enumerated attributes and alignments, but “string” attributes, which are useful for passing information to code generation. See How To Use Attributes for more details. TableGen’s syntax for instruction selection patterns has been simplified. Instead of specifying types indirectly with register classes, you should now specify types directly in the input patterns. See SparcInstrInfo.td for examples of the new syntax. The old syntax using register classes still works, but it will be removed in a future LLVM release. MCJIT now supports exception handling. Support for it in the old jit will be removed in the 3.4 release. Command line options can now be grouped into categories which are shown in the output of -help. See Grouping options into categories. The appearance of command line options in -help that are inherited by linking with libraries that use the LLVM Command line support library can now be modified at runtime. See The cl::getRegisteredOptions function. @ text @$NetBSD: patch-tools_clang_lib_Driver_Tools.cpp,v 1.3 2013/01/03 15:19:53 adam Exp $ * DragonFly no longer has gcc 4.1 in base, so clang stopped working. We prefer to use gcc 4.7 if available due to a better libstdc++. The fallback is gcc 4.4 which has been available for several years. The libgcc specs are different between 4.4 and 4.7 * DragonFly: Removed duplicate libgcc handling * DragonFly: Removed redundant rpath-link * DragonFly: Added -export-dynamic (matches gcc dumpspecs) * DragonFly: Added gnu-hash to shared objects --- tools/clang/lib/Driver/Tools.cpp.orig 2012-11-21 07:56:23.000000000 +0000 +++ tools/clang/lib/Driver/Tools.cpp @@@@ -6238,21 +6238,28 @@@@ void dragonfly::Link::ConstructJob(Compi const InputInfoList &Inputs, const ArgList &Args, const char *LinkingOutput) const { + bool UseGCC47; const Driver &D = getToolChain().getDriver(); ArgStringList CmdArgs; + llvm::sys::fs::exists("/usr/lib/gcc47", UseGCC47); + if (!D.SysRoot.empty()) CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); + CmdArgs.push_back("--eh-frame-hdr"); if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-Bstatic"); } else { + if (Args.hasArg(options::OPT_rdynamic)) + CmdArgs.push_back("-export-dynamic"); if (Args.hasArg(options::OPT_shared)) CmdArgs.push_back("-Bshareable"); else { CmdArgs.push_back("-dynamic-linker"); CmdArgs.push_back("/usr/libexec/ld-elf.so.2"); } + CmdArgs.push_back("--hash-style=both"); } // When building 32-bit code on DragonFly/pc64, we have to explicitly @@@@ -6272,18 +6279,26 @@@@ void dragonfly::Link::ConstructJob(Compi if (!Args.hasArg(options::OPT_nostdlib) && !Args.hasArg(options::OPT_nostartfiles)) { if (!Args.hasArg(options::OPT_shared)) { - 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"))); - } else { - CmdArgs.push_back( - Args.MakeArgString(getToolChain().GetFilePath("crti.o"))); - CmdArgs.push_back( - Args.MakeArgString(getToolChain().GetFilePath("crtbeginS.o"))); + if (Args.hasArg(options::OPT_pg)) + CmdArgs.push_back(Args.MakeArgString( + getToolChain().GetFilePath("gcrt1.o"))); + else { + if (Args.hasArg(options::OPT_pie)) + CmdArgs.push_back(Args.MakeArgString( + getToolChain().GetFilePath("Scrt1.o"))); + else + CmdArgs.push_back(Args.MakeArgString( + getToolChain().GetFilePath("crt1.o"))); + } } + CmdArgs.push_back(Args.MakeArgString( + getToolChain().GetFilePath("crti.o"))); + if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie)) + CmdArgs.push_back(Args.MakeArgString( + getToolChain().GetFilePath("crtbeginS.o"))); + else + CmdArgs.push_back(Args.MakeArgString( + getToolChain().GetFilePath("crtbegin.o"))); } Args.AddAllArgs(CmdArgs, options::OPT_L); @@@@ -6296,20 +6311,19 @@@@ void dragonfly::Link::ConstructJob(Compi !Args.hasArg(options::OPT_nodefaultlibs)) { // FIXME: GCC passes on -lgcc, -lgcc_pic and a whole lot of // rpaths - CmdArgs.push_back("-L/usr/lib/gcc41"); + if (UseGCC47) + CmdArgs.push_back("-L/usr/lib/gcc47"); + else + CmdArgs.push_back("-L/usr/lib/gcc44"); if (!Args.hasArg(options::OPT_static)) { - CmdArgs.push_back("-rpath"); - CmdArgs.push_back("/usr/lib/gcc41"); - - CmdArgs.push_back("-rpath-link"); - CmdArgs.push_back("/usr/lib/gcc41"); - - CmdArgs.push_back("-rpath"); - CmdArgs.push_back("/usr/lib"); - - CmdArgs.push_back("-rpath-link"); - CmdArgs.push_back("/usr/lib"); + if (UseGCC47) { + CmdArgs.push_back("-rpath"); + CmdArgs.push_back("/usr/lib/gcc47"); + } else { + CmdArgs.push_back("-rpath"); + CmdArgs.push_back("/usr/lib/gcc44"); + } } if (D.CCCIsCXX) { @@@@ -6317,13 +6331,6 @@@@ void dragonfly::Link::ConstructJob(Compi CmdArgs.push_back("-lm"); } - if (Args.hasArg(options::OPT_shared)) { - CmdArgs.push_back("-lgcc_pic"); - } else { - CmdArgs.push_back("-lgcc"); - } - - if (Args.hasArg(options::OPT_pthread)) CmdArgs.push_back("-lpthread"); @@@@ -6331,23 +6338,42 @@@@ void dragonfly::Link::ConstructJob(Compi CmdArgs.push_back("-lc"); } - if (Args.hasArg(options::OPT_shared)) { - CmdArgs.push_back("-lgcc_pic"); + if (UseGCC47) { + if (Args.hasArg(options::OPT_static) || + Args.hasArg(options::OPT_static_libgcc)) { + CmdArgs.push_back("-lgcc"); + CmdArgs.push_back("-lgcc_eh"); + } else { + if (Args.hasArg(options::OPT_shared_libgcc)) { + CmdArgs.push_back("-lgcc_pic"); + if (!Args.hasArg(options::OPT_shared)) + CmdArgs.push_back("-lgcc"); + } else { + CmdArgs.push_back("-lgcc"); + CmdArgs.push_back("--as-needed"); + CmdArgs.push_back("-lgcc_pic"); + CmdArgs.push_back("--no-as-needed"); + } + } } else { - CmdArgs.push_back("-lgcc"); + if (Args.hasArg(options::OPT_shared)) { + CmdArgs.push_back("-lgcc_pic"); + } else { + CmdArgs.push_back("-lgcc"); + } } } if (!Args.hasArg(options::OPT_nostdlib) && !Args.hasArg(options::OPT_nostartfiles)) { - if (!Args.hasArg(options::OPT_shared)) + if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie)) CmdArgs.push_back(Args.MakeArgString( - getToolChain().GetFilePath("crtend.o"))); + getToolChain().GetFilePath("crtendS.o"))); else CmdArgs.push_back(Args.MakeArgString( - getToolChain().GetFilePath("crtendS.o"))); + getToolChain().GetFilePath("crtend.o"))); CmdArgs.push_back(Args.MakeArgString( - getToolChain().GetFilePath("crtn.o"))); + getToolChain().GetFilePath("crtn.o"))); } addProfileRT(getToolChain(), Args, CmdArgs, getToolChain().getTriple()); @ 1.3 log @Changes 3.2: * Improvements to Clang's diagnostics * Support for tls_model attribute * Type safety attributes * Documentation comment support More... @ text @d1 1 a1 1 $NetBSD: patch-tools_clang_lib_Driver_Tools.cpp,v 1.2 2012/11/29 11:42:25 marino Exp $ @ 1.2 log @lang/clang: Improve DragonFly support 1) Don't pass both gcc 4.4 and gcc 4.7 paths to the driver. Detect if gcc47 is available and use those paths, otherwise fall back to gcc44. 2) Add support for exception handling 3) Add rdynamic support 4) Add gnu-hash style support 5) Fix (!!) crtstuff (This was obsolete, include PIE support) 6) Remove rpath-link 7) Remove unneeded duplicate libgcc handling 8) Make libgcc handling match gcc specs (different for gcc 4.4 and 4.7) 9) Update dragonfly driver test @ text @d1 1 a1 1 $NetBSD: patch-tools_clang_lib_Driver_Tools.cpp,v 1.1 2012/11/22 22:45:15 marino Exp $ d12 1 a12 1 --- tools/clang/lib/Driver/Tools.cpp.orig 2012-04-18 21:32:25.000000000 +0000 d14 1 a14 1 @@@@ -5441,21 +5441,28 @@@@ void dragonfly::Link::ConstructJob(Compi d43 1 a43 1 @@@@ -5475,18 +5482,26 @@@@ void dragonfly::Link::ConstructJob(Compi d81 1 a81 1 @@@@ -5499,20 +5514,19 @@@@ void dragonfly::Link::ConstructJob(Compi d113 1 a113 1 @@@@ -5520,13 +5534,6 @@@@ void dragonfly::Link::ConstructJob(Compi d127 1 a127 1 @@@@ -5534,23 +5541,42 @@@@ void dragonfly::Link::ConstructJob(Compi @ 1.1 log @lang/clang: Fix binary generation on latest DragonFly Clang was hardwired to search for crt* stuff and libstdc++ at /usr/lib/gcc41. This worked for most people even when DragonFly moved to gcc 4.4 as the primary base compiler since gcc 4.1 was usually also on the system. With the release of DragonFly 3.2, gcc 4.7 replaced gcc 4.1 and clang stopped compiling due to not being able to find libraries and crt* objects. The new patches make clang driver first look for gcc 4.7 and failing to find that: gcc 4.4. The other patches were "de-fuzzed". Revision bump was necessary because clang did build, it just didn't work. Patches submitted upstream: http://llvm.org/bugs/show_bug.cgi?id=14417 @ text @d1 1 a1 1 $NetBSD$ d3 8 a10 3 DragonFly no longer has gcc 4.1 in base, so clang stopped working. We prefer to use gcc 4.7 if available due to a better libstdc++. The fallback is gcc 4.4 which has been available for several years. d14 68 a81 1 @@@@ -5499,14 +5499,21 @@@@ void dragonfly::Link::ConstructJob(Compi d86 4 a89 2 + CmdArgs.push_back("-L/usr/lib/gcc47"); + CmdArgs.push_back("-L/usr/lib/gcc44"); d92 4 a95 1 CmdArgs.push_back("-rpath"); d97 19 a115 1 + CmdArgs.push_back("/usr/lib/gcc47"); d117 58 a174 9 CmdArgs.push_back("-rpath-link"); - CmdArgs.push_back("/usr/lib/gcc41"); + CmdArgs.push_back("/usr/lib/gcc47"); + + CmdArgs.push_back("-rpath"); + CmdArgs.push_back("/usr/lib/gcc44"); + + CmdArgs.push_back("-rpath-link"); + CmdArgs.push_back("/usr/lib/gcc44"); d176 1 a176 2 CmdArgs.push_back("-rpath"); CmdArgs.push_back("/usr/lib"); @