Merge "Use cc_defaults"

This commit is contained in:
Colin Cross 2015-11-05 01:56:58 +00:00 committed by Gerrit Code Review
commit ef5e647891

View File

@ -1,5 +1,3 @@
bionic_coverage = false
// Define the common source files for all the libc instances // Define the common source files for all the libc instances
// ========================================================= // =========================================================
libc_common_src_files = [ libc_common_src_files = [
@ -77,20 +75,37 @@ libc_common_src_files_32 = [
// Define some common cflags // Define some common cflags
// ======================================================== // ========================================================
libc_common_cflags = [ cc_defaults {
name: "libc_defaults",
cflags: [
"-D_LIBC=1", "-D_LIBC=1",
"-Wall", "-Wall",
"-Wextra", "-Wextra",
"-Wunused", "-Wunused",
// Try to catch typical 32-bit assumptions that break with 64-bit pointers. // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
"-Werror=pointer-to-int-cast", "-Werror=pointer-to-int-cast",
"-Werror=int-to-pointer-cast", "-Werror=int-to-pointer-cast",
"-Werror=type-limits", "-Werror=type-limits",
"-Werror", "-Werror",
] ],
// TODO: split out the asflags.
asflags: [
"-D_LIBC=1",
"-Wall",
"-Wextra",
"-Wunused",
libc_common_product_variables = { // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
"-Werror=pointer-to-int-cast",
"-Werror=int-to-pointer-cast",
"-Werror=type-limits",
"-Werror",
],
conlyflags: ["-std=gnu99"],
cppflags: [],
product_variables: {
device_uses_jemalloc: { device_uses_jemalloc: {
cflags: ["-DUSE_JEMALLOC"], cflags: ["-DUSE_JEMALLOC"],
include_dirs: ["external/jemalloc/include"], include_dirs: ["external/jemalloc/include"],
@ -103,11 +118,20 @@ libc_common_product_variables = {
dlmalloc_alignment: { dlmalloc_alignment: {
cflags: ["-DMALLOC_ALIGNMENT=%d"], cflags: ["-DMALLOC_ALIGNMENT=%d"],
}, },
} },
// Clang/llvm has incompatible long double (fp128) for x86_64.
// https://llvm.org/bugs/show_bug.cgi?id=23897
arch: {
x86_64: {
clang: false,
},
},
// Clang/llvm has incompatible long double (fp128) for x86_64. stl: "none",
// https://llvm.org/bugs/show_bug.cgi?id=23897 system_shared_libs: [],
use_clang_x86_64 = false sanitize: ["never"],
native_coverage: false,
}
// ANDROIDMK TRANSLATION ERROR: unsupported directive // ANDROIDMK TRANSLATION ERROR: unsupported directive
// ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true) // ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
@ -115,13 +139,6 @@ use_clang_x86_64 = false
// ANDROIDMK TRANSLATION ERROR: unsupported directive // ANDROIDMK TRANSLATION ERROR: unsupported directive
// endif // endif
//
// Define some common conlyflags
libc_common_conlyflags = ["-std=gnu99"]
// Define some common cppflags
libc_common_cppflags = []
// ======================================================== // ========================================================
// libc_stack_protector.a - stack protector code // libc_stack_protector.a - stack protector code
// ======================================================== // ========================================================
@ -133,23 +150,9 @@ libc_common_cppflags = []
cc_library_static { cc_library_static {
srcs: ["bionic/__stack_chk_fail.cpp"], srcs: ["bionic/__stack_chk_fail.cpp"],
cflags: libc_common_cflags + ["-fno-stack-protector"], defaults: ["libc_defaults"],
conlyflags: libc_common_conlyflags, cflags: ["-fno-stack-protector"],
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
name: "libc_stack_protector", name: "libc_stack_protector",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
arch: {
x86_64: {
clang: use_clang_x86_64,
},
},
} }
// ======================================================== // ========================================================
@ -158,6 +161,7 @@ cc_library_static {
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
"tzcode/asctime.c", "tzcode/asctime.c",
"tzcode/difftime.c", "tzcode/difftime.c",
@ -167,7 +171,7 @@ cc_library_static {
"upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one. "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
], ],
cflags: libc_common_cflags + [ cflags: [
"-fvisibility=hidden", "-fvisibility=hidden",
"-Wno-unused-parameter", "-Wno-unused-parameter",
// Don't use ridiculous amounts of stack. // Don't use ridiculous amounts of stack.
@ -185,22 +189,8 @@ cc_library_static {
"-Dlint", "-Dlint",
], ],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
local_include_dirs: ["tzcode/"], local_include_dirs: ["tzcode/"],
name: "libc_tzcode", name: "libc_tzcode",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
arch: {
x86_64: {
clang: use_clang_x86_64,
},
},
} }
// ======================================================== // ========================================================
@ -209,6 +199,7 @@ cc_library_static {
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
"dns/net/gethnamaddr.c", "dns/net/gethnamaddr.c",
"dns/net/getservbyname.c", "dns/net/getservbyname.c",
@ -243,8 +234,8 @@ cc_library_static {
"upstream-openbsd/lib/libc/net/res_random.c", "upstream-openbsd/lib/libc/net/res_random.c",
], ],
cflags: ["-Dres_randomid=__res_randomid"] + cflags: [
libc_common_cflags + [ "-Dres_randomid=__res_randomid",
"-DANDROID_CHANGES", "-DANDROID_CHANGES",
"-DINET6", "-DINET6",
"-fvisibility=hidden", "-fvisibility=hidden",
@ -252,9 +243,6 @@ cc_library_static {
"-include netbsd-compat.h", "-include netbsd-compat.h",
], ],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
local_include_dirs: [ local_include_dirs: [
"dns/include", "dns/include",
"private", "private",
@ -263,17 +251,6 @@ cc_library_static {
], ],
name: "libc_dns", name: "libc_dns",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
arch: {
x86_64: {
clang: use_clang_x86_64,
},
},
} }
// ======================================================== // ========================================================
@ -284,6 +261,7 @@ cc_library_static {
// automatically included. // automatically included.
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
"upstream-freebsd/lib/libc/gen/ldexp.c", "upstream-freebsd/lib/libc/gen/ldexp.c",
"upstream-freebsd/lib/libc/gen/sleep.c", "upstream-freebsd/lib/libc/gen/sleep.c",
@ -347,31 +325,19 @@ cc_library_static {
"upstream-freebsd/lib/libc/string/wmemcmp.c", "upstream-freebsd/lib/libc/string/wmemcmp.c",
], ],
}, },
x86_64: {
clang: use_clang_x86_64,
},
}, },
cflags: libc_common_cflags + [ cflags: [
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-uninitialized", "-Wno-uninitialized",
"-include freebsd-compat.h", "-include freebsd-compat.h",
], ],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
local_include_dirs: [ local_include_dirs: [
"upstream-freebsd/android/include", "upstream-freebsd/android/include",
], ],
name: "libc_freebsd", name: "libc_freebsd",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
@ -383,6 +349,7 @@ cc_library_static {
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
"upstream-netbsd/common/lib/libc/stdlib/random.c", "upstream-netbsd/common/lib/libc/stdlib/random.c",
"upstream-netbsd/lib/libc/gen/ftw.c", "upstream-netbsd/lib/libc/gen/ftw.c",
@ -424,33 +391,19 @@ cc_library_static {
srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"], srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
}, },
}, },
cflags: libc_common_cflags + [ cflags: [
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-uninitialized", "-Wno-uninitialized",
"-DPOSIX_MISTAKE", "-DPOSIX_MISTAKE",
"-include netbsd-compat.h", "-include netbsd-compat.h",
], ],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
local_include_dirs: [ local_include_dirs: [
"upstream-netbsd/android/include", "upstream-netbsd/android/include",
"upstream-netbsd/lib/libc/include", "upstream-netbsd/lib/libc/include",
], ],
name: "libc_netbsd", name: "libc_netbsd",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
arch: {
x86_64: {
clang: use_clang_x86_64,
},
},
} }
// ======================================================== // ========================================================
@ -464,6 +417,7 @@ cc_library_static {
cc_library_static { cc_library_static {
name: "libc_openbsd_ndk", name: "libc_openbsd_ndk",
defaults: ["libc_defaults"],
srcs: [ srcs: [
"upstream-openbsd/lib/libc/compat-43/killpg.c", "upstream-openbsd/lib/libc/compat-43/killpg.c",
"upstream-openbsd/lib/libc/gen/alarm.c", "upstream-openbsd/lib/libc/gen/alarm.c",
@ -639,16 +593,13 @@ cc_library_static {
"upstream-openbsd/lib/libc/string/wcswidth.c", "upstream-openbsd/lib/libc/string/wcswidth.c",
], ],
cflags: libc_common_cflags + [ cflags: [
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-uninitialized", "-Wno-uninitialized",
"-Wno-unused-parameter", "-Wno-unused-parameter",
"-include openbsd-compat.h", "-include openbsd-compat.h",
], ],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
local_include_dirs: [ local_include_dirs: [
"private", "private",
"stdio", "stdio",
@ -656,17 +607,6 @@ cc_library_static {
"upstream-openbsd/lib/libc/include", "upstream-openbsd/lib/libc/include",
"upstream-openbsd/lib/libc/gdtoa/", "upstream-openbsd/lib/libc/gdtoa/",
], ],
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
arch: {
x86_64: {
clang: use_clang_x86_64,
},
},
} }
// ======================================================== // ========================================================
@ -676,6 +616,7 @@ cc_library_static {
// These files are built with the openbsd-compat.h header file // These files are built with the openbsd-compat.h header file
// automatically included. // automatically included.
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
// These two depend on getentropy_linux.c, which isn't in libc_ndk.a. // These two depend on getentropy_linux.c, which isn't in libc_ndk.a.
"upstream-openbsd/lib/libc/crypt/arc4random.c", "upstream-openbsd/lib/libc/crypt/arc4random.c",
@ -809,20 +750,16 @@ cc_library_static {
"upstream-openbsd/lib/libc/string/strncmp.c", "upstream-openbsd/lib/libc/string/strncmp.c",
"upstream-openbsd/lib/libc/string/strncpy.c", "upstream-openbsd/lib/libc/string/strncpy.c",
], ],
clang: use_clang_x86_64,
}, },
}, },
cflags: libc_common_cflags + [ cflags: [
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-uninitialized", "-Wno-uninitialized",
"-Wno-unused-parameter", "-Wno-unused-parameter",
"-include openbsd-compat.h", "-include openbsd-compat.h",
], ],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
local_include_dirs: [ local_include_dirs: [
"private", "private",
"stdio", "stdio",
@ -832,12 +769,6 @@ cc_library_static {
], ],
name: "libc_openbsd", name: "libc_openbsd",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
@ -848,6 +779,7 @@ cc_library_static {
// automatically included. // automatically included.
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
"upstream-openbsd/android/gdtoa_support.cpp", "upstream-openbsd/android/gdtoa_support.cpp",
"upstream-openbsd/lib/libc/gdtoa/dmisc.c", "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
@ -874,16 +806,13 @@ cc_library_static {
}, },
}, },
cflags: libc_common_cflags + [ cflags: [
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-uninitialized", "-Wno-uninitialized",
"-fvisibility=hidden", "-fvisibility=hidden",
"-include openbsd-compat.h", "-include openbsd-compat.h",
], ],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
local_include_dirs: [ local_include_dirs: [
"private", "private",
"upstream-openbsd/android/include", "upstream-openbsd/android/include",
@ -891,17 +820,6 @@ cc_library_static {
], ],
name: "libc_gdtoa", name: "libc_gdtoa",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
arch: {
x86_64: {
clang: use_clang_x86_64,
},
},
} }
// ======================================================== // ========================================================
@ -909,6 +827,7 @@ cc_library_static {
// ======================================================== // ========================================================
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
// The fork implementation depends on pthread data, so we can't include // The fork implementation depends on pthread data, so we can't include
// it in libc_ndk.a. // it in libc_ndk.a.
@ -935,7 +854,7 @@ cc_library_static {
"bionic/strnlen.c", "bionic/strnlen.c",
"bionic/strrchr.cpp", "bionic/strrchr.cpp",
], ],
cflags: libc_common_cflags + ["-Wframe-larger-than=2048"], cflags: ["-Wframe-larger-than=2048"],
arch: { arch: {
arm: { arm: {
@ -1338,7 +1257,6 @@ cc_library_static {
}, },
x86_64: { x86_64: {
clang: use_clang_x86_64,
srcs: [ srcs: [
"arch-x86_64/bionic/__bionic_clone.S", "arch-x86_64/bionic/__bionic_clone.S",
"arch-x86_64/bionic/_exit_with_stack_teardown.S", "arch-x86_64/bionic/_exit_with_stack_teardown.S",
@ -1367,17 +1285,9 @@ cc_library_static {
}, },
}, },
conlyflags: libc_common_conlyflags, cppflags: ["-Wold-style-cast"],
cppflags: libc_common_cppflags + ["-Wold-style-cast"],
product_variables: libc_common_product_variables,
include_dirs: ["bionic/libstdc++/include"], include_dirs: ["bionic/libstdc++/include"],
name: "libc_bionic", name: "libc_bionic",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
@ -1386,6 +1296,7 @@ cc_library_static {
// or constructors). // or constructors).
// ======================================================== // ========================================================
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
"bionic/abort.cpp", "bionic/abort.cpp",
"bionic/accept.cpp", "bionic/accept.cpp",
@ -1526,13 +1437,8 @@ cc_library_static {
"bionic/wctype.cpp", "bionic/wctype.cpp",
"bionic/wmempcpy.cpp", "bionic/wmempcpy.cpp",
], ],
cflags: libc_common_cflags + ["-Wframe-larger-than=2048"], cflags: ["-Wframe-larger-than=2048"],
arch: {
x86_64: {
clang: use_clang_x86_64,
},
},
multilib: { multilib: {
lib32: { lib32: {
// LP32 cruft // LP32 cruft
@ -1540,35 +1446,22 @@ cc_library_static {
}, },
}, },
conlyflags: libc_common_conlyflags, cppflags: ["-Wold-style-cast"],
cppflags: libc_common_cppflags + ["-Wold-style-cast"],
product_variables: libc_common_product_variables,
local_include_dirs: ["stdio"], local_include_dirs: ["stdio"],
include_dirs: ["bionic/libstdc++/include"], include_dirs: ["bionic/libstdc++/include"],
name: "libc_bionic_ndk", name: "libc_bionic_ndk",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
cc_library_static { cc_library_static {
name: "libc_thread_atexit_impl", name: "libc_thread_atexit_impl",
defaults: ["libc_defaults"],
srcs: ["bionic/__cxa_thread_atexit_impl.cpp"], srcs: ["bionic/__cxa_thread_atexit_impl.cpp"],
cflags: libc_common_cflags + ["-Wframe-larger-than=2048"], cflags: ["-Wframe-larger-than=2048"],
conlyflags: libc_common_conlyflags, cppflags: ["-Wold-style-cast"],
cppflags: libc_common_cppflags + ["-Wold-style-cast"],
product_variables: libc_common_product_variables,
include_dirs: ["bionic/libstdc++/include"], include_dirs: ["bionic/libstdc++/include"],
// TODO: Clang tries to use __tls_get_addr which is not supported yet // TODO: Clang tries to use __tls_get_addr which is not supported yet
// remove after it is implemented. // remove after it is implemented.
clang: false, clang: false,
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
@ -1580,6 +1473,7 @@ cc_library_static {
// ======================================================== // ========================================================
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
"bionic/pthread_atfork.cpp", "bionic/pthread_atfork.cpp",
"bionic/pthread_attr.cpp", "bionic/pthread_attr.cpp",
@ -1603,24 +1497,11 @@ cc_library_static {
"bionic/pthread_setschedparam.cpp", "bionic/pthread_setschedparam.cpp",
"bionic/pthread_sigmask.cpp", "bionic/pthread_sigmask.cpp",
], ],
cflags: libc_common_cflags + ["-Wframe-larger-than=2048"], cflags: ["-Wframe-larger-than=2048"],
arch: { cppflags: ["-Wold-style-cast"],
x86_64: {
clang: use_clang_x86_64,
},
},
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags + ["-Wold-style-cast"],
product_variables: libc_common_product_variables,
include_dirs: ["bionic/libstdc++/include"], include_dirs: ["bionic/libstdc++/include"],
name: "libc_pthread", name: "libc_pthread",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
@ -1628,21 +1509,17 @@ cc_library_static {
// ======================================================== // ========================================================
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
"bionic/__cxa_guard.cpp", "bionic/__cxa_guard.cpp",
"bionic/__cxa_pure_virtual.cpp", "bionic/__cxa_pure_virtual.cpp",
"bionic/new.cpp", "bionic/new.cpp",
], ],
cflags: libc_common_cflags + ["-fvisibility=hidden"], cflags: ["-fvisibility=hidden"],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
include_dirs: ["bionic/libstdc++/include"], include_dirs: ["bionic/libstdc++/include"],
name: "libc_cxa", name: "libc_cxa",
clang: true, // GCC refuses to hide new/delete clang: true, // GCC refuses to hide new/delete
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
// b/17574078: Need to disable coverage until we have a prebuilt libprofile_rt. // b/17574078: Need to disable coverage until we have a prebuilt libprofile_rt.
// Since this is a static library built with clang, it needs to link // Since this is a static library built with clang, it needs to link
// libprofile_rt when it is linked into the final binary. Since the final binary // libprofile_rt when it is linked into the final binary. Since the final binary
@ -1675,16 +1552,10 @@ cc_library_static {
srcs: ["arch-x86/syscalls/**/*.S"], srcs: ["arch-x86/syscalls/**/*.S"],
}, },
x86_64: { x86_64: {
clang: use_clang_x86_64,
srcs: ["arch-x86_64/syscalls/**/*.S"], srcs: ["arch-x86_64/syscalls/**/*.S"],
}, },
}, },
name: "libc_syscalls", name: "libc_syscalls",
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
@ -1695,22 +1566,14 @@ cc_library_static {
// ======================================================== // ========================================================
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
arch: { arch: {
arm: { arm: {
srcs: ["arch-arm/bionic/__aeabi.c"], srcs: ["arch-arm/bionic/__aeabi.c"],
}, },
x86_64: {
clang: use_clang_x86_64,
},
}, },
name: "libc_aeabi", name: "libc_aeabi",
cflags: libc_common_cflags + ["-fno-builtin"], cflags: ["-fno-builtin"],
product_variables: libc_common_product_variables,
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
@ -1727,6 +1590,7 @@ cc_library_static {
cc_library_static { cc_library_static {
name: "libc_ndk", name: "libc_ndk",
defaults: ["libc_defaults"],
srcs: libc_common_src_files + ["bionic/malloc_debug_common.cpp"], srcs: libc_common_src_files + ["bionic/malloc_debug_common.cpp"],
multilib: { multilib: {
lib32: { lib32: {
@ -1743,18 +1607,12 @@ cc_library_static {
], ],
whole_static_libs: ["libc_aeabi"], whole_static_libs: ["libc_aeabi"],
}, },
x86_64: {
clang: use_clang_x86_64,
},
}, },
cflags: libc_common_cflags + [ cflags: [
"-fvisibility=hidden", "-fvisibility=hidden",
"-DLIBC_STATIC", "-DLIBC_STATIC",
], ],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
whole_static_libs: [ whole_static_libs: [
"libc_bionic_ndk", "libc_bionic_ndk",
@ -1769,14 +1627,6 @@ cc_library_static {
"libc_tzcode", "libc_tzcode",
"libm", "libm",
], ],
stl: "none",
system_shared_libs: [],
// TODO: split out the asflags.
asflags: libc_common_cflags,
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
@ -1784,16 +1634,13 @@ cc_library_static {
// ======================================================== // ========================================================
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: libc_common_src_files, srcs: libc_common_src_files,
multilib: { multilib: {
lib32: { lib32: {
srcs: libc_common_src_files_32, srcs: libc_common_src_files_32,
}, },
}, },
cflags: libc_common_cflags,
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
name: "libc_common", name: "libc_common",
whole_static_libs: [ whole_static_libs: [
@ -1818,18 +1665,7 @@ cc_library_static {
arm: { arm: {
whole_static_libs: ["libc_aeabi"], whole_static_libs: ["libc_aeabi"],
}, },
x86_64: {
clang: use_clang_x86_64,
}, },
},
stl: "none",
system_shared_libs: [],
// TODO: split out the asflags.
asflags: libc_common_cflags,
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
@ -1843,6 +1679,7 @@ cc_library_static {
// dynamic linker. // dynamic linker.
cc_library_static { cc_library_static {
defaults: ["libc_defaults"],
srcs: [ srcs: [
"bionic/dl_iterate_phdr_static.cpp", "bionic/dl_iterate_phdr_static.cpp",
"bionic/libc_init_static.cpp", "bionic/libc_init_static.cpp",
@ -1852,32 +1689,21 @@ cc_library_static {
arm: { arm: {
srcs: ["arch-arm/bionic/exidx_static.c"], srcs: ["arch-arm/bionic/exidx_static.c"],
}, },
x86_64: {
clang: use_clang_x86_64,
},
}, },
cflags: libc_common_cflags + ["-DLIBC_STATIC"], cflags: ["-DLIBC_STATIC"],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
name: "libc_nomalloc", name: "libc_nomalloc",
whole_static_libs: ["libc_common"], whole_static_libs: ["libc_common"],
stl: "none",
system_shared_libs: [],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc). // libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
// ======================================================== // ========================================================
cc_library_static { cc_library_static {
product_variables: libc_common_product_variables + { defaults: ["libc_defaults"],
product_variables: {
device_uses_jemalloc: { device_uses_jemalloc: {
srcs: ["bionic/jemalloc_wrapper.cpp"], srcs: ["bionic/jemalloc_wrapper.cpp"],
whole_static_libs: ["libjemalloc"], whole_static_libs: ["libjemalloc"],
@ -1886,31 +1712,18 @@ cc_library_static {
srcs: ["bionic/dlmalloc.c"], srcs: ["bionic/dlmalloc.c"],
}, },
}, },
cflags: libc_common_cflags + ["-fvisibility=hidden"], cflags: ["-fvisibility=hidden"],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
name: "libc_malloc", name: "libc_malloc",
stl: "none",
sanitize: ["never"],
native_coverage: bionic_coverage,
arch: {
x86_64: {
clang: use_clang_x86_64,
},
},
} }
// ======================================================== // ========================================================
// libc.a + libc.so // libc.a + libc.so
// ======================================================== // ========================================================
cc_library { cc_library {
defaults: ["libc_defaults"],
name: "libc", name: "libc",
cflags: libc_common_cflags, product_variables: {
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables + {
platform_sdk_version: { platform_sdk_version: {
asflags: ["-DPLATFORM_SDK_VERSION=%d"], asflags: ["-DPLATFORM_SDK_VERSION=%d"],
}, },
@ -1949,8 +1762,6 @@ cc_library {
shared_libs: ["libdl"], shared_libs: ["libdl"],
whole_static_libs: ["libc_common"], whole_static_libs: ["libc_common"],
stl: "none",
system_shared_libs: [],
// We'd really like to do this for all architectures, but since this wasn't done // We'd really like to do this for all architectures, but since this wasn't done
// before, these symbols must continue to be exported on LP32 for binary // before, these symbols must continue to be exported on LP32 for binary
@ -2003,14 +1814,10 @@ cc_library {
version_script: "libc.x86.map", version_script: "libc.x86.map",
}, },
x86_64: { x86_64: {
clang: use_clang_x86_64,
// Don't re-export new/delete and friends, even if the compiler really wants to. // Don't re-export new/delete and friends, even if the compiler really wants to.
version_script: "libc.x86_64.map", version_script: "libc.x86_64.map",
}, },
}, },
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// For all builds, except for the -user build we will enable memory // For all builds, except for the -user build we will enable memory
@ -2025,10 +1832,7 @@ cc_library {
// libc_malloc_debug_leak.so // libc_malloc_debug_leak.so
// ======================================================== // ========================================================
cc_library_shared { cc_library_shared {
cflags: libc_common_cflags, defaults: ["libc_defaults"],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
srcs: [ srcs: [
"bionic/debug_backtrace.cpp", "bionic/debug_backtrace.cpp",
@ -2044,8 +1848,6 @@ cc_library_shared {
"libc", "libc",
"libdl", "libdl",
], ],
stl: "none",
system_shared_libs: [],
// Only need this for arm since libc++ uses its own unwind code that // Only need this for arm since libc++ uses its own unwind code that
// doesn't mix with the other default unwind code. // doesn't mix with the other default unwind code.
arch: { arch: {
@ -2056,9 +1858,6 @@ cc_library_shared {
], ],
ldflags: ["-Wl,--exclude-libs,libunwind_llvm.a"], ldflags: ["-Wl,--exclude-libs,libunwind_llvm.a"],
}, },
x86_64: {
clang: use_clang_x86_64,
},
}, },
allow_undefined_symbols: true, allow_undefined_symbols: true,
@ -2070,19 +1869,14 @@ cc_library_shared {
"eng", "eng",
"debug", "debug",
], ],
sanitize: ["never"],
native_coverage: bionic_coverage,
} }
// ======================================================== // ========================================================
// libc_malloc_debug_qemu.so // libc_malloc_debug_qemu.so
// ======================================================== // ========================================================
cc_library_shared { cc_library_shared {
cflags: libc_common_cflags + ["-DMALLOC_QEMU_INSTRUMENT"], defaults: ["libc_defaults"],
cflags: ["-DMALLOC_QEMU_INSTRUMENT"],
conlyflags: libc_common_conlyflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
srcs: [ srcs: [
"bionic/libc_logging.cpp", "bionic/libc_logging.cpp",
@ -2095,8 +1889,6 @@ cc_library_shared {
"libc", "libc",
"libdl", "libdl",
], ],
stl: "none",
system_shared_libs: [],
// Don't re-export new/delete and friends, even if the compiler really wants to. // Don't re-export new/delete and friends, even if the compiler really wants to.
version_script: "version_script.txt", version_script: "version_script.txt",
@ -2106,14 +1898,6 @@ cc_library_shared {
"eng", "eng",
"debug", "debug",
], ],
sanitize: ["never"],
native_coverage: bionic_coverage,
arch: {
x86_64: {
clang: use_clang_x86_64,
},
},
} }
// ANDROIDMK TRANSLATION ERROR: unsupported directive // ANDROIDMK TRANSLATION ERROR: unsupported directive
@ -2124,10 +1908,8 @@ cc_library_shared {
// libstdc++.so + libstdc++.a // libstdc++.so + libstdc++.a
// ======================================================== // ========================================================
cc_library { cc_library {
defaults: ["libc_defaults"],
include_dirs: ["bionic/libstdc++/include"], include_dirs: ["bionic/libstdc++/include"],
cflags: libc_common_cflags,
cppflags: libc_common_cppflags,
product_variables: libc_common_product_variables,
srcs: [ srcs: [
"bionic/__cxa_guard.cpp", "bionic/__cxa_guard.cpp",
"bionic/__cxa_pure_virtual.cpp", "bionic/__cxa_pure_virtual.cpp",
@ -2135,11 +1917,7 @@ cc_library {
"bionic/libc_logging.cpp", "bionic/libc_logging.cpp",
], ],
name: "libstdc++", name: "libstdc++",
stl: "none",
system_shared_libs: ["libc"], system_shared_libs: ["libc"],
sanitize: ["never"],
native_coverage: bionic_coverage,
//TODO: This is to work around b/24465209. Remove after root cause is fixed //TODO: This is to work around b/24465209. Remove after root cause is fixed
arch: { arch: {
@ -2152,7 +1930,12 @@ cc_library {
}, },
} }
crt_arch_flags = { cc_defaults {
name: "crt_defaults",
no_default_compiler_flags: true,
arch: {
arm: { arm: {
local_include_dirs: ["arch-arm/include"], local_include_dirs: ["arch-arm/include"],
cflags: ["-mthumb-interwork"], cflags: ["-mthumb-interwork"],
@ -2178,9 +1961,13 @@ crt_arch_flags = {
ldflags: ["-melf_x86_64"], ldflags: ["-melf_x86_64"],
local_include_dirs: ["arch-x86_64/include"], local_include_dirs: ["arch-x86_64/include"],
}, },
},
} }
crt_arch_so_flags = crt_arch_flags + { cc_defaults {
name: "crt_so_defaults",
arch: {
mips: { mips: {
cflags: ["-fPIC"], cflags: ["-fPIC"],
}, },
@ -2193,6 +1980,7 @@ crt_arch_so_flags = crt_arch_flags + {
x86_64: { x86_64: {
cflags: ["-fPIC"], cflags: ["-fPIC"],
}, },
},
} }
// Android.mk:start // Android.mk:start
@ -2224,9 +2012,8 @@ cc_object {
}, },
}, },
srcs: ["arch-common/bionic/crtbrand.S"], srcs: ["arch-common/bionic/crtbrand.S"],
no_default_compiler_flags: true,
arch: crt_arch_so_flags, defaults: ["crt_defaults", "crt_so_defaults"],
} }
// Android.mk:ignore // Android.mk:ignore
@ -2234,17 +2021,15 @@ cc_object {
name: "crtbegin_so1", name: "crtbegin_so1",
local_include_dirs: ["include"], local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtbegin_so.c"], srcs: ["arch-common/bionic/crtbegin_so.c"],
no_default_compiler_flags: true,
arch: crt_arch_so_flags, defaults: ["crt_defaults", "crt_so_defaults"],
} }
// Android.mk:ignore // Android.mk:ignore
cc_object { cc_object {
name: "crtbegin_so", name: "crtbegin_so",
no_default_compiler_flags: true,
arch: crt_arch_so_flags, defaults: ["crt_defaults", "crt_so_defaults"],
deps: [ deps: [
"crtbegin_so1", "crtbegin_so1",
"crtbrand", "crtbrand",
@ -2256,9 +2041,8 @@ cc_object {
name: "crtend_so", name: "crtend_so",
local_include_dirs: ["include"], local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtend_so.S"], srcs: ["arch-common/bionic/crtend_so.S"],
no_default_compiler_flags: true,
arch: crt_arch_so_flags, defaults: ["crt_defaults", "crt_so_defaults"],
} }
// Android.mk:ignore // Android.mk:ignore
@ -2266,9 +2050,8 @@ cc_object {
name: "crtbegin_static1", name: "crtbegin_static1",
local_include_dirs: ["include"], local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtbegin.c"], srcs: ["arch-common/bionic/crtbegin.c"],
no_default_compiler_flags: true,
arch: crt_arch_flags + { arch: {
arm64: { arm64: {
srcs: [ srcs: [
"arch-arm64/bionic/crtbegin.c", "arch-arm64/bionic/crtbegin.c",
@ -2294,18 +2077,19 @@ cc_object {
], ],
}, },
}, },
defaults: ["crt_defaults"],
} }
// Android.mk:ignore // Android.mk:ignore
cc_object { cc_object {
name: "crtbegin_static", name: "crtbegin_static",
no_default_compiler_flags: true,
arch: crt_arch_flags,
deps: [ deps: [
"crtbegin_static1", "crtbegin_static1",
"crtbrand", "crtbrand",
], ],
defaults: ["crt_defaults"],
} }
// Android.mk:ignore // Android.mk:ignore
@ -2313,9 +2097,8 @@ cc_object {
name: "crtbegin_dynamic1", name: "crtbegin_dynamic1",
local_include_dirs: ["include"], local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtbegin.c"], srcs: ["arch-common/bionic/crtbegin.c"],
no_default_compiler_flags: true,
arch: crt_arch_flags + { arch: {
arm64: { arm64: {
srcs: [ srcs: [
"arch-arm64/bionic/crtbegin.c", "arch-arm64/bionic/crtbegin.c",
@ -2341,18 +2124,18 @@ cc_object {
], ],
}, },
}, },
defaults: ["crt_defaults"],
} }
// Android.mk:ignore // Android.mk:ignore
cc_object { cc_object {
name: "crtbegin_dynamic", name: "crtbegin_dynamic",
no_default_compiler_flags: true,
arch: crt_arch_flags,
deps: [ deps: [
"crtbegin_dynamic1", "crtbegin_dynamic1",
"crtbrand", "crtbrand",
], ],
defaults: ["crt_defaults"],
} }
// Android.mk:ignore // Android.mk:ignore
@ -2362,7 +2145,6 @@ cc_object {
name: "crtend_android", name: "crtend_android",
local_include_dirs: ["include"], local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtend.S"], srcs: ["arch-common/bionic/crtend.S"],
no_default_compiler_flags: true,
arch: crt_arch_flags, defaults: ["crt_defaults"],
} }