From 43978a0a342936dbd8bbc28292824524d9e2253a Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 7 Jan 2021 17:15:41 -0800 Subject: [PATCH] Fix things so that can be used from assembler again. Bug: https://github.com/android/ndk/issues/1422 Test: builds Change-Id: I1b94ffe688f3d420533074c94f7ffed606ca923f --- libc/include/android/api-level.h | 7 ++++++- libc/private/bionic_asm.h | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h index bcddddd59..40846fb8b 100644 --- a/libc/include/android/api-level.h +++ b/libc/include/android/api-level.h @@ -151,6 +151,9 @@ __BEGIN_DECLS /** Names the "S" API level (31), for comparison against `__ANDROID_API__`. */ #define __ANDROID_API_S__ 31 +/* This file is included in , and might be used from .S files. */ +#if !defined(__ASSEMBLY__) + /** * Returns the `targetSdkVersion` of the caller, or `__ANDROID_API_FUTURE__` if * there is no known target SDK version (for code not running in the context of @@ -167,7 +170,7 @@ int android_get_application_target_sdk_version() __INTRODUCED_IN(24); #if __ANDROID_API__ < 29 -// android_get_device_api_level is a static inline before API level 29. +/* android_get_device_api_level is a static inline before API level 29. */ #define __BIONIC_GET_DEVICE_API_LEVEL_INLINE static __inline #include #undef __BIONIC_GET_DEVICE_API_LEVEL_INLINE @@ -185,6 +188,8 @@ int android_get_device_api_level() __INTRODUCED_IN(29); #endif +#endif /* defined(__ASSEMBLY__) */ + __END_DECLS /** @} */ diff --git a/libc/private/bionic_asm.h b/libc/private/bionic_asm.h index 6d4f7d52c..d68a2d604 100644 --- a/libc/private/bionic_asm.h +++ b/libc/private/bionic_asm.h @@ -26,8 +26,10 @@ * SUCH DAMAGE. */ -#ifndef _PRIVATE_BIONIC_ASM_H_ -#define _PRIVATE_BIONIC_ASM_H_ +#pragma once + +/* https://github.com/android/ndk/issues/1422 */ +#include #include /* For system call numbers. */ #define MAX_ERRNO 4095 /* For recognizing system call error returns. */ @@ -86,5 +88,3 @@ #define NOTE_GNU_PROPERTY() \ __bionic_asm_custom_note_gnu_section() - -#endif