aboutsummaryrefslogtreecommitdiffstats
path: root/libc/crt.mk
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-02-12 17:03:22 -0800
committerColin Cross <ccross@android.com>2015-02-12 21:37:20 -0800
commite09ab2cc2ff41ce7519c143d448371ddd62afc59 (patch)
tree27aeb6b9af0e2cee7200e1683a9650f013b49396 /libc/crt.mk
parentf9fb52ab309c97d5b2ef4f8e1daff3eed4cf4024 (diff)
downloadandroid_bionic-e09ab2cc2ff41ce7519c143d448371ddd62afc59.tar.gz
android_bionic-e09ab2cc2ff41ce7519c143d448371ddd62afc59.tar.bz2
android_bionic-e09ab2cc2ff41ce7519c143d448371ddd62afc59.zip
Make .note.android.ident section type SH_NOTE
The .note.android.ident section is only used by GDB, which doesn't care what section type the section is, but it would be convenient for readelf -n to be able to find the section too. The old way of getting the .note.android.ident section to be of type SH_NOTE involved compiling from .c to .s using gcc, running sed to change progbits to note, and then compiling from .s to .o using gcc. Since crtbrand.c only contains a section containing data, a crtbrand.S can be checked in that will compile on all platforms, avoiding the need for sed. Also add crtbrand.o to crtbegin_so.o so that libraries also get the note, and to the crt workaround in arm libc.so. Change-Id: Ica71942a6af4553b56978ceaa288b3f4c15ebfa2
Diffstat (limited to 'libc/crt.mk')
-rw-r--r--libc/crt.mk31
1 files changed, 20 insertions, 11 deletions
diff --git a/libc/crt.mk b/libc/crt.mk
index 410f229db..63653322e 100644
--- a/libc/crt.mk
+++ b/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