ANDROID: more KABI macros for gendwarfksyms

gendwarfksyms now supports the hiding of:

* type size changes
* arbitrary type definition and symbol type changes

This change introduces two new macros:

* ANDROID_KABI_BYTE_SIZE(name, bytes_size)
* ANDROID_KABI_TYPE_STRING("s#foo", "symtype definition")

Bug: 400972353
Change-Id: Ib8da78ba7dd6ec50de3cef7594d7cfe500c7dba5
Signed-off-by: Giuliano Procida <gprocida@google.com>
This commit is contained in:
Giuliano Procida
2025-05-28 13:18:36 +01:00
committed by Treehugger Robot
parent 2c69381349
commit e97af2a2f5

View File

@@ -42,11 +42,14 @@
* Worker macros, don't use these, use the ones without a leading '_'
*/
#define _ANDROID_KABI_RULE(hint, target, value) \
#define __ANDROID_KABI_RULE(hint, target, value) \
static const char CONCATENATE(__gendwarfksyms_rule_, \
__COUNTER__)[] __used __aligned(1) \
__section(".discard.gendwarfksyms.kabi_rules") = \
"1\0" #hint "\0" #target "\0" #value
"1\0" #hint "\0" target "\0" value
#define _ANDROID_KABI_RULE(hint, target, value) \
__ANDROID_KABI_RULE(hint, #target, #value)
#define _ANDROID_KABI_NORMAL_SIZE_ALIGN(_orig, _new) \
union { \
@@ -120,6 +123,22 @@
#define ANDROID_KABI_ENUMERATOR_VALUE(fqn, field, value) \
_ANDROID_KABI_RULE(enumerator_value, fqn field, value)
/*
* ANDROID_KABI_BYTE_SIZE(fqn, value)
* Set the byte_size attribute for the struct/union/enum fqn to
* value bytes.
*/
#define ANDROID_KABI_BYTE_SIZE(fqn, value) \
_ANDROID_KABI_RULE(byte_size, fqn, value)
/*
* ANDROID_KABI_TYPE_STRING(type, str)
* For the given type, override the type string used in symtypes
* output and version calculation with str.
*/
#define ANDROID_KABI_TYPE_STRING(type, str) \
__ANDROID_KABI_RULE(type_string, type, str)
/*
* ANDROID_KABI_IGNORE
* Add a new field that's ignored in versioning.