[PATCH] D58578: [CMake] Fix the value of `config.target_cflags` for non-macOS Apple platforms.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 23 05:28:50 PST 2019


delcypher created this revision.
delcypher added reviewers: kubamracek, yln, vsk.
Herald added subscribers: Sanitizers, jdoerfert, kristof.beyls, javed.absar, mgorny.
Herald added projects: Sanitizers, LLVM.

The main problem here is that `-*-version_min=` was not being passed to
the compiler when building test cases. This can cause problems when
testing on devices running older OSs because Clang would previously
assume the minimum deployment target is the the latest OS in the SDK
which could be much newer than what the device is running.

Previously the generated value looked like this:

`-arch arm64 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`

With this change it now looks like:

`-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`

This mirrors the setting of `config.target_cflags` on macOS.

This change is made for ASan, LibFuzzer, TSan, and UBSan.

To implement this a new `get_test_cflags_for_apple_platform()` function
has been added that when given an Apple platform name and architecture
returns a string containing the C compiler flags to use when building
tests. This also calls a new helper function `is_valid_apple_platform()`
that validates Apple platform names.

rdar://problem/48198646


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58578

Files:
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/test/asan/CMakeLists.txt
  compiler-rt/test/fuzzer/CMakeLists.txt
  compiler-rt/test/tsan/CMakeLists.txt
  compiler-rt/test/ubsan/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58578.188042.patch
Type: text/x-patch
Size: 5637 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190223/7b7a991b/attachment.bin>


More information about the llvm-commits mailing list