diff options
-rw-r--r-- | Android.bp | 34 |
1 files changed, 29 insertions, 5 deletions
@@ -389,10 +389,21 @@ cc_genrule { // The musl CRT objects // +cc_defaults { + name: "libc_musl_crt_defaults", + defaults: ["libc_musl_defaults"], + cflags: [ + // These are required to make sure the C code in crt/*.c + // doesn't have any dependencies on libc. + "-fno-stack-protector", + "-ftrivial-auto-var-init=uninitialized", + ], +} + cc_object { name: "libc_musl_crt1", defaults: [ - "libc_musl_defaults", + "libc_musl_crt_defaults", "libc_musl_crt1_sources", ], } @@ -400,7 +411,7 @@ cc_object { cc_object { name: "libc_musl_crti", defaults: [ - "libc_musl_defaults", + "libc_musl_crt_defaults", "libc_musl_crti_sources", ], } @@ -408,7 +419,7 @@ cc_object { cc_object { name: "libc_musl_crtn", defaults: [ - "libc_musl_defaults", + "libc_musl_crt_defaults", "libc_musl_crtn_sources", ], } @@ -416,7 +427,7 @@ cc_object { cc_object { name: "libc_musl_rcrt1", defaults: [ - "libc_musl_defaults", + "libc_musl_crt_defaults", "libc_musl_rcrt1_sources", ], } @@ -424,7 +435,7 @@ cc_object { cc_object { name: "libc_musl_Scrt1", defaults: [ - "libc_musl_defaults", + "libc_musl_crt_defaults", "libc_musl_Scrt1_sources", ], } @@ -712,6 +723,7 @@ cc_genrule { ":libc_musl_static", ":libc++abi", ":libc++", + ":libc++_static", // Objects ":libc_musl_crti", @@ -719,6 +731,8 @@ cc_genrule { ":libc_musl_crt1", ":libc_musl_rcrt1", ":libc_musl_Scrt1", + ":clang_rt.crtbegin", + ":clang_rt.crtend", // Embedded linker objects and linker scripts ":libc_musl_linker_object", @@ -785,10 +799,14 @@ cc_genrule { " -f $(location :libc_musl_sysroot_static_empty) " + " -f $(genDir)/Scrt1.ld " + " -f $(location :libc_musl_Scrt1) " + + " -f $(location :libc++_static) " + + " -f $(location :clang_rt.crtbegin) " + + " -f $(location :clang_rt.crtend) " + " && " + "$(location zip2zip) -i $(genDir)/libs.zip -o $(genDir)/libs_renamed.zip " + // rename libs from module names to desired names in sysroot " lib/libc_musl_static.a:lib/libc.a " + + " lib/libc++_static.a:lib/libc++.a " + // Swap in linker script for Scrt1.o " lib/Scrt1.o:lib/Scrt1-real.o " + " lib/Scrt1.ld:lib/Scrt1.o " + @@ -801,6 +819,12 @@ cc_genrule { " lib/libc_musl_sysroot_static_empty.a:lib/librt.a " + " lib/libc_musl_sysroot_static_empty.a:lib/libutil.a " + " lib/libc_musl_sysroot_static_empty.a:lib/libxnet.a " + + // rename clang crt objects to gcc names + " lib/clang_rt.crtbegin.o:lib/crtbegin.o " + + " lib/clang_rt.crtbegin.o:lib/crtbeginS.o " + + " lib/clang_rt.crtbegin.o:lib/crtbeginT.o " + + " lib/clang_rt.crtend.o:lib/crtend.o " + + " lib/clang_rt.crtend.o:lib/crtendS.o " + " && " + "$(location merge_zips) -ignore-duplicates $(out) " + " $(location :libc_musl_sysroot_bionic_headers) " + |