summaryrefslogtreecommitdiffstats
path: root/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake
Commit message (Collapse)AuthorAgeFilesLines
* [libcxx] cmake - guard list removeBrian Cain2019-05-021-4/+6
| | | | | | | REMOVE_ITEM fails if CMAKE_REQUIRED_LIBRARIES is empty on some versions of cmake. llvm-svn: 359755
* Support tests in freestandingJF Bastien2019-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* [libcxx][cmake] Remove libatomic temporarily from CMAKE_REQUIRED_LIBRARIES ↵Simon Dardis2018-04-041-0/+7
| | | | | | | | | | | | | | | | | | | | | | | when configuring When libcxx is built in tree for a host which requires libatomic, LLVM's configuration steps will determine it is required and add it to CMAKE_REQUIRED_LIBRARIES. When libcxx is later configured, it tests if it has C++ atomics without libatomic. The test erroneously passes as libatomic is already part of the set of required libraries. In turn, a number of the atomic tests will fail as they require libatomic but the test suite is configured not to use libatomic. Address this by always dropping libatomic from the set of required libraries before determining if LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB is true, then restoring the set of required libraries. Reviewers: EricWF Differential Revision: https://reviews.llvm.org/D43509 llvm-svn: 329167
* [cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ↵Don Hinton2018-01-231-1/+1
| | | | | | | | ones. * Previously part of https://reviews.llvm.org/D41622. llvm-svn: 323171
* Fix libc++ configuration with -fsanitize-coverageIvan Krasin2016-09-011-0/+3
| | | | | | | | | | | | | | | | | | Summary: a recent change (r280015) in libc++ configuration broke LibFuzzer bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/12245 It's not restricted just to that bot; any code that uses the sanitize coverage and configures libc++ hits it. This CL fixes the issue. Reviewers: compnerd Subscribers: aizatsky Differential Revision: https://reviews.llvm.org/D24116 llvm-svn: 280335
* libc++: perform configuration checks with -nodefaultlibsSaleem Abdulrasool2016-08-291-1/+4
| | | | | | | | | | | | | | | | | | We're compiling libc++ with -nodefaultlibs, so we should also pass this option during the configuration checks to ensure those checks are consistent with the actual build. The primary motivation here is to ease cross-compilation against a non-standard set of C++ libraries. Previously, the configuration checks would attempt to link against the standard C++ libraries, which would cause link failures when cross-compiling, even though the actual library link would go through correctly (because of the use of -nodefaultlibs and explicitly specifying any needed libraries). This is more correct even ignoring the motivation, however. Patch by Shoaib Meenai! llvm-svn: 280015
* Rework libatomic handling in CMake and LIT.Eric Fiselier2016-07-181-1/+1
| | | | | | | | | | | | | | | This patch updates the way libc++ handles checking for libatomic, in part to prepare for https://reviews.llvm.org/D22073. Changes: * 'LIBCXX_HAS_ATOMIC_LIB' is now set whenever libatomic is available even libc++ doesn't need to manually link it. * 'LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB' is now used to detect when libatomic needs to be manually linked. * 'LIBCXX_HAS_ATOMIC_LIB' now adds 'libatomic' as a available feature in the test suite. llvm-svn: 275759
* Fix PR26622 - Make CheckLibcxxAtomic.cmake use the libc++ headers.Eric Fiselier2016-02-201-2/+2
| | | | llvm-svn: 261383
* Issue a warning instead of fatal errors when checks for libatomic fail.Vasileios Kalintiris2016-02-161-2/+2
| | | | | | | | | | | | This should fix PR26631, PR26622 and has the nice property that the addition of the CheckLibcxxAtomic.cmake module acts as an NFC on the platforms of the reporters (at least for the time being). As these bug reports explain, CMake fails the atomic check because the include headers might not exist in the host environment. We could potentially point to the headers provided by libcxx itself. llvm-svn: 260961
* Rename CheckLibcxxAtomic.cmake variable result names so they don't clash ↵Eric Fiselier2016-02-111-2/+2
| | | | | | with LLVM llvm-svn: 260531
* Fix r260515 - Correct typos in CMake changesEric Fiselier2016-02-111-4/+4
| | | | llvm-svn: 260524
* Re-commit "Introduce a cmake module to figure out whether we need to link ↵Vasileios Kalintiris2016-02-111-0/+41
| | | | | | | | | | with libatomic." This re-applies commit r260235. However, this time we add -gcc-toolchain to the compiler's flags when the user has specified the LIBCXX_GCC_TOOLCHAIN variable. llvm-svn: 260515
* Revert "Introduce a cmake module to figure out whether we need to link with ↵Vasileios Kalintiris2016-02-091-38/+0
| | | | | | | | | | | libatomic." This reverts commit r260235. It breaks LLVM's bootstrap when building with a -gcc-toolchain and the system's gcc installation does not provide the libatomic library and its headers. We should check whether LIBCXX_GCC_TOOLCHAIN is set and adjust the flags accordingly. llvm-svn: 260323
* Introduce a cmake module to figure out whether we need to link with libatomic.Vasileios Kalintiris2016-02-091-0/+38
Summary: This fixes the tests under std/atomics for 32-bit MIPS CPUs where the 8-byte atomic operations call into the libatomic library. Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D16613 llvm-svn: 260235
OpenPOWER on IntegriCloud