From 24958ae4efd70d5ef36d93d2d2bcca38ad340395 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 11 Feb 2015 17:40:45 -0800 Subject: [PATCH] Remove no-op sed step when compiling crtbrand.o crtbrand.c was compiled to a .s file, run through a sed script to translate a %progbits to %note, and the compiled to .o. However, when the sed command was copied from the original source it was not updated to use the new name of the section (.note.ABI-tag to .note.android.ident), so it didn't modify the file. Since the section has been generated with type %progbits instead of %note for two years, just delete the whole sed step. Change-Id: Id78582e9b43b628afec4eed22a088283132f0742 --- libc/bionic/crtbrand.c | 15 --------------- libc/crt.mk | 22 +++++----------------- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/libc/bionic/crtbrand.c b/libc/bionic/crtbrand.c index 31fcbc7b3..a726c514d 100644 --- a/libc/bionic/crtbrand.c +++ b/libc/bionic/crtbrand.c @@ -32,21 +32,6 @@ /* * 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 { int32_t namesz; diff --git a/libc/crt.mk b/libc/crt.mk index c3ba54ba8..410f229db 100644 --- a/libc/crt.mk +++ b/libc/crt.mk @@ -32,26 +32,14 @@ my_libc_crt_target_so_cflags := \ my_libc_crt_target_ldflags := $(libc_crt_target_ldflags_$(my_arch)) -# See the comment in crtbrand.c for the reason why we need to generate -# crtbrand.s before generating crtbrand.o. -GEN := $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s -$(GEN): PRIVATE_CC := $($(my_2nd_arch_prefix)TARGET_CC) -$(GEN): PRIVATE_CFLAGS := $(my_libc_crt_target_so_cflags) -$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c - @mkdir -p $(dir $@) - $(hide) $(PRIVATE_CC) $(PRIVATE_CFLAGS) -S \ - -MD -MF $(@:%.s=%.d) -o $@ $< - $(hide) sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@ - $(call transform-d-to-p-args,$(@:%.s=%.d),$(@:%.s=%.P)) --include $(GEN:%.s=%.P) - - 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): $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s - @mkdir -p $(dir $@) - $(hide) $(PRIVATE_CC) $(PRIVATE_CFLAGS) -o $@ -c $< +$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c + $(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