summaryrefslogtreecommitdiffstats
path: root/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
Commit message (Collapse)AuthorAgeFilesLines
* [CMake] Use correct include path for InstrProfData.inc on DarwinPetr Hosek2019-11-241-1/+4
| | | | | | | | On Darwin, part of the profile runtime is included in the builtin library. f35032e changed the location of InstrProfData.inc but the builtin build for Darwin hasn't been updated to include the new path which causes a breakage when building for Darwin. This change addresses this breakage.
* [compiler-rt] Use xcrun instead of xcodebuild to find the SDK directoryAlex Richardson2019-10-311-2/+3
| | | | | | | | | | | | | | | | | | Summary: xcodebuild does not work unless XCode is installed whereas xcrun also work when only the Command Line Tools are installed. Unlike the check for the version (D69610), this did not cause an erro for me since the fallback to /usr/include for the OSX sysroot worked. Reviewers: yln, delcypher Reviewed By: yln Subscribers: dberris, mgorny, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69659
* Fix compiler-rt build on macOS without XCodeAlex Richardson2019-10-311-2/+2
| | | | | | | | | | | | | | | | | | Summary: Starting with 8a5bfbe6db2824642bf9a1d27a24c5b6132b244f (D68292) this file unconditionally uses xcodebuild to get the SDK version. On my system this always fails with `xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance` Reviewers: delcypher, yln Reviewed By: delcypher, yln Subscribers: dberris, mgorny, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69610
* [compiler-rt] cmake: add include(BuiltinTests) to CompilerRTDarwinUtilsPuyan Lotfi2019-10-241-0/+1
| | | | | | | | | In cmake, if TEST_COMPILE_ONLY is set compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake invokes try_compile_only() but try_compile_only() is defined in BuiltinTests.cmake and is not included in CompilerRTDarwinUtils.cmake. This patch simply includes it BuiltinTests. Differential Revision: https://reviews.llvm.org/D69410
* [CMake] Disable building all Darwin libraries (except builtins) for macOS ↵Dan Liew2019-10-161-1/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | i386 when the SDK is >= 10.15. Summary: In the macOS 10.15 SDK the ability to link i386 binaries was removed and in the corresponding OS it is not possible to run macOS i386 binaries. The consequence of these changes meant that targets like `check-asan` would fail because: * Unit tests could not be linked for i386 * Lit tests for i386 would fail due to not being able to execute compiled binaries. The simplest fix to this is to simply disable building for i386 for macOS when using the 10.15 SDK (or newer). This disables building the i386 slice for most compiler-rt libraries and consequently disables the unit and lit tests for macOS i386. Note that because the `DARWIN_osx_ARCHS` CMake variable is a cache variable this patch will have no affect on existing builds unless the existing cache variable is deleted. The simplest way to deal with this is delete existing builds and just do a fresh configure. Note this should not affect the builtins which are managed with the `DARWIN_osx_BUILTIN_ARCHS` CMake cache variable. For those who wish to force using a particular set of architectures when using newer SDKs passing `-DDARWIN_osx_ARCHS=i386;x86_64;x86_64h` to CMake should provide a usable (but completely unsupported) workaround. rdar://problem/55668535 rdar://problem/47939978 Reviewers: kubamracek, yln, azhar, kcc, dvyukov, vitalybuka, cryptoad, eugenis, thakis, phosek Subscribers: mgorny, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D68292 llvm-svn: 374977
* [NFC] Invoke lipo from CMAKE_LIPO.Puyan Lotfi2019-09-241-1/+3
| | | | | | | This shouldn't change anything, except that a cmake cache file that specifies CMAKE_LIPO can specify an alternate lipo to use. llvm-svn: 372790
* Fix bug in `darwin_test_archs()` when the cache variable is set but empty.Dan Liew2019-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: If the cache variable named in `${valid_archs}` (e.g. `DARWIN_osx_BUILTIN_ARCHS`) is set in the cache but is empty then the cache check `if(${valid_archs})` will be false so the function will probe the compiler but the `set(...)` command at the end of the function to update the cache variable will be a no-op. This is because `set(...)` will not update an existing cache variable unless the `FORCE` argument is provided. To fix this this patch adds `FORCE` so the cache is always updated. rdar://problem/55323665 Reviewers: vsk, kubamracek Subscribers: mgorny, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D67530 llvm-svn: 371872
* [CMake] Separate the detection Darwin platforms architectures for theDan Liew2019-09-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | built-ins from the rest of compiler-rt. The detection of supported platform (os) architectures for Darwin relies on the `darwin_test_archs()` CMake function. This is used both for building the builtins (`builtin-config-ix.cmake`) and for the rest of the compiler-rt (`config-ix.cmake`). `darwin_test_archs()` implements a cache, presumably to speed up CMake re-configures. Unfortunately this caching is buggy because it depends on external global state (i.e. the `TEST_COMPILE_ONLY` variable) and this is not taken into account. For `config-ix.cmake` `TEST_COMPILE_ONLY` is not set and for `builtin-config-ix.cmake` `TEST_COMPILE_ONLY` is set to `On`. This makes the `darwin_test_archs()` function racey in the sense that a call from one calling context will poison the cache for the other calling context. This is actually an issue George Karpenkov discovered a while back and had an incomplete patch for (https://reviews.llvm.org/D45337) but this was never merged. To workaround this, this patch switches to using a different set of variables for the platform architecture builtins, i.e. `DARWIN_<OS>_ARCHS` -> `DARWIN_<OS>_BUILTIN_ARCHS`. This avoids the cache poisoning problem because the cached variable names are different. This also has the advantage that the the configured architectures for builtins and the rest of the compiler-rt are now independent and can be set differently if necessary. Note in `darwin_test_archs()` we also now pass `-w` to the compiler because `try_compile_only()` treats compiler warnings as errors. This was extremely fragile because compiler warnings (can easily appear due to a buggy compiler or SDK headers) would cause compiler-rt to think an architecture on Darwin wasn't supported. rdar://problem/48637491 llvm-svn: 371871
* Specify log level for CMake messages (less stderr)Stefan Granitz2019-06-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Specify message levels in CMake. Prefer STATUS (stdout). As the default message mode (i.e. level) is NOTICE in CMake, more then necessary messages get printed to stderr. Some tools, noticably ccmake treat this as an error and require additional confirmation and re-running CMake's configuration step. This commit specifies a mode (either STATUS or WARNING or FATAL_ERROR) instead of the default. * I used `csearch -f 'llvm-project/.+(CMakeLists\.txt|cmake)' -l 'message\("'` to find all locations. * Reviewers were chosen by the most common authors of specific files. If there are more suitable reviewers for these CMake changes, please let me know. Patch by: Christoph Siedentop Reviewers: zturner, beanz, xiaobai, kbobyrev, lebedev.ri, sgraenitz Reviewed By: sgraenitz Subscribers: mgorny, lebedev.ri, #sanitizers, lldb-commits, llvm-commits Tags: #sanitizers, #lldb, #llvm Differential Revision: https://reviews.llvm.org/D63370 llvm-svn: 363821
* [compiler-rt] Create install targets for Darwin librariesShoaib Meenai2019-05-071-2/+11
| | | | | | | | | | | Darwin targets were generating CMake install rules but not the corresponding install targets. Centralize the existing install target creation to a function and use that function for both Darwin and non-Darwin builds. Differential Revision: https://reviews.llvm.org/D61541 llvm-svn: 360181
* [CMake] Fix broken uses of `try_compile_only()` and improve the function.Dan Liew2019-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There were existing calls to `try_compile_only()` with arguments not prefixed by `SOURCE` or `FLAGS`. These were silently being ignored. It looks like the `SOURCE` and `FLAGS` arguments were first introduced in r278454. One implication of this is that for a builtins only build for Darwin (see `darwin_test_archs()`) it would mean we weren't actually passing `-arch <arch>` to the compiler). This would result in compiler-rt claiming all supplied architectures could be targetted provided the compiler could build for Clang's default architecture. This patch fixes this in several ways. * Fixes all incorrect calls to `try_compile_only()`. * Adds code to `try_compile_only()` to check for unhandled arguments and raises a fatal error if this occurs. This should stop any incorrect calls in the future. * Improve the documentation on `try_compile_only()` which seemed completely wrong. rdar://problem/48928526 Reviewers: beanz, fjricci, dsanders, kubamracek, yln, dcoughlin Subscribers: mgorny, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59429 llvm-svn: 356295
* [CMake] Tidy up the organisation of compiler-rt when configured as a standaloneDan Liew2018-06-271-0/+2
| | | | | | | | | | | | | | | | | | | build with an IDE (e.g. Xcode) as the generator. Previously the global `USE_FOLDERS` property wasn't set in standalone builds leading to existing settings of FOLDER not being respected. In addition to this there were several targets that appeared at the top level that were not interesting and clustered up the view. These have been changed to be displayed in "Compiler-RT Misc". Now when an Xcode project is generated from a standalone compiler-rt build the project navigator is much less cluttered. The interesting libraries should appear in "Compiler-RT Libraries" in the IDE. Differential Revision: https://reviews.llvm.org/D48378 llvm-svn: 335728
* [compiler-rt] Use CMAKE_LINKER instead of hardcoding ldShoaib Meenai2018-06-131-1/+1
| | | | | | | Respect a custom linker path provided by the user if one is present (otherwise CMAKE_LINKER will have been set to the right value by CMake). llvm-svn: 334654
* [cmake] Work around -Wunused-driver-argument warningsVedant Kumar2017-09-011-1/+14
| | | | | | | Fix the Darwin logic so that -msse3 is only used on macOS, and -fomit-frame-pointer is not used on armv7/armv7k/armv7s. llvm-svn: 312390
* [builtins] Prevent duplicate definitions for overridden functionsFrancis Ricci2017-08-301-32/+3
| | | | | | | | | | | | | | | Summary: Some architecture-specific function overrides (for example, i386/ashrdi3.S) duplicate generic functions (in that case, ashrdi3.c). Prevent duplicate definitions by filtering out the generic files before compiling. Reviewers: compnerd, beanz Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D37166 llvm-svn: 312140
* Fix the declaration of DARWIN_PREFER_PUBLIC_SDK cmake variable (move before ↵Kuba Mracek2017-07-121-1/+2
| | | | | | the return). llvm-svn: 307815
* [cmake] Cache results of find_darwin_sdk_dirKuba Mracek2017-07-071-0/+6
| | | | | | | | This improves find_darwin_sdk_dir to cache the results of executing xcodebuild to find the SDK. Should significantly reduce the CMake re-configure time. Differential Revision: https://reviews.llvm.org/D34736 llvm-svn: 307344
* [cmake] Add an option to prefer public SDK in find_darwin_sdk_dirKuba Mracek2017-07-061-8/+11
| | | | | | | | Adds a CMake option DARWIN_PREFER_PUBLIC_SDK, off by default. When on, this prefers to use the public SDK, even when an internal one is present. With this, it's easy to emulate a build that the public buildbots are doing. Differential Revision: https://reviews.llvm.org/D35071 llvm-svn: 307330
* [compiler-rt] respect CMAKE_EXE_LINKER_FLAGS in compiler and library testsBob Haarman2017-03-211-1/+3
| | | | | | | | | | | | | | Summary: check_cxx_compiler_flag and check_library_exists could fail because they ignored CMAKE_EXE_LINKER_FLAGS and therefore would always fail to produce executables. Cmake policy CMP0056 fixes this, but was explicitly set to OLD in our CMakeLists because it caused problems with test_target_arch. This change sets the policy to NEW to fix the problem with the compiler and library tests, and temporarily clears CMAKE_EXE_LINKER_FLAGS inside test_target_arch to emulate the old behavior there. This allows, for example, LTO builds that require lld to succeed. Reviewers: davidxl, beanz Reviewed By: beanz Subscribers: fjricci, dberris, mgorny, mehdi_amini, tejohnson, rnk, llvm-commits Differential Revision: https://reviews.llvm.org/D31098 llvm-svn: 298413
* Make cmake link flag naming consistentFrancis Ricci2017-01-101-1/+1
| | | | | | | | | | | | | | | | | | | Summary: The build system was inconsistent in its naming conventions for link flags. This patch changes all uses of LINKFLAGS to LINK_FLAGS, for consistency with cmake's LINK_FLAGS property. This patch should make it easier to search the source code for uses of link flags, as well as providing the benefit of improved style and consistency. Reviewers: compnerd, beanz Subscribers: kubabrecka, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28506 llvm-svn: 291539
* [CMake] Support building on OS X without Xcode installationChris Bieneman2016-08-191-2/+6
| | | | | | | | This should resolve PR23162. This patch has two parts. First we need to check the error code from xcodebuild when querying for SDKs, second if the OS X SDK is not discovered, we ensure that /usr/include exists and use / as the OS X sysroot. llvm-svn: 279336
* [CMake] Stop building eprintf library on DarwinChris Bieneman2016-08-181-26/+0
| | | | | | In r278988 clang stopped using the eprintf library, so we should stop generating it too. llvm-svn: 279090
* [CMake] Converting darwin_test_archs simple source to CChris Bieneman2016-06-221-3/+3
| | | | | | Using C instead of CXX here removes a configuration-time dependency on libcxx for the sanitizers. This should be NFC. llvm-svn: 273505
* [CMake] NFC. Add support for testing the compiler without testing the linkerChris Bieneman2016-05-031-13/+19
| | | | | | | | | | | | | | | | | | | Summary: One of the big limitations we have in the compiler-rt build system today is that we cannot bootstrap building the builtins because you need a fully functional toolchain to pass CMake's tests. This change adds support for compile only tests. It is NFC because nothing is using the compile-only tests yet. I believe this is the last separable part of D16653. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19692 llvm-svn: 268427
* [CMake] Adding another missing include. NFC.Chris Bieneman2016-04-281-0/+2
| | | | | | This also works fine today, but will break with my upcoming refactoring. llvm-svn: 267941
* [CMake] [PR27403] Fix COMPILER_RT_ENABLE_IOS when using Xcode from the App ↵Chris Bieneman2016-04-261-0/+2
| | | | | | | | | | Store. This change modifies find_darwin_sdk_dir to set a variable if a Darwin "Internal" SDK is present which allows CMake to disable components that require internal-only APIs. This mechanism is then used to disable TSan when an internal SDK is not present. llvm-svn: 267575
* [asan] Add iOS support.Anna Zaks2016-02-021-1/+1
| | | | llvm-svn: 259451
* [compiler-rt] list_union() is actually an intersect operation. Rename it.Daniel Sanders2016-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: Given: set(T1 a b c) set(T2 b c d) message("T1=${T1}") message("T2=${T2}") list_union(T3 T1 T2) message("T3=${T3}") cmake emitted: T1=a;b;c T2=b;c;d T3=b;c Reviewers: beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16580 llvm-svn: 258916
* [cmake] Indentation fix (NFC)Vedant Kumar2016-01-081-1/+1
| | | | llvm-svn: 257118
* [cmake] Add InstrProfilingWriter to libclang_rt on DarwinVedant Kumar2016-01-071-1/+2
| | | | | | | | | llvmBufferWriter and a few related symbols were missing from libclang_rt on Darwin (PR26002). This should fix the problem. Patch by Dan Peebles! llvm-svn: 257110
* [CMake] [Darwin] Log architecture test failures to CMakeError.logChris Bieneman2015-12-101-0/+4
| | | | | | This makes debugging configuration issues way easier. llvm-svn: 255183
* [sanitizer] Cache results of darwin_test_archsKuba Brecka2015-12-031-1/+7
| | | | | | | | For OS X builds of compiler-rt, we run `darwin_test_archs` to determine which architectures can the toolchain target. This detection takes quite a long time, and the result is always the same (as long as you don't upgrade your OS, system headers or toolchain). Let's cache the result. Differential Revision: http://reviews.llvm.org/D15179 llvm-svn: 254618
* [CMake] [Darwin] libclang_rt.eprintf should be built with the same CFLAGS as ↵Chris Bieneman2015-11-251-2/+9
| | | | | | the other darwin builtin libraries. llvm-svn: 254082
* [compiler-rt][cmake] Fix not lipo libclang_rt.cc_kext.a when building on OS XChris Bieneman2015-11-201-81/+79
| | | | | | | | | | | | | | | | Summary: Fix r252525 - cmake configure failed to connect target builtins to target compiler-rt because of early return call. Patch by: Jacky Tsao (cao.zhong1) Reviewers: beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14747 llvm-svn: 253692
* [CMake] [macho_embedded] [builtins] Always use OS X sysroot, even for arm.Chris Bieneman2015-11-131-3/+0
| | | | | | Turns out that there are some checks in the backend that change code generation for armv7 if you are building against an iOS sys root. For the macho_embedded builtins we really don't want that. llvm-svn: 253064
* [CMake] [Darwin] Forcing -fPIC on for all darwin builtins except macho_embeddedChris Bieneman2015-11-121-1/+2
| | | | | | We need to add -fPIC to the flags for the builtins in case PIC was turned off at a higher level. We also want to set ENABLE_PIC to Off when building the macho_embedded builtins so the top-level settings don't impact that build. llvm-svn: 252966
* [CMake] [Darwin] [Builtins] Force setting the flags we care about at the end ↵Chris Bieneman2015-11-111-9/+11
| | | | | | | | of the compiler command line Setting CMAKE_*_FLAGS isn't sufficient here because CMAKE_*_FLAGS_${CMAKE_BUILD_TYPE} can override the flags, and there is no way to safely clear that because it is a cached variable (<sarcasm> YAY! </sarcasm>). llvm-svn: 252807
* [CMake] [macho_embedded] Only set sys root if the variable is set, this ↵Chris Bieneman2015-11-101-1/+5
| | | | | | | | prevents passing empty -isysroot arguments This is a minor cleanup to the macho_embedded builtins. llvm-svn: 252619
* [CMake] Cleaning up flags for Darwin builtinsChris Bieneman2015-11-101-23/+4
| | | | | | | * Setting CMAKE_*_FLAGS_${BUILD_TYPE} isn't really needed since we're setting the same value everywhere * functions sanitize variables differently from macros, darwin_add_embedded_builtin_libraries should be a macro otherwise it won't alter the variables. llvm-svn: 252618
* [CMake] Temporary workaround to support building builtins on darwin with a ↵Chris Bieneman2015-11-101-3/+18
| | | | | | | | toolchain that may not support all x86 and arm architectures. This is at least a little better than my first attempt. We still really need a way to do compile checks without linking. llvm-svn: 252572
* Revert "[CMake] [macho_embedded] Check to make sure the compiler supports ↵Chris Bieneman2015-11-101-13/+1
| | | | | | | | the architectures before generating build targets" This commit reverts r252525. I was not really thinking about this fix properly. This doesn't work because it relys on try_compile checks which do a full compile & link. I'm going to put in a temporary solution as an interm step until we have a way to perform compiler checks without linking. llvm-svn: 252569
* [CMake] Don't pass -fPIC when compiling the darwin builtinsChris Bieneman2015-11-091-1/+1
| | | | | | This change makes CMake match autoconf. llvm-svn: 252547
* [CMake] Fixing a typo in variable name ARG_*->LIB_*Chris Bieneman2015-11-091-1/+1
| | | | llvm-svn: 252543
* [CMake] Removing extra underscore.Chris Bieneman2015-11-091-1/+1
| | | | | | Fixing a typo. llvm-svn: 252534
* [CMake] [Darwin] Don't generate lipo commands if we don't have libraries to ↵Chris Bieneman2015-11-091-12/+16
| | | | | | | | put into the fat archive. Not making sure there are thin libraries results in some difficult to diagnose build failures. This check should make those build failures go away. llvm-svn: 252527
* [CMake] [macho_embedded] Check to make sure the compiler supports the ↵Chris Bieneman2015-11-091-1/+13
| | | | | | | | architectures before generating build targets If we don't check the compiler's capabilities we end up generating build targets that the compiler might not be able to build. llvm-svn: 252525
* [CMake] Need to filter ${arch}/*.c builtins as well as ${arch}/*.S builtins.Chris Bieneman2015-11-061-1/+1
| | | | | | This was broken in r248542 when I refactored this to support builtins where ${arch} didn't match the directory prefix (i.e. armv7s). llvm-svn: 252365
* [CMake] Adding support for generating libclang_rt.eprintf.aChris Bieneman2015-10-091-0/+19
| | | | | | This library provides eprintf for i386 on OS X versions later than 10.4. llvm-svn: 249913
* [CMake] [Darwin] [builtins] Need to special case the naming of the OS X ↵Chris Bieneman2015-10-091-1/+5
| | | | | | cc_kext builtin library. llvm-svn: 249870
* [CMake] [darwin] Removing a line of debug code that I accidentally committed.Chris Bieneman2015-10-041-1/+0
| | | | llvm-svn: 249278
OpenPOWER on IntegriCloud