xref: /aosp_15_r20/external/musl/Android.bp (revision c9945492fdd68bbe62686c5b452b4dc1be3f8453)
1// Build musl libc from source to eventually use as the libc for host modules in the platform build.
2// The list of sources to compile for each library is loaded from sources.bp, which is generated
3// by generate_bp.py.
4
5package {
6    default_visibility: ["//visibility:private"],
7    default_applicable_licenses: ["musl_license"],
8}
9
10license {
11    name: "musl_license",
12    visibility: [":__subpackages__"],
13    license_kinds: [
14        "SPDX-license-identifier-MIT",
15        "SPDX-license-identifier-BSD",
16    ],
17    license_text: ["COPYRIGHT"],
18}
19
20cc_library_headers {
21    name: "libc_musl_arch_headers",
22    host_supported: true,
23    device_supported: false,
24    system_shared_libs: [],
25    generated_headers: [
26        "libc_musl_alltypes.h",
27        "libc_musl_syscall.h",
28    ],
29    export_generated_headers: [
30        "libc_musl_alltypes.h",
31        "libc_musl_syscall.h",
32    ],
33    export_include_dirs: [
34        "arch/generic",
35    ],
36    arch: {
37        arm: {
38            export_include_dirs: ["arch/arm"],
39        },
40        arm64: {
41            export_include_dirs: ["arch/aarch64"],
42        },
43        x86: {
44            export_include_dirs: ["arch/i386"],
45        },
46        x86_64: {
47            export_include_dirs: ["arch/x86_64"],
48        },
49    },
50}
51
52cc_library_headers {
53    name: "libc_musl_private_headers",
54    host_supported: true,
55    device_supported: false,
56    system_shared_libs: [],
57    generated_headers: [
58        "libc_musl_version.h",
59    ],
60    export_generated_headers: [
61        "libc_musl_version.h",
62    ],
63    export_include_dirs: [
64        "src/include",
65        "src/internal",
66    ],
67}
68
69cc_library_headers {
70    name: "libc_musl_public_headers",
71    host_supported: true,
72    device_supported: false,
73    system_shared_libs: [],
74    export_system_include_dirs: [
75        "android/include",
76        "include",
77    ],
78}
79
80cc_defaults {
81    name: "libc_musl_base_defaults",
82    host_supported: true,
83    device_supported: false,
84    system_shared_libs: [],
85    cflags: [
86        // CFLAGS_C99FSE
87        "-nostdinc",
88        "-ffreestanding",
89        "-Wa,--noexecstack",
90
91        // CFLAGS_AUTO
92        "-Os",
93        "-pipe",
94        "-fomit-frame-pointer",
95        "-fno-unwind-tables",
96        "-fno-asynchronous-unwind-tables",
97        "-ffunction-sections",
98        "-fdata-sections",
99        //"-w",
100        "-Wno-pointer-to-int-cast",
101        "-Werror=implicit-function-declaration",
102        "-Werror=implicit-int",
103        "-Werror=pointer-sign",
104        "-Werror=pointer-arith",
105        "-Werror=int-conversion",
106        "-Werror=incompatible-pointer-types",
107        "-Qunused-arguments",
108        "-Waddress",
109        "-Warray-bounds",
110        "-Wchar-subscripts",
111        "-Wduplicate-decl-specifier",
112        "-Winit-self",
113        "-Wreturn-type",
114        "-Wsequence-point",
115        "-Wstrict-aliasing",
116        "-Wunused-function",
117        "-Wunused-label",
118        "-Wunused-variable",
119
120        // CFLAGS_ALL
121        "-D_XOPEN_SOURCE=700",
122
123        // undefine NDEBUG from global flags, musl defines it locally
124        "-UNDEBUG",
125
126        // disable warnings:
127        "-Wno-bitwise-op-parentheses",
128        "-Wno-dangling-else",
129        "-Wno-ignored-attributes",
130        "-Wno-logical-op-parentheses",
131        "-Wno-missing-braces",
132        "-Wno-missing-field-initializers",
133        "-Wno-parentheses",
134        "-Wno-shift-op-parentheses",
135        "-Wno-string-plus-int",
136        "-Wno-unused-parameter",
137    ],
138
139    arch: {
140        x86: {
141            cflags: ["-frounding-math"],
142        },
143        x86_64: {
144            cflags: ["-frounding-math"],
145        },
146        arm: {
147            cflags: ["-Wno-ignored-pragmas"],
148        },
149        arm64: {
150            cflags: ["-Wno-ignored-pragmas"],
151        },
152    },
153
154    ldflags: [
155        "-Wl,--sort-section,alignment",
156        "-Wl,--sort-common",
157        "-Wl,--gc-sections",
158        "-Wl,--hash-style=both",
159        "-Wl,--no-undefined",
160        // Can't use --exclude-libs=ALL, that excludes the static libraries
161        // used for building subparts of libc_musl.
162        //"-Wl,--exclude-libs=ALL",
163        "-Wl,--exclude-libs=libgcc.a",
164        "-Wl,--exclude-libs=libgcc_stripped.a",
165        "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
166        "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
167        "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
168        "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
169    ],
170
171    asflags: ["-Wno-unused-command-line-argument"],
172
173    stl: "none",
174    c_std: "c99",
175    sanitize: {
176        never: true,
177    },
178    target: {
179        darwin: {
180            enabled: false,
181        },
182        bionic: {
183            enabled: false,
184        },
185        glibc: {
186            enabled: false,
187        },
188    },
189    lto: {
190        never: true,
191    },
192}
193
194cc_defaults {
195    name: "libc_musl_defaults",
196    defaults: ["libc_musl_base_defaults"],
197    header_libs: [
198        // The order here is very important, private headers like src/include/features.h override
199        // public headers like include/features.h, and arch headers like arch/x86_64/ksigaction.h
200        // override private headers like src/internal/ksigaction.h.
201        "libc_musl_arch_headers",
202        "libc_musl_private_headers",
203        "libc_musl_public_headers",
204    ],
205}
206
207cc_library_headers {
208    name: "libc_musl_headers",
209    visibility: ["//bionic/libc"],
210    host_supported: true,
211    device_supported: false,
212    system_shared_libs: [],
213    export_header_lib_headers: [
214        "libc_musl_arch_headers",
215        "libc_musl_public_headers",
216        "libc_uapi_headers",
217    ],
218    header_libs: [
219        "libc_musl_arch_headers",
220        "libc_musl_public_headers",
221        "libc_uapi_headers",
222    ],
223}
224
225//
226// The main musl libc library
227//
228
229cc_library {
230    name: "libc_musl",
231    visibility: ["//visibility:public"],
232    defaults: ["libc_musl_defaults"],
233    whole_static_libs: ["libc_musl_static"],
234    shared: {
235        whole_static_libs: ["libc_musl_ldso"],
236    },
237    ldflags: [
238        "-Wl,-e,_dlstart",
239        "-nostdlib",
240    ],
241    dynamic_list: "dynamic.list",
242    export_header_lib_headers: [
243        "libc_musl_arch_headers",
244        "libc_musl_public_headers",
245        "libc_uapi_headers",
246    ],
247    header_libs: [
248        "libc_uapi_headers",
249    ],
250}
251
252// All the static parts of the main musl libc.  Don't use this directly, use
253// the version exported through libc_musl instead.
254cc_library_static {
255    name: "libc_musl_static",
256    defaults: [
257        "libc_musl_defaults",
258        "libc_musl_sources",
259    ],
260    whole_static_libs: [
261        "libc_musl_opt",
262        "libc_musl_opt_nossp",
263        "libc_musl_nossp",
264        "libexecinfo",
265        "libb64",
266        "libunwind",
267    ],
268    multilib: {
269        lib32: {
270            whole_static_libs: ["libc_musl_compat32"],
271        },
272    },
273    export_header_lib_headers: [
274        "libc_musl_arch_headers",
275        "libc_musl_public_headers",
276        "libc_uapi_headers",
277    ],
278    header_libs: [
279        "libc_uapi_headers",
280    ],
281}
282
283// Musl sources that are compiled with -O3
284cc_library_static {
285    name: "libc_musl_opt",
286    defaults: [
287        "libc_musl_defaults",
288        "libc_musl_opt_sources",
289    ],
290    cflags: ["-O3"],
291}
292
293// Musl sources that are compiled with -O3 and -fno-stack-protector
294cc_library_static {
295    name: "libc_musl_opt_nossp",
296    defaults: [
297        "libc_musl_defaults",
298        "libc_musl_opt_nossp_sources",
299    ],
300    cflags: [
301        "-O3",
302        "-fno-stack-protector",
303    ],
304}
305
306// Musl sources that are compiled with -fno-stack-protector
307cc_library_static {
308    name: "libc_musl_nossp",
309    defaults: [
310        "libc_musl_defaults",
311        "libc_musl_nossp_sources",
312    ],
313    cflags: ["-fno-stack-protector"],
314}
315
316// Musl sources for 32-bit architectures
317cc_library_static {
318    name: "libc_musl_compat32",
319    defaults: [
320        "libc_musl_defaults",
321        "libc_musl_compat32_sources",
322    ],
323}
324
325// Musl sources for the dynamic linker.
326cc_library_static {
327    name: "libc_musl_ldso",
328    defaults: [
329        "libc_musl_defaults",
330        "libc_musl_ldso_sources",
331    ],
332    cflags: [
333        "-fno-stack-protector",
334        "-DLIBC_SONAME=libc_musl.so",
335    ],
336}
337
338// An attempt to compile the dynamic linker as a standalone library separate from libc_musl.so.
339// Not used yet.
340cc_library_shared {
341    name: "musl_linker",
342    defaults: [
343        "libc_musl_defaults",
344    ],
345    nocrt: true,
346    static_libs: [
347        "libc_musl_ldso",
348        "libc_musl",
349    ],
350    ldflags: [
351        "-Wl,-e,_dlstart",
352        "-nostdlib",
353        "-Wl,--exclude-libs=libc_musl.a",
354    ],
355}
356
357//
358// The musl CRT objects
359//
360
361cc_defaults {
362    name: "libc_musl_crt_defaults",
363    defaults: ["libc_musl_base_defaults"],
364    cflags: [
365        // These are required to make sure the C code in crt/*.c
366        // doesn't have any dependencies on libc.
367        "-fno-stack-protector",
368        "-ftrivial-auto-var-init=uninitialized",
369    ],
370    ldflags: [
371        "-Wl,--no-gc-sections",
372    ],
373
374    // The headers below are the same as the header_libs in
375    // libc_musl_defaults, but bazel considers the crt depending
376    // on a header lib to be a circular dependency (toolchain ->
377    // crt objects -> header lib -> toolchain).
378    // TODO(b/263407827): go back to using header_libs once bazel
379    // supports it without introducing a dependency on the toolchain.
380    arch: {
381        arm: {
382            local_include_dirs: ["arch/arm"],
383        },
384        arm64: {
385            local_include_dirs: ["arch/aarch64"],
386        },
387        x86: {
388            local_include_dirs: ["arch/i386"],
389        },
390        x86_64: {
391            local_include_dirs: ["arch/x86_64"],
392        },
393    },
394    generated_headers: [
395        "libc_musl_alltypes.h",
396        "libc_musl_syscall.h",
397        "libc_musl_version.h",
398    ],
399    local_include_dirs: [
400        "arch/generic",
401        "src/include",
402        "src/internal",
403        "android/include",
404        "include",
405    ],
406}
407
408cc_object {
409    name: "libc_musl_crt1",
410    defaults: [
411        "libc_musl_crt_defaults",
412        "libc_musl_crt1_sources",
413    ],
414}
415
416cc_object {
417    name: "libc_musl_crti",
418    defaults: [
419        "libc_musl_crt_defaults",
420        "libc_musl_crti_sources",
421    ],
422}
423
424cc_object {
425    name: "libc_musl_crtn",
426    defaults: [
427        "libc_musl_crt_defaults",
428        "libc_musl_crtn_sources",
429    ],
430}
431
432cc_object {
433    name: "libc_musl_rcrt1",
434    defaults: [
435        "libc_musl_crt_defaults",
436        "libc_musl_rcrt1_sources",
437    ],
438}
439
440cc_object {
441    name: "libc_musl_Scrt1",
442    defaults: [
443        "libc_musl_crt_defaults",
444        "libc_musl_Scrt1_sources",
445    ],
446}
447
448//
449// The custom CRT objects for use in the platform build.
450// Embeds the linker into crtbegin_dynamic.
451//
452
453cc_object {
454    name: "libc_musl_crtbegin_dynamic",
455    defaults: ["libc_musl_crt_defaults"],
456    visibility: ["//visibility:public"],
457    objs: [
458        "libc_musl_crti",
459        "clang_rt.crtbegin",
460    ],
461    srcs: [
462        "android/relinterp.c",
463    ],
464    cflags: ["-DLOADER_PATH=\"libc_musl.so\""],
465}
466
467cc_object {
468    name: "libc_musl_crtbegin_static",
469    defaults: ["libc_musl_crt_defaults"],
470    visibility: ["//visibility:public"],
471    objs: [
472        "libc_musl_Scrt1",
473        "libc_musl_crti",
474        "clang_rt.crtbegin",
475    ],
476}
477
478cc_object {
479    name: "libc_musl_crtend",
480    defaults: ["libc_musl_crt_defaults"],
481    visibility: ["//visibility:public"],
482    objs: [
483        "clang_rt.crtend",
484        "libc_musl_crtn",
485    ],
486}
487
488cc_object {
489    name: "libc_musl_crtbegin_so",
490    defaults: ["libc_musl_crt_defaults"],
491    visibility: ["//visibility:public"],
492    objs: [
493        "libc_musl_crti",
494        "clang_rt.crtbegin",
495    ],
496}
497
498cc_object {
499    name: "libc_musl_crtend_so",
500    defaults: ["libc_musl_crt_defaults"],
501    visibility: ["//visibility:public"],
502    objs: [
503        "clang_rt.crtend",
504        "libc_musl_crtn",
505    ],
506}
507
508//
509// Tests for the embedded linker trampoline
510//
511
512cc_test_host {
513    name: "libc_musl_ldso_trampoline_test",
514    srcs: ["android/ldso_trampoline_test.cpp"],
515    stl: "libc++",
516    target: {
517        darwin: {
518            enabled: false,
519        },
520    },
521}
522
523//
524// Generated headers
525//
526
527genrule {
528    name: "libc_musl_version.h",
529    srcs: ["VERSION"],
530    out: ["version.h"],
531    cmd: "printf '#define VERSION \"%s\"\n' \"$$(cat $(location VERSION))\" > $(out)",
532}
533
534// libc_musl_arch_alltypes.h is split out of libc_musl_alltypes.h to ensure the arch-specific
535// alltypes.h.in ends up before the generic alltypes.h.in in the output.
536cc_genrule {
537    name: "libc_musl_arch_alltypes.h",
538    host_supported: true,
539    device_supported: false,
540    arch: {
541        arm: {
542            srcs: ["arch/arm/bits/alltypes.h.in"],
543        },
544        arm64: {
545            srcs: ["arch/aarch64/bits/alltypes.h.in"],
546        },
547        x86: {
548            srcs: ["arch/i386/bits/alltypes.h.in"],
549        },
550        x86_64: {
551            srcs: ["arch/x86_64/bits/alltypes.h.in"],
552        },
553    },
554    tool_files: ["tools/mkalltypes.sed"],
555    out: ["bits/arch/alltypes.h"],
556    cmd: "sed -f $(location tools/mkalltypes.sed) $(in) > $(out)",
557}
558
559cc_genrule {
560    name: "libc_musl_alltypes.h",
561    host_supported: true,
562    device_supported: false,
563    srcs: [
564        "include/alltypes.h.in",
565        ":libc_musl_arch_alltypes.h",
566    ],
567    tool_files: ["tools/mkalltypes.sed"],
568    out: ["bits/alltypes.h"],
569    cmd: "( " +
570        "cat $(location :libc_musl_arch_alltypes.h) && " +
571        "sed -f $(location tools/mkalltypes.sed) $(location include/alltypes.h.in) " +
572        ") > $(out)",
573}
574
575cc_genrule {
576    name: "libc_musl_syscall.h",
577    host_supported: true,
578    device_supported: false,
579    arch: {
580        arm: {
581            srcs: ["arch/arm/bits/syscall.h.in"],
582        },
583        arm64: {
584            srcs: ["arch/aarch64/bits/syscall.h.in"],
585        },
586        x86: {
587            srcs: ["arch/i386/bits/syscall.h.in"],
588        },
589        x86_64: {
590            srcs: ["arch/x86_64/bits/syscall.h.in"],
591        },
592    },
593    out: ["bits/syscall.h"],
594    cmd: "cp $(in) $(out) && sed -n -e s/__NR_/SYS_/p < $(in) >> $(out)",
595}
596
597//
598// Rules to generate a sysroot.  This isn't used during the build, but can be convenient to run
599// configure scripts from external projects to generate necessary files to build against musl.
600//
601
602
603// An empty static library that will be copied to libdl.a, etc. in the sysroot.
604// Shouldn't be used by anything else besides the sysroot cc_genrule.
605cc_library_static {
606    name: "libc_musl_sysroot_static_empty",
607    defaults: [
608        "libc_musl_defaults",
609    ],
610}
611
612// The linker and trampoline compiled as a .o file to use as part of the sysroot
613// crt.
614cc_object {
615    name: "libc_musl_linker_object",
616    defaults: ["libc_musl_crt_defaults"],
617    srcs: [
618        "android/relinterp.c",
619    ],
620    cflags: ["-DLOADER_PATH=\"libc_musl.so\""],
621}
622
623// The architecture-specific bits have to be handled separately because the label varies based
624// on architecture, which prevents using $(locations) to find them and requires using $(in)
625// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
626// genrule.
627cc_genrule {
628    name: "libc_musl_sysroot_bits",
629    host_supported: true,
630    device_supported: false,
631    arch: {
632        arm: {
633            srcs: ["arch/arm/bits/*.h"],
634        },
635        arm64: {
636            srcs: ["arch/aarch64/bits/*.h"],
637        },
638        x86: {
639            srcs: ["arch/i386/bits/*.h"],
640        },
641        x86_64: {
642            srcs: ["arch/x86_64/bits/*.h"],
643        },
644    },
645    out: ["libc_musl_sysroot_bits.zip"],
646    tools: ["soong_zip"],
647    cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/bits -j -D $$(dirname $${includes[0]})",
648}
649
650genrule {
651    name: "libc_musl_clang_wrapper",
652    srcs: ["tools/musl-clang.in"],
653    out: ["musl-clang"],
654    cmd: "sed -e 's`@CC@`clang`' -e 's`@PREFIX@`$$(dirname \"$$0\")/..`' -e 's`@INCDIR@`$${libc}/include`' -e 's`@LIBDIR@`$${libc}/lib`' $(in) > $(out) && " +
655        "chmod a+x $(out)",
656}
657
658genrule {
659    name: "libc_musl_ld_wrapper",
660    srcs: ["tools/ld.musl-clang.in"],
661    out: ["ld.musl-clang"],
662    cmd: "sed -e 's`@CC@`clang`' -e 's`@LIBDIR@`$$(dirname \"$$0\")/../lib`' -e 's`@LDSO@`$$(dirname \"$$0\")/../lib/ld-musl.so.1`' $(in) > $(out) && " +
663        "chmod a+x $(out)",
664}
665
666cc_library_host_static {
667    name: "libz_static_for_sysroot",
668    whole_static_libs: ["libz"],
669}
670
671cc_genrule {
672    name: "libc_musl_sysroot",
673    host_supported: true,
674    device_supported: false,
675    enabled: false,
676    target: {
677        musl: {
678            enabled: true,
679        },
680    },
681    srcs: [
682        "LICENSE",
683        "COPYRIGHT",
684
685        // Headers
686        "include/**/*.h",
687        "arch/generic/bits/*.h",
688        "android/include/bits/*.h",
689        "android/include/sys/cdefs.h",
690        ":libc_musl_syscall.h",
691        ":libc_musl_alltypes.h",
692        ":libc_musl_sysroot_bits",
693
694        // Bionic kernel uapi headers
695        ":libc_musl_sysroot_bionic_headers",
696
697        ":libc_musl_sysroot_zlib_headers",
698
699        // Libraries
700        ":libc_musl",
701        ":libc_musl_static",
702        ":libz_static_for_sysroot",
703
704        // Objects
705        ":libc_musl_crti",
706        ":libc_musl_crtn",
707        ":libc_musl_crt1",
708        ":libc_musl_rcrt1",
709        ":libc_musl_Scrt1",
710        ":clang_rt.crtbegin",
711        ":clang_rt.crtend",
712
713        // Embedded linker objects and linker scripts
714        ":libc_musl_linker_object",
715        "android/relinterp.script",
716
717        // Wrapper scripts
718        ":libc_musl_clang_wrapper",
719        ":libc_musl_ld_wrapper",
720
721        // Empty static libraries
722        ":libc_musl_sysroot_static_empty",
723    ],
724    out: ["libc_musl_sysroot.zip"],
725    tools: [
726        "soong_zip",
727        "merge_zips",
728        "zip2zip",
729    ],
730    cmd: "includes=($(locations include/**/*.h)) && " +
731        "bits=($(locations arch/generic/bits/*.h)) && " +
732        "android_bits=($(locations android/include/bits/*.h)) && " +
733        "ln -s libc_musl.so $(genDir)/ld-musl.so.1 && " +
734        "echo -e 'GROUP ( libc_musl_linker_object.o )\nINCLUDE relinterp.script' > $(genDir)/Scrt1.ld && " +
735        "echo -e 'GROUP ( libc_musl.so )' > $(genDir)/libc.so && " +
736        "$(location soong_zip) -o $(genDir)/sysroot.zip " +
737        " -j " +
738        "  -f $(location LICENSE) " +
739        "  -f $(location COPYRIGHT) " +
740        // headers
741        " -P include " +
742        "  -C $$(dirname $${includes[0]}) " +
743        "  -D $$(dirname $${includes[0]}) " +
744        " -P include/bits -j " +
745        "  -f $(location :libc_musl_syscall.h) " +
746        "  -f $(location :libc_musl_alltypes.h) " +
747        "  -D $$(dirname $${bits[0]}) " +
748        "  -D $$(dirname $${android_bits[0]}) " +
749        " -P include/sys -j " +
750        "  -f $(location android/include/sys/cdefs.h) " +
751        // embedded linker crt objects
752        " -P lib -j " +
753        "  -f $(location android/relinterp.script) " +
754        "  -f $(location :libc_musl_linker_object) " +
755        // libs
756        "  -f $(location :libc_musl) " +
757        "  -f $(genDir)/ld-musl.so.1 " +
758        "  -f $(genDir)/libc.so " +
759        // clang wrappers
760        " -P bin -j " +
761        "  -f $(location :libc_musl_clang_wrapper) " +
762        "  -f $(location :libc_musl_ld_wrapper) " +
763        " && " +
764        // libs in a separate zip so they can be renamed
765        "$(location soong_zip) -o $(genDir)/libs.zip " +
766        " -P lib -j " +
767        "  -f $(location :libc_musl_static) " +
768        "  -f $(location :libc_musl_sysroot_static_empty) " +
769        "  -f $(genDir)/Scrt1.ld " +
770        "  -f $(location :libc_musl_crti) " +
771        "  -f $(location :libc_musl_crtn) " +
772        "  -f $(location :libc_musl_crt1) " +
773        "  -f $(location :libc_musl_rcrt1) " +
774        "  -f $(location :libc_musl_Scrt1) " +
775        "  -f $(location :clang_rt.crtbegin) " +
776        "  -f $(location :clang_rt.crtend) " +
777        "  -f $(location :libz_static_for_sysroot) " +
778        " && " +
779        "$(location zip2zip) -i $(genDir)/libs.zip -o $(genDir)/libs_renamed.zip " +
780        // rename libs from module names to desired names in sysroot
781        " lib/libc_musl_static.a:lib/libc.a " +
782        // Swap in linker script for Scrt1.o
783        " lib/Scrt1.o:lib/Scrt1-real.o " +
784        " lib/Scrt1.ld:lib/Scrt1.o " +
785        // copy empty static libs
786        " lib/libc_musl_sysroot_static_empty.a:lib/libcrypt.a " +
787        " lib/libc_musl_sysroot_static_empty.a:lib/libdl.a " +
788        " lib/libc_musl_sysroot_static_empty.a:lib/libm.a " +
789        " lib/libc_musl_sysroot_static_empty.a:lib/libpthread.a " +
790        " lib/libc_musl_sysroot_static_empty.a:lib/libresolv.a " +
791        " lib/libc_musl_sysroot_static_empty.a:lib/librt.a " +
792        " lib/libc_musl_sysroot_static_empty.a:lib/libutil.a " +
793        " lib/libc_musl_sysroot_static_empty.a:lib/libxnet.a " +
794        // rename clang crt objects to gcc names
795        " lib/clang_rt.crtbegin.o:lib/crtbegin.o " +
796        " lib/clang_rt.crtbegin.o:lib/crtbeginS.o " +
797        " lib/clang_rt.crtbegin.o:lib/crtbeginT.o " +
798        " lib/clang_rt.crtend.o:lib/crtend.o " +
799        " lib/clang_rt.crtend.o:lib/crtendS.o " +
800        // rename crt objects
801        " lib/libc_musl_crti.o:lib/crti.o " +
802        " lib/libc_musl_crtn.o:lib/crtn.o " +
803        " lib/libc_musl_crt1.o:lib/crt1.o " +
804        " lib/libc_musl_rcrt1.o:lib/rcrt1.o " +
805        // rename static libz
806        " lib/libz_static_for_sysroot.a:lib/libz.a " +
807        " && " +
808        "$(location merge_zips) -ignore-duplicates $(out) " +
809        " $(location :libc_musl_sysroot_bionic_headers) " +
810        " $(location :libc_musl_sysroot_zlib_headers) " +
811        " $(location :libc_musl_sysroot_bits) " +
812        " $(genDir)/sysroot.zip " +
813        " $(genDir)/libs_renamed.zip",
814}
815
816build=["sources.bp"]
817