Merge "Make .note.android.ident section type SH_NOTE"
This commit is contained in:
commit
150403caa8
|
@ -1179,8 +1179,10 @@ $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src
|
|||
# special for arm
|
||||
LOCAL_NO_CRT_arm := true
|
||||
LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
|
||||
LOCAL_ASFLAGS_arm += $(libc_crt_target_cflags)
|
||||
LOCAL_SRC_FILES_arm += \
|
||||
arch-common/bionic/crtbegin_so.c \
|
||||
arch-common/bionic/crtbrand.S \
|
||||
arch-arm/bionic/atexit_legacy.c \
|
||||
arch-common/bionic/crtend_so.S
|
||||
LOCAL_ADDRESS_SANITIZER := false
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.section .note.android.ident,"a",%note
|
||||
.align 2
|
||||
.type abitag, %object
|
||||
abitag:
|
||||
.long 2f-1f /* int32_t namesz */
|
||||
.long 3f-2f /* int32_t descsz */
|
||||
.long 1 /* int32_t type */
|
||||
1: .ascii "Android\0" /* char name[] */
|
||||
2: .long PLATFORM_SDK_VERSION /* int32_t android_api */
|
||||
3:
|
||||
.size abitag, .-abitag
|
|
@ -1,48 +0,0 @@
|
|||
/*-
|
||||
* Copyright 2000 David E. O'Brien, John D. Polstra.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define ABI_VENDOR "Android"
|
||||
#define ABI_SECTION ".note.android.ident"
|
||||
#define ABI_NOTETYPE 1
|
||||
#define ABI_ANDROID_API PLATFORM_SDK_VERSION
|
||||
|
||||
/*
|
||||
* Special ".note" entry to tag an Android binary and specify the ABI version.
|
||||
*/
|
||||
static const struct {
|
||||
int32_t namesz;
|
||||
int32_t descsz;
|
||||
int32_t type;
|
||||
char name[sizeof ABI_VENDOR];
|
||||
int32_t android_api;
|
||||
} abitag __attribute__ ((section (ABI_SECTION), aligned(4), used)) = {
|
||||
sizeof ABI_VENDOR,
|
||||
sizeof(int32_t),
|
||||
ABI_NOTETYPE,
|
||||
ABI_VENDOR,
|
||||
ABI_ANDROID_API,
|
||||
};
|
31
libc/crt.mk
31
libc/crt.mk
|
@ -31,18 +31,19 @@ my_libc_crt_target_so_cflags := \
|
|||
|
||||
my_libc_crt_target_ldflags := $(libc_crt_target_ldflags_$(my_arch))
|
||||
|
||||
|
||||
# crtbrand.S -> crtbrand.o
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
|
||||
$(GEN): PRIVATE_CC := $($(my_2nd_arch_prefix)TARGET_CC)
|
||||
$(GEN): PRIVATE_CFLAGS := $(my_libc_crt_target_so_cflags)
|
||||
$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
|
||||
$(GEN): $(LOCAL_PATH)/arch-common/bionic/crtbrand.S
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) $(PRIVATE_CC) $(PRIVATE_CFLAGS) \
|
||||
-MD -MF $(@:%.o=%.d) -o $@ -c $<
|
||||
$(transform-d-to-p)
|
||||
-include $(GEN:%.o=%.P)
|
||||
|
||||
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
|
||||
# crtbegin_so.c -> crtbegin_so1.o
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so1.o
|
||||
$(GEN): PRIVATE_CC := $($(my_2nd_arch_prefix)TARGET_CC)
|
||||
$(GEN): PRIVATE_CFLAGS := $(my_libc_crt_target_so_cflags)
|
||||
$(GEN): $(my_libc_crt_target_crtbegin_so_file)
|
||||
|
@ -52,7 +53,16 @@ $(GEN): $(my_libc_crt_target_crtbegin_so_file)
|
|||
$(transform-d-to-p)
|
||||
-include $(GEN:%.o=%.P)
|
||||
|
||||
# crtbegin_so1.o + crtbrand.o -> crtbegin_so.o
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
|
||||
$(GEN): PRIVATE_LD := $($(my_2nd_arch_prefix)TARGET_LD)
|
||||
$(GEN): PRIVATE_LDFLAGS := $(my_libc_crt_target_ldflags)
|
||||
$(GEN): $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so1.o \
|
||||
$($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) $(PRIVATE_LD) $(PRIVATE_LDFLAGS) -r -o $@ $^
|
||||
|
||||
# crtend_so.S -> crtend_so.o
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
|
||||
$(GEN): PRIVATE_CC := $($(my_2nd_arch_prefix)TARGET_CC)
|
||||
$(GEN): PRIVATE_CFLAGS := $(my_libc_crt_target_so_cflags)
|
||||
|
@ -63,8 +73,7 @@ $(GEN): $(LOCAL_PATH)/arch-common/bionic/crtend_so.S
|
|||
$(transform-d-to-p)
|
||||
-include $(GEN:%.o=%.P)
|
||||
|
||||
|
||||
# The following two are installed to device
|
||||
# crtbegin_so.o and crtend_so.o are installed to device
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
|
||||
$(GEN): $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
|
||||
$(hide) mkdir -p $(dir $@) && cp -f $< $@
|
||||
|
@ -75,7 +84,7 @@ $(GEN): $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
|
|||
$(hide) mkdir -p $(dir $@) && cp -f $< $@
|
||||
ALL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
|
||||
# crtbegin.c -> crtbegin_static1.o
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o
|
||||
$(GEN): PRIVATE_CC := $($(my_2nd_arch_prefix)TARGET_CC)
|
||||
$(GEN): PRIVATE_CFLAGS := $(my_libc_crt_target_cflags)
|
||||
|
@ -86,7 +95,7 @@ $(GEN): $(my_libc_crt_target_crtbegin_file)
|
|||
$(transform-d-to-p)
|
||||
-include $(GEN:%.o=%.P)
|
||||
|
||||
|
||||
# crtbegin_static1.o + crtbrand.o -> crtbegin_static.o
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
|
||||
$(GEN): PRIVATE_LD := $($(my_2nd_arch_prefix)TARGET_LD)
|
||||
$(GEN): PRIVATE_LDFLAGS := $(my_libc_crt_target_ldflags)
|
||||
|
@ -95,7 +104,7 @@ $(GEN): $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_stati
|
|||
@mkdir -p $(dir $@)
|
||||
$(hide) $(PRIVATE_LD) $(PRIVATE_LDFLAGS) -r -o $@ $^
|
||||
|
||||
|
||||
# crtbegin.c -> crtbegin_dynamic1.o
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
|
||||
$(GEN): PRIVATE_CC := $($(my_2nd_arch_prefix)TARGET_CC)
|
||||
$(GEN): PRIVATE_CFLAGS := $(my_libc_crt_target_cflags)
|
||||
|
@ -106,7 +115,7 @@ $(GEN): $(my_libc_crt_target_crtbegin_file)
|
|||
$(transform-d-to-p)
|
||||
-include $(GEN:%.o=%.P)
|
||||
|
||||
|
||||
# crtbegin_dynamic1.o + crtbrand.o -> crtbegin_dynamic.o
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
|
||||
$(GEN): PRIVATE_LD := $($(my_2nd_arch_prefix)TARGET_LD)
|
||||
$(GEN): PRIVATE_LDFLAGS := $(my_libc_crt_target_ldflags)
|
||||
|
@ -115,7 +124,7 @@ $(GEN): $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynam
|
|||
@mkdir -p $(dir $@)
|
||||
$(hide) $(PRIVATE_LD) $(PRIVATE_LDFLAGS) -r -o $@ $^
|
||||
|
||||
|
||||
# crtend.S -> crtend_android.o
|
||||
# We rename crtend.o to crtend_android.o to avoid a
|
||||
# name clash between gcc and bionic.
|
||||
GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
|
||||
|
|
Loading…
Reference in New Issue