summaryrefslogtreecommitdiff
path: root/sdk/cc_sdk_test.go
diff options
context:
space:
mode:
author Jiyong Park <jiyong@google.com> 2021-03-16 17:15:53 +0900
committer Jiyong Park <jiyong@google.com> 2021-03-23 01:18:31 +0900
commita008fb08cf5e50baef8ee612feba5104de536393 (patch)
tree830ccca9281c5246e9faaaa77f160e9b482868d1 /sdk/cc_sdk_test.go
parent2b077baa5e4472b3966e33f96a925fd7a0ef543e (diff)
Always respect min_sdk_version
Background: When compiling cc_* modules, min_sdk_version determines the "version" part of the clang triple: -target <arch>-linux-android<version>. The version part is used to make sure that calls to the APIs that are added after the version are guarded with a runtime check (i.e. __builtin_available). Previously, min_sdk_version was used as the version part only when the cc_* module is unbundled (e.g. built for an APEX or built with SDK). In other words, min_sdk_version has been ignored for the platform variants. They were built with the version number 10000. This was problematic for Mainline module tests. Since they are neither part of an APEX nor built with SDK (because they need to have access to some of the module-only APIs), they are built with the version number 10000. As a side effect, __builtin_available macro are expanded to 1 at build time - because 10000 is higher than any API versions. When such a test built in the latest platform source tree runs on a device running an old platform, it tries to call an API that might not be available on the platform and experience a crash, due to the lack of the runtime check. This change fixes the problem by using min_sdk_version as the "version" part of the clang triple, regardless of the module's variant. Then __builtin_available macro in the tests doesn't expand to 1, but to a function call to the libclang_rt.builtin library which checks the system property ro.build.version.sdk. Bug: N/A Test: run resolv_stress_test Change-Id: I88f64c5a35f1b5276c3350e177b116932011a940
Diffstat (limited to 'sdk/cc_sdk_test.go')
0 files changed, 0 insertions, 0 deletions