summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains/FreeBSD.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Restore functionality of --sysroot on FreeBSD after b18cb9c47Dimitry Andric2020-02-191-1/+8
| | | | | | | | | | | | | | | | | After b18cb9c47, clang would sometimes prefer the host C++ includes (e.g. in /usr/include/c++/v1) before those specified via --sysroot. While this behavior may be desirable on Linux, it is not so on FreeBSD, where we make extensive use of --sysroot during the build of the base system. In that case, clang must *not* search outside the sysroot, except for its own internal headers. Add an override addLibCxxIncludePaths() to restore the old behavior, which is to simply append /usr/include/c++/v1 to the specified sysroot. While here, apply clang-format to the FreeBSD specific toolchain files. Fixes PR44923. (cherry picked from commit 62654cab7e654384ba503d6b62b1054cde19a553)
* Add Triple::isX86()Fangrui Song2020-01-061-4/+3
| | | | | | Reviewed By: craig.topper, skan Differential Revision: https://reviews.llvm.org/D72247
* [Driver] Use .init_array for all gcc installations and simplify Generic_ELF ↵Fangrui Song2019-12-131-0/+9
| | | | | | | | | | | | | | | | | -fno-use-init-array rules D39317 made clang use .init_array when no gcc installations is found. This change changes all gcc installations to use .init_array . GCC 4.7 by default stopped providing .ctors/.dtors compatible crt files, and stopped emitting .ctors for __attribute__((constructor)). .init_array should always work. FreeBSD rules are moved to FreeBSD.cpp to make Generic_ELF rules clean. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D71434
* Initial implementation of -fmacro-prefix-map and -ffile-prefix-mapDan McGregor2019-11-261-0/+15
| | | | | | | | | GCC 8 implements -fmacro-prefix-map. Like -fdebug-prefix-map, it replaces a string prefix for the __FILE__ macro. -ffile-prefix-map is the union of -fdebug-prefix-map and -fmacro-prefix-map Reviewed By: rnk, Lekensteyn, maskray Differential Revision: https://reviews.llvm.org/D49466
* Populate CUDA flags on FreeBSD too, as many other toolchains do.Dimitry Andric2019-11-181-0/+5
| | | | | | | | | | | | | | | | Summary: This allows `clang` to be used to compile CUDA programs. Compiled simple helloworld.cu with this. Reviewers: dim, emaste, tra, yaxunl, ABataev Reviewed By: tra Subscribers: dim, emaste, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69990
* clang: enable unwind tables on FreeBSD !amd64Ed Maste2019-11-151-0/+2
| | | | | | | | | | | | | | | | | | | There doesn't seem to be much sense in defaulting "on" unwind tables on amd64 and not on other arches. It causes surprising differences between platforms, such as the PR below[1]. Prior to this change, FreeBSD inherited the default implementation of the method from the Gnu.h Generic_Elf => Generic_GCC parent class, which returned true only for amd64 targets. Override that and opt on always, similar to, e.g., NetBSD's driver. [1] https://bugs.freebsd.org/241562 Patch by cem (Conrad Meyer). Reviewed By: dim Differential Revision: https://reviews.llvm.org/D70110
* [Driver] Add -static-openmp driver optionPirama Arumuga Nainar2019-09-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | Summary: For Gnu, FreeBSD and NetBSD, this option forces linking with the static OpenMP host runtime (similar to -static-libgcc and -static-libstdcxx). Android's NDK will start the shared OpenMP runtime in addition to the static libomp. In this scenario, the linker will prefer to use the shared library by default. Add this option to enable linking with the static libomp. Reviewers: Hahnfeld, danalbert, srhines, joerg, jdoerfert Subscribers: guansong, cfe-commits Tags: #clang Fixes https://github.com/android-ndk/ndk/issues/1028 Differential Revision: https://reviews.llvm.org/D67200 llvm-svn: 371437
* clang: default to DWARF 4 for FreeBSD 12.0 and laterEd Maste2019-09-031-0/+6
| | | | | | | | | | | | Older FreeBSD versions included GDB 6.1 and had other tools that were unable to handle debug information newer than DWARF 2. Those tools have since been updated. (An old version of GDB is still kept for kernel crash handling, but the kernel is compiled with an explicit -gdwarf2.) Reviewed by: dim Differential Revision: https://reviews.llvm.org/D66760 llvm-svn: 370779
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-2/+2
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
* [RISCV] Add FreeBSD targetsSam Elliott2019-08-011-0/+8
| | | | | | | | | | | | | | | | Reviewers: asb Reviewed By: asb Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57795 Patch by James Clarke (jrtc27) llvm-svn: 367557
* [asan] Add gcc 8's driver option -fsanitize=pointer-compare and ↵Pierre Gousseau2019-04-121-0/+2
| | | | | | | | | | | | -fsanitize=pointer-substract. Disabled by default as this is still an experimental feature. Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D59221 llvm-svn: 358285
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Lift VFS from clang to llvm (NFC)Jonas Devlieghere2018-10-101-1/+1
| | | | | | | | | | | | | | | | | | | This patch moves the virtual file system form clang to llvm so it can be used by more projects. Concretely the patch: - Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support. - Moves the corresponding unit test from clang to llvm. - Moves the vfs namespace from clang::vfs to llvm::vfs. - Formats the lines affected by this change, mostly this is the result of the added llvm namespace. RFC on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html Differential revision: https://reviews.llvm.org/D52783 llvm-svn: 344140
* Fix a typo/regression in r335495.John Baldwin2018-07-101-1/+1
| | | | | | | | | | | Use getTriple.isMIPS64() to detect 64-bit MIPS ABIs in FreeBSD::getSupportedSanitizers() instead of getTriple.isMIPS32(). Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D49143 llvm-svn: 336710
* Fix warning about unhandled enumeration in switch.Zachary Turner2018-06-271-0/+2
| | | | llvm-svn: 335702
* [mips] Explicitly specify the linker emulation for MIPS on FreeBSD.John Baldwin2018-06-271-6/+29
| | | | | | | | | | | | | | FreeBSD's mips64 builds O32 binaries for /usr/lib32 by default and thus needs to be able to link O32 binaries which requires an explicit linker emulation. Go ahead and list all the linker emulation variants for MIPS so that any supported MIPS ABI binary can be linked by any linker supporting MIPS. Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D48507 llvm-svn: 335691
* Use Triple::isMIPS() instead of enumerating all Triples. NFCAlexander Richardson2018-06-251-13/+6
| | | | | | | | Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D48549 llvm-svn: 335495
* Enable -fsanitize=function on FreeBSD.Fangrui Song2018-05-031-0/+1
| | | | llvm-svn: 331440
* [Driver] Support for -save-stats in AddGoldPlugin.Florian Hahn2018-04-201-2/+5
| | | | | | | | | | | | | | This patch updates AddGoldPlugin to pass stats-file to the Gold plugin, if -save-stats is passed. It also moves the save-stats option handling to a helper function tools::getStatsFileName. Reviewers: tejohnson, mehdi_amini, compnerd Reviewed By: tejohnson, compnerd Differential Revision: https://reviews.llvm.org/D45771 llvm-svn: 330422
* [XRay][clang] Consolidate runtime and link-time flag processing (NFC)Dean Michael Berris2018-04-061-25/+1
| | | | | | | | | | | | | | | | | | | Summary: This change fixes http://llvm.org/PR36985 to define a single place in CommonArgs.{h,cpp} where XRay runtime flags and link-time dependencies are processed for all toolchains that support XRay instrumentation. This is a refactoring of the same functionality spread across multiple toolchain definitions. Reviewers: echristo, devnexen, eizan Reviewed By: eizan Subscribers: emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D45243 llvm-svn: 329372
* FreeBSD driver / Xray flags moving pthread to compile flags.Kamil Rytarowski2018-02-221-1/+1
| | | | | | | | | | | | | | | | | | Summary: - Using -lpthread instead, with -pthread the linkage does not work. -Warning about the -fxray-instrument usage outside of the working cases. Patch by: David CARLIER Reviewers: krytarowski, vitalybuka, dberris, emaste Reviewed By: krytarowski, emaste Subscribers: srhines, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D43378 llvm-svn: 325746
* Adding msan support for FreeBSDKamil Rytarowski2018-02-151-0/+2
| | | | | | | | | | | | | | | | Summary: Enabling memory sanitiser for X86_64 arch only. To match the sanitiser counterpart. Patch by: David CARLIER Reviewers: krytarowski Reviewed By: krytarowski Subscribers: dim, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D43148 llvm-svn: 325241
* Add Xray instrumentation compile-time/link-time support to FreeBSDKamil Rytarowski2018-02-151-0/+27
| | | | | | | | | | | | | | | | Summary: Similarly to the GNU driver version, adding proper compile and linker flags. Patch by: David CARLIER Reviewers: vitalybuka, krytarowski, dberris Reviewed By: krytarowski, dberris Subscribers: emaste, dberris, cfe-commits Differential Revision: https://reviews.llvm.org/D43279 llvm-svn: 325238
* Look for 32-bit libraries in /usr/lib32 for MIPS O32 on FreeBSD.John Baldwin2018-02-121-0/+2
| | | | | | | | | | | | | | | Summary: FreeBSD N64 MIPS systems can include 32-bit libraries for O32 in /usr/lib32 similar to the 32-bit compatibility libraries provided for FreeBSD/amd64 and FreeBSD/powerpc64. Reviewers: dim Reviewed By: dim Differential Revision: https://reviews.llvm.org/D42972 llvm-svn: 324948
* Clang counterpart change for fuzzer FreeBSD supportKamil Rytarowski2018-01-151-0/+2
| | | | | | | | | | | | | | | | Summary: Providing fuzzer sanitizer support for FreeBSD (but only for X86/64 architectures). Reviewers: kimgr, EricWF, martell Reviewed By: martell Patch by David CARLIER. Subscribers: krytarowski, kimgr, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D41809 llvm-svn: 322469
* Toolchain: Normalize dwarf, sjlj and seh ehMartell Malone2017-11-291-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a re-apply of r319294. adds -fseh-exceptions and -fdwarf-exceptions flags clang will check if the user has specified an exception model flag, in the absense of specifying the exception model clang will then check the driver default and append the model flag for that target to cc1 -fno-exceptions has a higher priority then specifying the model move __SEH__ macro definitions out of Targets into InitPreprocessor behind the -fseh-exceptions flag move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check remove unused USESEHExceptions from the MinGW Driver fold USESjLjExceptions into a new GetExceptionModel function that gives the toolchain classes more flexibility with eh models Reviewers: rnk, mstorsjo Differential Revision: https://reviews.llvm.org/D39673 llvm-svn: 319297
* Revert "Toolchain: Normalize dwarf, sjlj and seh eh"Martell Malone2017-11-291-6/+6
| | | | | | | | This reverts rL319294. The windows sanitizer does not like seh on x86. Will re apply with None type for x86 llvm-svn: 319295
* Toolchain: Normalize dwarf, sjlj and seh ehMartell Malone2017-11-291-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | adds -fseh-exceptions and -fdwarf-exceptions flags clang will check if the user has specified an exception model flag, in the absense of specifying the exception model clang will then check the driver default and append the model flag for that target to cc1 clang cc1 assumes dwarf is the default if none is passed and -fno-exceptions has a higher priority then specifying the model move __SEH__ macro definitions out of Targets into InitPreprocessor behind the -fseh-exceptions flag move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check remove unused USESEHExceptions from the MinGW Driver fold USESjLjExceptions into a new GetExceptionModel function that gives the toolchain classes more flexibility with eh models Reviewers: rnk, mstorsjo Differential Revision: https://reviews.llvm.org/D39673 llvm-svn: 319294
* Introduce -nostdlib++ flag to disable linking the C++ standard library.Nico Weber2017-07-251-1/+2
| | | | | | | | | | | | | | | Projects that want to statically link their own C++ standard library currently need to pass -nostdlib or -nodefaultlibs, which also disables linking of the builtins library, -lm, and so on. Alternatively, they could use `clang` instead of `clang++`, but that already disables implicit addition of -lm on some toolchains. Add a dedicated flag -nostdlib++ that disables just linking of libc++ / libstdc++. This is analogous to -nostdinc++. https://reviews.llvm.org/D35780 llvm-svn: 308997
* [Driver] Consolidate tools and toolchains by target platform. (NFC)David L. Jones2017-03-081-0/+395
Summary: (This is a move-only refactoring patch. There are no functionality changes.) This patch splits apart the Clang driver's tool and toolchain implementation files. Each target platform toolchain is moved to its own file, along with the closest-related tools. Each target platform toolchain has separate headers and implementation files, so the hierarchy of classes is unchanged. There are some remaining shared free functions, mostly from Tools.cpp. Several of these move to their own architecture-specific files, similar to r296056. Some of them are only used by a single target platform; since the tools and toolchains are now together, some helpers now live in a platform-specific file. The balance are helpers related to manipulating argument lists, so they are now in a new file pair, CommonArgs.h and .cpp. I've tried to cluster the code logically, which is fairly straightforward for most of the target platforms and shared architectures. I think I've made reasonable choices for these, as well as the various shared helpers; but of course, I'm happy to hear feedback in the review. There are some particular things I don't like about this patch, but haven't been able to find a better overall solution. The first is the proliferation of files: there are several files that are tiny because the toolchain is not very different from its base (usually the Gnu tools/toolchain). I think this is mostly a reflection of the true complexity, though, so it may not be "fixable" in any reasonable sense. The second thing I don't like are the includes like "../Something.h". I've avoided this largely by clustering into the current file structure. However, a few of these includes remain, and in those cases it doesn't make sense to me to sink an existing file any deeper. Reviewers: rsmith, mehdi_amini, compnerd, rnk, javed.absar Subscribers: emaste, jfb, danalbert, srhines, dschuff, jyknight, nemanjai, nhaehnle, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D30372 llvm-svn: 297250
OpenPOWER on IntegriCloud