summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
Commit message (Collapse)AuthorAgeFilesLines
* clang-cl: ignore /showIncludes when combined with /E (PR20336)Hans Wennborg2014-07-211-2/+5
| | | | | | | | Both /showIncludes and /E write to stdout. Allowing both results in interleaved output and an error when double-closing the file descriptor, intended to catch issues like this. llvm-svn: 213589
* [mips] Use Triple::getVendor() instead of Triple::getVendorName() to ↵Daniel Sanders2014-07-181-1/+1
| | | | | | identify 'mti' vendor triples. llvm-svn: 213383
* [AArch64] Implement Clang CLI interface proposal about "-march".Kevin Qin2014-07-181-41/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Revert "Add default feature for CPUs on AArch64 target in Clang" at r210625. Then, all enabled feature will by passed explicitly by -target-feature in -cc1 option. 2. Get "-mfpu" deprecated. 3. Implement support of "-march". Usage is: -march=armv8-a+[no]feature For instance, "-march=armv8-a+neon+crc+nocrypto". Here "armv8-a" is necessary, and CPU names are not acceptable. Candidate features are fp, neon, crc and crypto. Where conflicting feature modifiers are specified, the right-most feature is used. 4. Implement support of "-mtune". Usage is: -march=CPU_NAME For instance, "-march=cortex-a57". This option will ONLY get micro-architectural feature enabled specifying to target CPU, like "+zcm" and "+zcz" for cyclone. Any architectural features WON'T be modified. 5. Change usage of "-mcpu" to "-mcpu=CPU_NAME+[no]feature", which is an alias to "-march={feature of CPU_NAME}+[no]feature" and "-mtune=CPU_NAME" together. Where this option is used in conjunction with -march or -mtune, those options take precedence over the appropriate part of this option. llvm-svn: 213353
* Using a std::string instead of a StringRef because the Default case ↵Aaron Ballman2014-07-171-6/+6
| | | | | | | | synthesizes a temporary std::string from a Twine. Assigning that into a StringRef causes the StringRef to refer to a temporary, and bad things happen. This fixes a failing test case on Windows. llvm-svn: 213265
* [mips] Pass the ABI to the integrated assembler and add tests the existing ↵Daniel Sanders2014-07-171-0/+11
| | | | | | | | | | | | | | | | | arguments. Summary: With this patch (and a corresponding LLVM patch), assembling an empty file with GCC and Clang -fintegrated-as produce near identical objects. The remaining differences are: * GCC/GAS produce objects have a .pdr section * GCC/GAS produce objects have a .gnu.attributes section Other differences are insignificant such as precise file offsets and the order of strings in the string table. Differential Revision: http://reviews.llvm.org/D4531 llvm-svn: 213241
* Typically linker options are protected with -Xlinker or -Wl,Arthur Marble2014-07-161-2/+7
| | | | | | | | however certain sloppy Makefiles pass -z options directly to the compiler. This patch enables clang to recognize these options (because -z is not used by clang itself). llvm-svn: 213198
* [Driver][Mips] Reduce code duplication - use existing functionSimon Atanasyan2014-07-161-11/+11
| | | | | | | | getMipsCPUAndABI() to get MIPS ABI name during multi-library selection. No functional changes. llvm-svn: 213143
* [mips] Correct the invocation of GAS in several cases.Daniel Sanders2014-07-161-8/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As a result of this patch, assembling an empty file with GCC and Clang (using GAS as the assembler) now produces identical objects. -mfp32/-mfpxx/-mfp64 now form a trinity of options. -mfpxx is the default when the triple vendor is 'img' or 'mti', the ABI is O32, and the CPU is between mips2 and mips32r2/mips64r2 (inclusive). -mno-shared is always given to the assembler to match the effect of -mabicalls (currently unimplemented but Clang acts as if it is given). Similarly, -call_nonpic is always given to match the effect of -mplt (also unimplemented and acts as if given) except when the ABI is 64 in which case -mplt has no effect so -KPIC is given instead. -mhard-float/-msoft-float are now passed on. -modd-spreg/-mno-odd-spreg are now passed on. -mno-mips16 is correctly passed on. The assembler option is -no-mips16 not -mno-mips16 Differential Revision: http://reviews.llvm.org/D4515 llvm-svn: 213138
* [mips] Add support for -mfpxx and -mno-fpxx.Daniel Sanders2014-07-161-0/+4
| | | | | | Differential Revision: http://reviews.llvm.org/D4464 llvm-svn: 213132
* Don't add -Bsymbolic by default on Android.Evgeniy Stepanov2014-07-161-3/+0
| | | | | | | -Bsymbolic is not a platform requirement and should not be added unconditionally. llvm-svn: 213126
* Driver: bifurcate extended and basic MSC versioningSaleem Abdulrasool2014-07-161-7/+41
| | | | | | | | | | | | | | | | | | | | | | | This restores the original behaviour of -fmsc-version. The older option remains as a mechanism for specifying the basic version information. A secondary option, -fms-compatibility-version permits the user to specify an extended version to the driver. The new version takes the value as a dot-separated value rather than the major * 100 + minor format that -fmsc-version format. This makes it easier to specify the value as well as a more flexible manner for specifying the value. Specifying both values is considered an error. The older parameter is left solely as a driver option, which is normalised into the newer parameter. This allows us to retain a single code path in the compiler itself whilst preserving the semantics of the old parameter as well as avoid having to determine which of two formats are being used by the invocation. The test changes are due to the fact that the compiler no longer supports the old option, and is a direct conversion to the new option. llvm-svn: 213119
* clang-cl: Implement the -arch flagEhsan Akhgari2014-07-151-2/+28
| | | | | | | | | | | | | | | Summary: This implements the -arch flag for both x86 and x86-64 by letting them affect the default target features we pass to cc1. -m machine flags will override the features set by -arch. Reviewers: hansw Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4519 llvm-svn: 213083
* [Driver] clang::driver::getARMCPUForMArch() moved to ↵Argyrios Kyrtzidis2014-07-111-83/+2
| | | | | | | | | llvm::Triple::getARMCPUForArch(). Depends on llvm r212846. Suggested by Eric Christopher. llvm-svn: 212858
* Handle SPARC float command line parameters for SPARCv9.Brad Smith2014-07-111-1/+2
| | | | llvm-svn: 212838
* GCC compatibility: Create a Group to ignore unsupported optimization.Sylvestre Ledru2014-07-111-0/+7
| | | | | | | | | | | | Returns a warning when using an unknown optimization flag. This patch includes -finline-limit as one of those ignored flags. More options will be moved in this group Patch by Arthur Marble <arthur@info9.net> in the context of Debian Google Summer of code 2014. Reviewers: rnk, Sylvestre llvm-svn: 212805
* Enable -gcolumn-info by default.Diego Novillo2014-07-101-1/+2
| | | | | | | | | | | | | | | This patch flips the default value for -gcolumn-info to be on by default. I discussed the rationale and provided compile/size data in: http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/074290.html This also updates the documentation and some tests that relied on the lack of column information. Some tests had column information in the expected output, but it was wrong (the tsan tests). Others were using the driver to execute. llvm-svn: 212781
* [x32] Adding X32 target support to driver, including ↵Zinovy Nis2014-07-101-1/+10
| | | | | | | | | | TargetInfo,DescriptionString, flags, paths lookup, etc. Cover changes with new tests. The author of the patch is Pavel Chupin (@pavel.v.chupin). The changes enable "hello world" on x32 target (x86_64-*-linux-gnux32). s/isX32/IsX32/ also fixed. Differential Revision: http://reviews.llvm.org/D4180 llvm-svn: 212725
* [mips][mips64r6] Add support for mips-img-linux-gnu GCC toolchainsDaniel Sanders2014-07-101-10/+17
| | | | | | | | | | | | | | Summary: * Support the multilib layout used by the mips-img-linux-gnu * Recognize mips{,64}{,el}-img-linux-gnu as being aliases of mips-img-linux-gnu * Use the correct dynamic linker for mips-img-linux-gnu * Make mips32r6/mips64r6 the default CPU for mips-img-linux-gnu Subscribers: mpf Differential Revision: http://reviews.llvm.org/D4436 llvm-svn: 212719
* [mips] Add support for -modd-spreg/-mno-odd-spregDaniel Sanders2014-07-101-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D4432 llvm-svn: 212700
* [Driver] Expose getARMCPUForMArch() function in the Driver API; NFC.Argyrios Kyrtzidis2014-07-101-3/+8
| | | | llvm-svn: 212666
* Remove unused sys/stat.h includesAlp Toker2014-07-071-1/+0
| | | | | | The facility was abstracted to LLVM in r187364. llvm-svn: 212441
* [Driver][Mips] If ABI name is not provided deduce it from the target tripleSimon Atanasyan2014-07-021-10/+10
| | | | | | not from the CPU name. This approach is closer to the method used by gcc driver. llvm-svn: 212176
* Driver: Handle /GR- in a compatible way with MSVCDavid Majnemer2014-07-011-15/+8
| | | | | | | | | | | | | | | | | There are slight differences between /GR- and -fno-rtti which made mapping one to the other inappropriate. -fno-rtti disables dynamic_cast, typeid, and does not emit RTTI related information for the v-table. /GR- does not generate complete object locators and thus will not reference them in vftables. However, constructs like dynamic_cast and typeid are permitted. This should bring our implementation of RTTI up to semantic parity with MSVC modulo bugs. llvm-svn: 212138
* GCC compatibility: Ignore -finput_charset=UTF-8 argument. It is the default ↵Sylvestre Ledru2014-07-011-0/+8
| | | | | | | | | | | | | | | | in Clang. Currently, we fail with an error. Reviewers: rafael Reviewed By: rafael Subscribers: rnk, cfe-commits Differential Revision: http://reviews.llvm.org/D4347 llvm-svn: 212110
* [Driver][Mips] MIPS ABI names "32" and "64" used as arguments of the "-mabi"Simon Atanasyan2014-07-011-2/+2
| | | | | | | | | command line option only. Internally we convert them to the "o32" and "n64" respectively. So we do not need to refer them anywhere after that conversion. No functional changes. llvm-svn: 212096
* [UBSan] Don't link UBSan runtime into shared libraries.Alexey Samsonov2014-06-301-7/+5
| | | | | | | | It used to be a feature of UBSan (it could sanitize a standalone shared object instead of the whole program), but now it causes more problems, like PR20165. llvm-svn: 212064
* Use the newly added FindInEnvPath helper in clangEhsan Akhgari2014-06-301-7/+2
| | | | llvm-svn: 212058
* Fix a stray semi-colon. (Found by a pedantic warning)Chandler Carruth2014-06-291-1/+1
| | | | llvm-svn: 212003
* Revert r211866, r211895 and r211995, "Driver: use GNU::Link for the ↵NAKAMURA Takumi2014-06-291-189/+16
| | | | | | | | | | | Generic_GCC toolchain". It broke users of Generic_GCC, cygwin and mingw32. It reverts commits as follows: r211866: "Driver: use GNU::Link for the Generic_GCC toolchain" r211895: "Replace GetProgramPath("ld") with GetLinkerPath()." r211995: "Driver: add a cygwin linker tool" llvm-svn: 211998
* Driver: add a cygwin linker toolSaleem Abdulrasool2014-06-291-0/+166
| | | | | | | | | This adds a linker tool for the Windows cygwin environment. This linker invocation is significantly different from the generic ld invocation. It requires additional parameters as well as does not accept some normal parameters. This should fix self-hosting on Cygwin. llvm-svn: 211995
* clang-cl: Map /EHs- to -fno-exceptionsReid Kleckner2014-06-271-4/+52
| | | | | | | | | | | | | | | This isn't 100% compatible with MSVC, but it's close enough. MSVC's /EH flag doesn't really control exceptions so much as how to clean up after an exception is thrown. The upshot is that cl.exe /EHs- will compile try, throw, and catch statements with a warning, but clang-cl will reject such constructs with a hard error. We can't compile such EH constructs anyway, but this may matter to consumers of the AST. Reviewers: hans Differential Revision: http://reviews.llvm.org/D4317 llvm-svn: 211909
* Replace GetProgramPath("ld") with GetLinkerPath().Logan Chien2014-06-271-1/+1
| | | | llvm-svn: 211895
* Driver: use GNU::Link for the Generic_GCC toolchainSaleem Abdulrasool2014-06-271-16/+23
| | | | | | | | | | | | | | | | | This changes the behaviour of the driver for linking to match that of the Generic_GCC::Assemble. The default link should use "ld" rather than "gcc" for the linker as gcc does. This avoids the unnecessary round-tripping through gcc. It also is much more reasonable behaviour from the user's perspective. This should have been updated with SVN r195554 which changed the behaviour of Generic_GCC::Assemble. The gcc_forward test needs to be updated to mark the fact that -march is a flag for GCC not ld. This was updated as a typo fix, but added a check for a flag that is not a link flag. The bindings test covers the change for testing, and thus no new test was added. llvm-svn: 211866
* clang-cl: Don't store the cl compiler Tool on the stack (PR20131)Hans Wennborg2014-06-261-3/+8
| | | | | | | | | | | | | | The Command will refer back to the Tool as its source, so it has to outlive the Command. Having the Tool on the stack would cause us to crash when using "clang-cl -GR -fallback", because if the Command fails, Driver::ExecuteCompilation tries to peek at the Command's source. Differential Revision: http://reviews.llvm.org/D4314 llvm-svn: 211802
* Implement the -fuse-ld= option.Logan Chien2014-06-261-9/+9
| | | | | | | | | | | | | | This commit implements the -fuse-ld= option, so that the user can specify -fuse-ld=bfd to use ld.bfd. This commit re-applies r194328 with some test case changes. It seems that r194328 was breaking macosx or mingw build because clang can't find ld.bfd or ld.gold in the given sysroot. We should use -B to specify the executable search path instead. Patch originally by David Chisnall. llvm-svn: 211785
* Add ppc64/power8 as a targetWill Schmidt2014-06-261-0/+2
| | | | llvm-svn: 211778
* Forward -u to the linker on gnutools toolchainsReid Kleckner2014-06-261-0/+1
| | | | | | | | | | | | | | | | Summary: The BSDs and Darwin all forward the whole 'u' group, but gcc only forwards -u so far as I can tell. I only forward -u, since that's a minimal change, and many people object to magically recognizing and forwarding linker arguments. Reviewers: chandlerc, joerg Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4304 llvm-svn: 211756
* Align with new GCC options for x86 AndroidAlexey Volkov2014-06-251-2/+6
| | | | | | | | | 32-bit: +ssse3 64-bit: +sse4.2 +popcnt Differential Revision: http://reviews.llvm.org/D4287 llvm-svn: 211688
* [Driver] Follow-up to r211598, r211663. Do not build a dynamic linkerSimon Atanasyan2014-06-251-6/+6
| | | | | | path using sub-strings concatenation. Return the whole string explicitly. llvm-svn: 211665
* Tools.cpp: Update getLinuxDynamicLinker() to return Twine instead of ↵NAKAMURA Takumi2014-06-251-3/+3
| | | | | | StringRef, since r211598 has introduced manipulation of return string. llvm-svn: 211663
* Reformat.NAKAMURA Takumi2014-06-251-3/+3
| | | | llvm-svn: 211661
* Use appropriate default PIE settings for OpenBSD.Brad Smith2014-06-241-0/+21
| | | | llvm-svn: 211624
* [mips] Correct linux dynamic linker for -mnan=2008Daniel Sanders2014-06-241-5/+24
| | | | | | | | | | | | Summary: The dynamic linker is named ld-linux-mipsn8.so.1 when -mnan=2008 is given (or is the default). It remains ld.so.1 for other cases. This is necessary for MIPS32r6/MIPS64r6 since these ISA's default to -mnan=2008. Differential Revision: http://reviews.llvm.org/D4273 llvm-svn: 211598
* Driver: In crashdumps with -fmodule, dump the module dependenciesJustin Bogner2014-06-201-17/+40
| | | | llvm-svn: 211421
* Driver: Record that we're in crashdump and push flags to ConstructJobJustin Bogner2014-06-201-4/+5
| | | | | | | | | | | It's more flexible and arguably better layering to set flags to modify compiling for diagnostics in the CC1 job themselves, rather than tweaking the driver flags and letting them propagate. There is one visible change this causes: crash report files will now get preprocessed names (.i and friends). llvm-svn: 211411
* Driver: Remove some superfluous calls to Arg->claim()Justin Bogner2014-06-201-14/+5
| | | | | | | Args.getLastArg() claims the Arg it returns, so calling claim on these results is unnecessary. llvm-svn: 211403
* [PowerPC] Fix ELF interpreter name for powerpc64le-linuxUlrich Weigand2014-06-201-1/+2
| | | | | | | | | | On PowerPC LE the system uses the /lib64/ld64.so.2 dynamic linker name instead of /lib64/ld64.so.1 (to indicate the ELFv2 ABI version). This fixes the clang driver to pass the appropriate -dynamic-linker setting, and adds some more tests to linux-ld.c. llvm-svn: 211360
* Driver: correct the backend option spellingSaleem Abdulrasool2014-06-181-1/+1
| | | | | | The backend option does not have an '-enable' prefix. llvm-svn: 211177
* Add support for the /EP argument to clang-clHans Wennborg2014-06-131-0/+6
| | | | | | | | | | This maps the /EP argument to both -E and -P. Patch by Ehsan Akhgari! Differential Reviion: http://reviews.llvm.org/D4133 llvm-svn: 210935
* Use dwarf-2 by default on OpenBSD and FreeBSD.Brad Smith2014-06-131-4/+8
| | | | | | | The Tools.cpp part of the patch partially based on a patch from FreeBSD's LLVM tree. llvm-svn: 210883
OpenPOWER on IntegriCloud