Merge "Fix the size of the NDK .note.android.ident ELF note." am: 5466951c8b
am: a9d394d070
Change-Id: Id245a6ad8ebe0317cfb30393a790745edbf70f6b
This commit is contained in:
@@ -23,6 +23,8 @@
|
|||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO: this file should just be a .S file like bionic's crtbrand.
|
||||||
|
|
||||||
/* The following trick defines int32_t w/o including <stdint.h>
|
/* The following trick defines int32_t w/o including <stdint.h>
|
||||||
We want "int" to be 4-byte. But just in case it isn't, the following
|
We want "int" to be 4-byte. But just in case it isn't, the following
|
||||||
line turns into "typedef int int32_t[0]" and later fails with error messages
|
line turns into "typedef int int32_t[0]" and later fails with error messages
|
||||||
@@ -36,42 +38,20 @@ typedef int int32_t[sizeof(int) == 4];
|
|||||||
#define ABI_SECTION ".note.android.ident"
|
#define ABI_SECTION ".note.android.ident"
|
||||||
#define ABI_NOTETYPE 1
|
#define ABI_NOTETYPE 1
|
||||||
#define ABI_ANDROID_API PLATFORM_SDK_VERSION
|
#define ABI_ANDROID_API PLATFORM_SDK_VERSION
|
||||||
#define ABI_NDK_VERSION "%NDK_VERSION%"
|
|
||||||
#define ABI_NDK_BUILD_NUMBER "%NDK_BUILD_NUMBER%"
|
|
||||||
|
|
||||||
#define NDK_RESERVED_SIZE 64
|
#define NDK_RESERVED_SIZE 64
|
||||||
|
|
||||||
#define L 9999
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Special ".note" entry to tag an Android binary and specify the ABI version.
|
|
||||||
*
|
|
||||||
* For all arches except sparc, gcc emits the section directive for the
|
|
||||||
* following struct with a PROGBITS type. However, the section should be
|
|
||||||
* of NOTE type, according to the Generic SysV ABI spec.
|
|
||||||
*
|
|
||||||
* Unfortunately, there is no clean way to tell gcc to use another section type,
|
|
||||||
* so this C file (or the C file that includes it) must be compiled in multiple
|
|
||||||
* steps:
|
|
||||||
*
|
|
||||||
* - Compile the .c file to a .s file.
|
|
||||||
* - Edit the .s file to change the 'progbits' type to 'note', for the section
|
|
||||||
* directive that defines the .note.ABI-tag section.
|
|
||||||
* - Compile the .s file to an object file.
|
|
||||||
*
|
|
||||||
* These steps are done in the invididual Makefiles for each applicable arch.
|
|
||||||
*/
|
|
||||||
static const struct {
|
static const struct {
|
||||||
int32_t namesz;
|
int32_t namesz;
|
||||||
int32_t descsz;
|
int32_t descsz;
|
||||||
int32_t type;
|
int32_t type;
|
||||||
char name[sizeof ABI_VENDOR];
|
char name[sizeof(ABI_VENDOR)];
|
||||||
int32_t android_api;
|
int32_t android_api;
|
||||||
char ndk_version[NDK_RESERVED_SIZE];
|
char ndk_version[NDK_RESERVED_SIZE];
|
||||||
char ndk_build_number[NDK_RESERVED_SIZE];
|
char ndk_build_number[NDK_RESERVED_SIZE];
|
||||||
} abitag __attribute__ ((section (ABI_SECTION), aligned(4), used)) = {
|
} abitag __attribute__ ((section (ABI_SECTION), aligned(4), used)) = {
|
||||||
sizeof ABI_VENDOR,
|
sizeof(ABI_VENDOR),
|
||||||
sizeof(int32_t),
|
sizeof(int32_t) + NDK_RESERVED_SIZE + NDK_RESERVED_SIZE,
|
||||||
ABI_NOTETYPE,
|
ABI_NOTETYPE,
|
||||||
ABI_VENDOR,
|
ABI_VENDOR,
|
||||||
ABI_ANDROID_API,
|
ABI_ANDROID_API,
|
||||||
|
|||||||
Reference in New Issue
Block a user