Compare commits
	
		
			50 Commits
		
	
	
		
			marshmallo
			...
			master-soo
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					635ff5fdac | ||
| 
						 | 
					a56904273c | ||
| 
						 | 
					f93bddbbd8 | ||
| 
						 | 
					2803a15d4c | ||
| 
						 | 
					70f11bd69b | ||
| 
						 | 
					8f7a4a3cb5 | ||
| 
						 | 
					649a2ea0e2 | ||
| 
						 | 
					c371306714 | ||
| 
						 | 
					87e33892fc | ||
| 
						 | 
					7454daa97f | ||
| 
						 | 
					dab6ead2aa | ||
| 
						 | 
					7d0b7b4ba2 | ||
| 
						 | 
					98f4e07237 | ||
| 
						 | 
					b624072cbd | ||
| 
						 | 
					0ecd342743 | ||
| 
						 | 
					faa14d4de8 | ||
| 
						 | 
					abc97e2e71 | ||
| 
						 | 
					6549fe249c | ||
| 
						 | 
					c15e8fdb8d | ||
| 
						 | 
					fa6f649607 | ||
| 
						 | 
					e1a61f5e93 | ||
| 
						 | 
					0bf650373e | ||
| 
						 | 
					11331f60dd | ||
| 
						 | 
					f8093a9485 | ||
| 
						 | 
					b904afa16e | ||
| 
						 | 
					9f0d99d298 | ||
| 
						 | 
					62d6533c1a | ||
| 
						 | 
					bed7a7e5eb | ||
| 
						 | 
					a85bcc2e99 | ||
| 
						 | 
					6fa65e7cd5 | ||
| 
						 | 
					e0905c94d3 | ||
| 
						 | 
					520cbf51b1 | ||
| 
						 | 
					42d7468f99 | ||
| 
						 | 
					b293969c6d | ||
| 
						 | 
					032907d8c7 | ||
| 
						 | 
					2ea504fed1 | ||
| 
						 | 
					59bce688c7 | ||
| 
						 | 
					bfd65279a5 | ||
| 
						 | 
					682a240c5d | ||
| 
						 | 
					d2177404e2 | ||
| 
						 | 
					0a93df369c | ||
| 
						 | 
					90d6279802 | ||
| 
						 | 
					22d8776587 | ||
| 
						 | 
					51b8912253 | ||
| 
						 | 
					270f2ea800 | ||
| 
						 | 
					7357ad0875 | ||
| 
						 | 
					959bc099a3 | ||
| 
						 | 
					68a3b658b1 | ||
| 
						 | 
					062d498e28 | ||
| 
						 | 
					d2b8741e1b | 
							
								
								
									
										1
									
								
								Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Android.bp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
subdirs = ["*"]
 | 
			
		||||
							
								
								
									
										123
									
								
								benchmarks/Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								benchmarks/Android.bp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,123 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright (C) 2013 The Android Open Source Project
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
//      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
// -----------------------------------------------------------------------------
 | 
			
		||||
// Benchmarks library, usable by projects outside this directory.
 | 
			
		||||
// -----------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
benchmark_cflags = [
 | 
			
		||||
    "-O2",
 | 
			
		||||
    "-fno-builtin",
 | 
			
		||||
    "-Wall",
 | 
			
		||||
    "-Wextra",
 | 
			
		||||
    "-Werror",
 | 
			
		||||
    "-Wunused",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
benchmark_cppflags = ["-std=gnu++11"]
 | 
			
		||||
 | 
			
		||||
benchmarklib_src_files = [
 | 
			
		||||
    "Benchmark.cpp",
 | 
			
		||||
    "utils.cpp",
 | 
			
		||||
    "main.cpp",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
cc_library_static {
 | 
			
		||||
    name: "libbenchmark",
 | 
			
		||||
    host_supported: true,
 | 
			
		||||
    cflags: benchmark_cflags,
 | 
			
		||||
    cppflags: benchmark_cppflags,
 | 
			
		||||
    srcs: benchmarklib_src_files,
 | 
			
		||||
    static_libs: ["libbase"],
 | 
			
		||||
    export_include_dirs: ["."],
 | 
			
		||||
    target: {
 | 
			
		||||
        darwin: {
 | 
			
		||||
            // Only supported on linux systems.
 | 
			
		||||
            disabled: true,
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// -----------------------------------------------------------------------------
 | 
			
		||||
// Benchmarks.
 | 
			
		||||
// -----------------------------------------------------------------------------
 | 
			
		||||
benchmark_src_files = [
 | 
			
		||||
    "math_benchmark.cpp",
 | 
			
		||||
    "property_benchmark.cpp",
 | 
			
		||||
    "pthread_benchmark.cpp",
 | 
			
		||||
    "semaphore_benchmark.cpp",
 | 
			
		||||
    "stdio_benchmark.cpp",
 | 
			
		||||
    "string_benchmark.cpp",
 | 
			
		||||
    "time_benchmark.cpp",
 | 
			
		||||
    "unistd_benchmark.cpp",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
// Build benchmarks for the device (with bionic's .so). Run with:
 | 
			
		||||
//   adb shell bionic-benchmarks32
 | 
			
		||||
//   adb shell bionic-benchmarks64
 | 
			
		||||
cc_binary {
 | 
			
		||||
    name: "bionic-benchmarks",
 | 
			
		||||
    multilib: {
 | 
			
		||||
        lib32: {
 | 
			
		||||
            suffix: "32",
 | 
			
		||||
        },
 | 
			
		||||
        lib64: {
 | 
			
		||||
            suffix: "64",
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
    compile_multilib: "both",
 | 
			
		||||
    cflags: benchmark_cflags,
 | 
			
		||||
    cppflags: benchmark_cppflags,
 | 
			
		||||
    srcs: benchmark_src_files,
 | 
			
		||||
    static_libs: [
 | 
			
		||||
        "libbenchmark",
 | 
			
		||||
        "libbase",
 | 
			
		||||
    ],
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// We don't build a static benchmark executable because it's not usually
 | 
			
		||||
// useful. If you're trying to run the current benchmarks on an older
 | 
			
		||||
// release, it's (so far at least) always because you want to measure the
 | 
			
		||||
// performance of the old release's libc, and a static benchmark isn't
 | 
			
		||||
// going to let you do that.
 | 
			
		||||
 | 
			
		||||
// Build benchmarks for the host (against glibc!). Run with:
 | 
			
		||||
cc_binary_host {
 | 
			
		||||
    name: "bionic-benchmarks-glibc",
 | 
			
		||||
    multilib: {
 | 
			
		||||
        lib32: {
 | 
			
		||||
            stem: "bionic-benchmarks-glibc32",
 | 
			
		||||
        },
 | 
			
		||||
        lib64: {
 | 
			
		||||
            stem: "bionic-benchmarks-glibc64",
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
    compile_multilib: "both",
 | 
			
		||||
    cflags: benchmark_cflags,
 | 
			
		||||
    cppflags: benchmark_cppflags,
 | 
			
		||||
    ldflags: ["-lrt"],
 | 
			
		||||
    srcs: benchmark_src_files,
 | 
			
		||||
    static_libs: [
 | 
			
		||||
        "libbenchmark",
 | 
			
		||||
        "libbase",
 | 
			
		||||
    ],
 | 
			
		||||
    target: {
 | 
			
		||||
        darwin: {
 | 
			
		||||
            // Only supported on linux systems.
 | 
			
		||||
            disabled: true,
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2261
									
								
								libc/Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2261
									
								
								libc/Android.bp
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -941,9 +941,6 @@ LOCAL_SRC_FILES := $(libc_bionic_src_files)
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags) \
 | 
			
		||||
    -Wframe-larger-than=2048 \
 | 
			
		||||
 | 
			
		||||
# ssse3-strcmp-slm.S does not compile with Clang.
 | 
			
		||||
LOCAL_CLANG_ASFLAGS_x86_64 += -no-integrated-as
 | 
			
		||||
 | 
			
		||||
# memcpy.S, memchr.S, etc. do not compile with Clang.
 | 
			
		||||
LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
 | 
			
		||||
LOCAL_CLANG_ASFLAGS_arm64 += -no-integrated-as
 | 
			
		||||
@@ -975,9 +972,6 @@ LOCAL_SRC_FILES := $(libc_bionic_ndk_src_files)
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags) \
 | 
			
		||||
    -Wframe-larger-than=2048 \
 | 
			
		||||
 | 
			
		||||
# ssse3-strcmp-slm.S does not compile with Clang.
 | 
			
		||||
LOCAL_CLANG_ASFLAGS_x86_64 += -no-integrated-as
 | 
			
		||||
 | 
			
		||||
# memcpy.S, memchr.S, etc. do not compile with Clang.
 | 
			
		||||
LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
 | 
			
		||||
LOCAL_CLANG_ASFLAGS_arm64 += -no-integrated-as
 | 
			
		||||
@@ -1030,9 +1024,6 @@ LOCAL_SRC_FILES := $(libc_pthread_src_files)
 | 
			
		||||
LOCAL_CFLAGS := $(libc_common_cflags) \
 | 
			
		||||
    -Wframe-larger-than=2048 \
 | 
			
		||||
 | 
			
		||||
# ssse3-strcmp-slm.S does not compile with Clang.
 | 
			
		||||
LOCAL_CLANG_ASFLAGS_x86_64 += -no-integrated-as
 | 
			
		||||
 | 
			
		||||
# memcpy.S, memchr.S, etc. do not compile with Clang.
 | 
			
		||||
LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
 | 
			
		||||
LOCAL_CLANG_ASFLAGS_arm64 += -no-integrated-as
 | 
			
		||||
@@ -1361,6 +1352,9 @@ LOCAL_ADDITIONAL_DEPENDENCIES := \
 | 
			
		||||
# meaningful name resolution.
 | 
			
		||||
LOCAL_STRIP_MODULE := keep_symbols
 | 
			
		||||
 | 
			
		||||
# Do not pack libc.so relocations; see http://b/20645321 for details.
 | 
			
		||||
LOCAL_PACK_MODULE_RELOCATIONS := false
 | 
			
		||||
 | 
			
		||||
# WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
 | 
			
		||||
# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
 | 
			
		||||
# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ ENTRY_PRIVATE(MEMCPY_BASE)
 | 
			
		||||
        /* check if buffers are aligned. If so, run arm-only version */
 | 
			
		||||
        eor         r3, r0, r1
 | 
			
		||||
        ands        r3, r3, #0x3
 | 
			
		||||
        beq         __memcpy_base_aligned
 | 
			
		||||
        beq         MEMCPY_BASE_ALIGNED
 | 
			
		||||
 | 
			
		||||
        /* Check the upper size limit for Neon unaligned memory access in memcpy */
 | 
			
		||||
        cmp         r2, #224
 | 
			
		||||
 
 | 
			
		||||
@@ -1897,8 +1897,8 @@ L(strcmp_exitz):
 | 
			
		||||
 | 
			
		||||
	.p2align 4
 | 
			
		||||
L(Byte0):
 | 
			
		||||
	movzx	(%rsi), %ecx
 | 
			
		||||
	movzx	(%rdi), %eax
 | 
			
		||||
	movzbl	(%rsi), %ecx
 | 
			
		||||
	movzbl	(%rdi), %eax
 | 
			
		||||
 | 
			
		||||
	sub	%ecx, %eax
 | 
			
		||||
	ret
 | 
			
		||||
 
 | 
			
		||||
@@ -56,6 +56,7 @@ enum AndroidEventLogType {
 | 
			
		||||
  EVENT_TYPE_LONG     = 1,
 | 
			
		||||
  EVENT_TYPE_STRING   = 2,
 | 
			
		||||
  EVENT_TYPE_LIST     = 3,
 | 
			
		||||
  EVENT_TYPE_FLOAT    = 4,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct BufferOutputStream {
 | 
			
		||||
 
 | 
			
		||||
@@ -598,6 +598,16 @@ int __system_property_area_init()
 | 
			
		||||
    return map_prop_area_rw();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned int __system_property_area_serial()
 | 
			
		||||
{
 | 
			
		||||
    prop_area *pa = __system_property_area__;
 | 
			
		||||
    if (!pa) {
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
    // Make sure this read fulfilled before __system_property_serial
 | 
			
		||||
    return atomic_load_explicit(&(pa->serial), memory_order_acquire);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const prop_info *__system_property_find(const char *name)
 | 
			
		||||
{
 | 
			
		||||
    if (__predict_false(compat_mode)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -98,6 +98,24 @@ int __system_property_set_filename(const char *filename);
 | 
			
		||||
*/
 | 
			
		||||
int __system_property_area_init();
 | 
			
		||||
 | 
			
		||||
/* Read the global serial number of the system properties
 | 
			
		||||
**
 | 
			
		||||
** Called to predict if a series of cached __system_property_find
 | 
			
		||||
** objects will have seen __system_property_serial values change.
 | 
			
		||||
** But also aids the converse, as changes in the global serial can
 | 
			
		||||
** also be used to predict if a failed __system_property_find
 | 
			
		||||
** could in-turn now find an new object; thus preventing the
 | 
			
		||||
** cycles of effort to poll __system_property_find.
 | 
			
		||||
**
 | 
			
		||||
** Called at the beginning of a cache cycle to signal _any_ possible
 | 
			
		||||
** changes have occurred since last. If there is, check each individual
 | 
			
		||||
** __system_property_serial to confirm dirty, or __system_property_find
 | 
			
		||||
** to check if the property now exists.
 | 
			
		||||
**
 | 
			
		||||
** Returns the serial number on success, -1 on error.
 | 
			
		||||
*/
 | 
			
		||||
unsigned int __system_property_area_serial();
 | 
			
		||||
 | 
			
		||||
/* Add a new system property.  Can only be done by a single
 | 
			
		||||
** process that has write access to the property area, and
 | 
			
		||||
** that process must handle sequencing to ensure the property
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										46
									
								
								libdl/Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								libdl/Android.bp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
//
 | 
			
		||||
// libdl
 | 
			
		||||
//
 | 
			
		||||
cc_library {
 | 
			
		||||
 | 
			
		||||
    // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
 | 
			
		||||
    // libgcc.a are made static to libdl.so.  This in turn ensures that libraries that
 | 
			
		||||
    // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so
 | 
			
		||||
    // to provide those symbols, but will instead pull them from libgcc.a.  Specifically,
 | 
			
		||||
    // we use this property to make sure libc.so has its own copy of the code from
 | 
			
		||||
    // libgcc.a it uses.
 | 
			
		||||
    //
 | 
			
		||||
    // DO NOT REMOVE --exclude-libs!
 | 
			
		||||
 | 
			
		||||
    ldflags: ["-Wl,--exclude-libs=libgcc.a"],
 | 
			
		||||
 | 
			
		||||
    // for x86, exclude libgcc_eh.a for the same reasons as above
 | 
			
		||||
    arch: {
 | 
			
		||||
        x86: {
 | 
			
		||||
            ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
 | 
			
		||||
        },
 | 
			
		||||
        x86_64: {
 | 
			
		||||
            ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
    srcs: ["libdl.c"],
 | 
			
		||||
    cflags: [
 | 
			
		||||
        "-Wall",
 | 
			
		||||
        "-Wextra",
 | 
			
		||||
        "-Wunused",
 | 
			
		||||
        "-Werror",
 | 
			
		||||
    ],
 | 
			
		||||
    stl: "none",
 | 
			
		||||
 | 
			
		||||
    name: "libdl",
 | 
			
		||||
 | 
			
		||||
    // NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a
 | 
			
		||||
    // few symbols from libc. Using --no-undefined here results in having to link
 | 
			
		||||
    // against libc creating a circular dependency which is removed and we end up
 | 
			
		||||
    // with missing symbols. Since this library is just a bunch of stubs, we set
 | 
			
		||||
    // LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags.
 | 
			
		||||
    allow_undefined_symbols: true,
 | 
			
		||||
    system_shared_libs: [],
 | 
			
		||||
 | 
			
		||||
    asan: false,
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										381
									
								
								libm/Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										381
									
								
								libm/Android.bp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,381 @@
 | 
			
		||||
// ANDROIDMK TRANSLATION ERROR: unsupported directive
 | 
			
		||||
// ifneq ($(TARGET_USE_PRIVATE_LIBM),true)
 | 
			
		||||
 | 
			
		||||
bionic_coverage = false
 | 
			
		||||
 | 
			
		||||
// TODO: this comes from from upstream's libc, not libm, but it's an
 | 
			
		||||
// implementation detail that should have hidden visibility, so it needs
 | 
			
		||||
// to be in whatever library the math code is in.
 | 
			
		||||
libm_common_src_files = ["digittoint.c"]
 | 
			
		||||
 | 
			
		||||
// TODO: this is not in the BSDs.
 | 
			
		||||
libm_common_src_files += [
 | 
			
		||||
    "significandl.c",
 | 
			
		||||
    "sincos.c",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
libm_common_src_files += [
 | 
			
		||||
    "upstream-freebsd/lib/msun/bsdsrc/b_exp.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/bsdsrc/b_log.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/catrig.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/catrigf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_acos.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_acosf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_acosh.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_acoshf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_asin.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_asinf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_atan2.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_atan2f.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_atanh.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_atanhf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_cosh.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_coshf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_exp.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_expf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_fmod.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_fmodf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_gamma.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_gammaf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_gammaf_r.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_gamma_r.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_hypot.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_hypotf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_j0.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_j0f.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_j1.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_j1f.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_jn.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_jnf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_lgamma.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_lgammaf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_lgammaf_r.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_lgamma_r.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_log10.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_log10f.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_log2.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_log2f.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_log.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_logf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_pow.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_powf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_remainder.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_remainderf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_rem_pio2.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_rem_pio2f.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_scalb.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_scalbf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_sinh.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_sinhf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_sqrt.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_sqrtf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/imprecise.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/k_cos.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/k_cosf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/k_exp.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/k_expf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/k_rem_pio2.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/k_sin.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/k_sinf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/k_tan.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/k_tanf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_asinh.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_asinhf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_atan.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_atanf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_carg.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cargf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cargl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cbrt.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cbrtf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ccosh.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ccoshf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ceil.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ceilf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cexp.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cexpf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cimag.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cimagf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cimagl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_conj.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_conjf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_conjl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_copysign.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_copysignf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cos.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cosf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cproj.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cprojf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cprojl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_creal.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_crealf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_creall.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_csinh.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_csinhf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_csqrt.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_csqrtf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_csqrtl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ctanh.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ctanhf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_erf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_erff.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_exp2.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_exp2f.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_expm1.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_expm1f.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fabs.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fabsf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fdim.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_finite.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_finitef.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_floor.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_floorf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fma.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fmaf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fmax.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fmaxf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fmin.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fminf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_frexp.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_frexpf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ilogb.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ilogbf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_llrint.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_llrintf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_llround.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_llroundf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_log1p.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_log1pf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_logb.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_logbf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_lrint.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_lrintf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_lround.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_lroundf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_modf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_modff.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_nan.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_nearbyint.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_nextafter.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_nextafterf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_remquo.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_remquof.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_rint.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_rintf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_round.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_roundf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_scalbln.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_scalbn.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_scalbnf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_signgam.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_significand.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_significandf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_sin.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_sinf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_tan.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_tanf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_tanh.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_tanhf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_tgammaf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_trunc.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_truncf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/w_cabs.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/w_cabsf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/w_cabsl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/w_drem.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/w_dremf.c",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
libm_common_src_files += [
 | 
			
		||||
    "fake_long_double.c",
 | 
			
		||||
    "signbit.c",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
libm_ld128_src_files = [
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_acosl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_acoshl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_asinl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_atan2l.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_atanhl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_fmodl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_hypotl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_lgammal.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_remainderl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_sqrtl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_asinhl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_atanl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cbrtl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ceill.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_copysignl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_coshl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_cosl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fabsl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_floorl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fmal.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fmaxl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_fminl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_modfl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_frexpl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_ilogbl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_llrintl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_llroundl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_logbl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_lrintl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_lroundl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_nextafterl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_nexttoward.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_nexttowardf.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_remquol.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_rintl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_roundl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_scalbnl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/e_sinhl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_sinl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_tanhl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_tanl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/src/s_truncl.c",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
libm_ld128_src_files += [
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/invtrig.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/e_lgammal_r.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/k_cosl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/k_sinl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/k_tanl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/s_erfl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/s_exp2l.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/s_expl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/s_logl.c",
 | 
			
		||||
    "upstream-freebsd/lib/msun/ld128/s_nanl.c",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
// TODO: re-enable i387/e_sqrtf.S for x86, and maybe others.
 | 
			
		||||
 | 
			
		||||
libm_common_cflags = [
 | 
			
		||||
    "-DFLT_EVAL_METHOD=0",
 | 
			
		||||
    "-std=c99",
 | 
			
		||||
    "-include freebsd-compat.h",
 | 
			
		||||
    "-Wno-missing-braces",
 | 
			
		||||
    "-Wno-parentheses",
 | 
			
		||||
    "-Wno-sign-compare",
 | 
			
		||||
    "-Wno-uninitialized",
 | 
			
		||||
    "-Wno-unknown-pragmas",
 | 
			
		||||
    "-fvisibility=hidden",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
// Workaround the GCC "(long)fn -> lfn" optimization bug which will result in
 | 
			
		||||
// self recursions for lrint, lrintf, and lrintl.
 | 
			
		||||
// BUG: 14225968
 | 
			
		||||
libm_common_cflags += [
 | 
			
		||||
    "-fno-builtin-rint",
 | 
			
		||||
    "-fno-builtin-rintf",
 | 
			
		||||
    "-fno-builtin-rintl",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
libm_common_local_includes = ["upstream-freebsd/lib/msun/src/"]
 | 
			
		||||
 | 
			
		||||
libm_ld_local_includes = ["upstream-freebsd/lib/msun/ld128/"]
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// libm.so and libm.a for target.
 | 
			
		||||
//
 | 
			
		||||
cc_library {
 | 
			
		||||
    name: "libm",
 | 
			
		||||
 | 
			
		||||
    cflags: libm_common_cflags,
 | 
			
		||||
    include_dirs: ["bionic/libc"],
 | 
			
		||||
    local_include_dirs: libm_common_local_includes,
 | 
			
		||||
    srcs: libm_common_src_files,
 | 
			
		||||
    system_shared_libs: ["libc"],
 | 
			
		||||
 | 
			
		||||
    native_coverage: bionic_coverage,
 | 
			
		||||
    asan: false,
 | 
			
		||||
 | 
			
		||||
    multilib: {
 | 
			
		||||
        lib64: {
 | 
			
		||||
            srcs: libm_ld128_src_files,
 | 
			
		||||
            local_include_dirs: libm_ld_local_includes,
 | 
			
		||||
            // 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
 | 
			
		||||
            // compatibility.
 | 
			
		||||
            ldflags: ["-Wl,--exclude-libs,libgcc.a"],
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // arch-specific settings
 | 
			
		||||
    arch: {
 | 
			
		||||
        arm: {
 | 
			
		||||
            srcs: [
 | 
			
		||||
                "arm/fenv.c",
 | 
			
		||||
                "arm/e_sqrt.S",
 | 
			
		||||
                "arm/e_sqrtf.S",
 | 
			
		||||
                "arm/s_floor.S",
 | 
			
		||||
            ],
 | 
			
		||||
            exclude_srcs: [
 | 
			
		||||
                // TODO: these require neon not available in arm
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/e_sqrt.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/e_sqrtf.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_floor.c",
 | 
			
		||||
            ],
 | 
			
		||||
            instruction_set: "arm",
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        arm64: {
 | 
			
		||||
            srcs: [
 | 
			
		||||
                "arm64/fenv.c",
 | 
			
		||||
                "arm64/ceil.S",
 | 
			
		||||
                "arm64/fma.S",
 | 
			
		||||
                "arm64/floor.S",
 | 
			
		||||
                "arm64/lrint.S",
 | 
			
		||||
                "arm64/rint.S",
 | 
			
		||||
                "arm64/sqrt.S",
 | 
			
		||||
                "arm64/trunc.S",
 | 
			
		||||
            ],
 | 
			
		||||
            exclude_srcs: [
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_ceil.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_ceilf.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_fma.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_fmaf.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_floor.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_floorf.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_llrint.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_llrintf.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_lrint.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_lrintf.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_rint.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_rintf.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/e_sqrt.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/e_sqrtf.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_trunc.c",
 | 
			
		||||
                "upstream-freebsd/lib/msun/src/s_truncf.c",
 | 
			
		||||
            ],
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        mips: {
 | 
			
		||||
            srcs: ["mips/fenv.c"],
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        mips64: {
 | 
			
		||||
            srcs: ["mips/fenv.c"],
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        x86: {
 | 
			
		||||
            local_include_dirs: ["i387"],
 | 
			
		||||
            srcs: ["i387/fenv.c"],
 | 
			
		||||
            // Clang has wrong long double sizes for x86.
 | 
			
		||||
            clang: false,
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        x86_64: {
 | 
			
		||||
            srcs: ["amd64/fenv.c"],
 | 
			
		||||
            // Clang has wrong long double sizes for x86.
 | 
			
		||||
            clang: false,
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    stl: "none",
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ANDROIDMK TRANSLATION ERROR: unsupported directive
 | 
			
		||||
// endif
 | 
			
		||||
							
								
								
									
										117
									
								
								linker/Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										117
									
								
								linker/Android.bp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,117 @@
 | 
			
		||||
linker_cflags = [
 | 
			
		||||
    "-fno-stack-protector",
 | 
			
		||||
    "-Wstrict-overflow=5",
 | 
			
		||||
    "-fvisibility=hidden",
 | 
			
		||||
    "-Wall",
 | 
			
		||||
    "-Wextra",
 | 
			
		||||
    "-Wunused",
 | 
			
		||||
    "-Werror",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
cc_binary {
 | 
			
		||||
 | 
			
		||||
    srcs: [
 | 
			
		||||
        "debugger.cpp",
 | 
			
		||||
        "dlfcn.cpp",
 | 
			
		||||
        "linker.cpp",
 | 
			
		||||
        "linker_allocator.cpp",
 | 
			
		||||
        "linker_block_allocator.cpp",
 | 
			
		||||
        "linker_environ.cpp",
 | 
			
		||||
        "linker_libc_support.c",
 | 
			
		||||
        "linker_memory.cpp",
 | 
			
		||||
        "linker_phdr.cpp",
 | 
			
		||||
        "rt.cpp",
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    arch: {
 | 
			
		||||
        arm: {
 | 
			
		||||
            srcs: ["arch/arm/begin.S"],
 | 
			
		||||
        },
 | 
			
		||||
        arm64: {
 | 
			
		||||
            srcs: ["arch/arm64/begin.S"],
 | 
			
		||||
        },
 | 
			
		||||
        x86: {
 | 
			
		||||
            srcs: ["arch/x86/begin.c"],
 | 
			
		||||
        },
 | 
			
		||||
        x86_64: {
 | 
			
		||||
            srcs: ["arch/x86_64/begin.S"],
 | 
			
		||||
        },
 | 
			
		||||
        mips: {
 | 
			
		||||
            srcs: [
 | 
			
		||||
                "arch/mips/begin.S",
 | 
			
		||||
                "linker_mips.cpp",
 | 
			
		||||
            ],
 | 
			
		||||
        },
 | 
			
		||||
        mips64: {
 | 
			
		||||
            srcs: [
 | 
			
		||||
                "arch/mips64/begin.S",
 | 
			
		||||
                "linker_mips.cpp",
 | 
			
		||||
            ],
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // -shared is used to overwrite the -Bstatic and -static
 | 
			
		||||
    // flags triggered by LOCAL_FORCE_STATIC_EXECUTABLE.
 | 
			
		||||
    // This dynamic linker is actually a shared object linked with static
 | 
			
		||||
    // libraries.
 | 
			
		||||
    ldflags: [
 | 
			
		||||
        "-shared",
 | 
			
		||||
        "-Wl,-Bsymbolic",
 | 
			
		||||
        "-Wl,--exclude-libs,ALL",
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    cflags: linker_cflags,
 | 
			
		||||
    // TODO: split out the asflags.
 | 
			
		||||
    asflags: linker_cflags,
 | 
			
		||||
 | 
			
		||||
    target: {
 | 
			
		||||
        android64: {
 | 
			
		||||
            cflags: ["-DTARGET_IS_64_BIT"],
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // We need to access Bionic private headers in the linker.
 | 
			
		||||
    local_include_dirs: ["../libc/"],
 | 
			
		||||
 | 
			
		||||
    conlyflags: ["-std=gnu99"],
 | 
			
		||||
 | 
			
		||||
    cppflags: [
 | 
			
		||||
        "-std=gnu++11",
 | 
			
		||||
        "-Wold-style-cast",
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    // we don't want crtbegin.o (because we have begin.o), so unset it
 | 
			
		||||
    // just for this module
 | 
			
		||||
    nocrt: true,
 | 
			
		||||
 | 
			
		||||
    static_libs: [
 | 
			
		||||
        "libc_nomalloc",
 | 
			
		||||
        "libziparchive",
 | 
			
		||||
        "libutils",
 | 
			
		||||
        "libz",
 | 
			
		||||
        "liblog",
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    static_executable: true,
 | 
			
		||||
 | 
			
		||||
    name: "linker",
 | 
			
		||||
    multilib: {
 | 
			
		||||
        lib32: {
 | 
			
		||||
            stem: "linker",
 | 
			
		||||
        },
 | 
			
		||||
        lib64: {
 | 
			
		||||
            stem: "linker64",
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
    compile_multilib: "both",
 | 
			
		||||
 | 
			
		||||
    // Leave the symbols in the shared library so that stack unwinders can
 | 
			
		||||
    // produce meaningful name resolution.
 | 
			
		||||
    strip: "keep_symbols",
 | 
			
		||||
 | 
			
		||||
    // Insert an extra objcopy step to add prefix to symbols. This is needed to
 | 
			
		||||
    // prevent gdb looking up symbols in the linker by mistake.
 | 
			
		||||
    prefix_symbols: "__dl_",
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subdirs = ["tests"]
 | 
			
		||||
@@ -61,21 +61,6 @@
 | 
			
		||||
#include "linker_reloc_iterators.h"
 | 
			
		||||
#include "ziparchive/zip_archive.h"
 | 
			
		||||
 | 
			
		||||
/* >>> IMPORTANT NOTE - READ ME BEFORE MODIFYING <<<
 | 
			
		||||
 *
 | 
			
		||||
 * Do NOT use malloc() and friends or pthread_*() code here.
 | 
			
		||||
 * Don't use printf() either; it's caused mysterious memory
 | 
			
		||||
 * corruption in the past.
 | 
			
		||||
 * The linker runs before we bring up libc and it's easiest
 | 
			
		||||
 * to make sure it does not depend on any complex libc features
 | 
			
		||||
 *
 | 
			
		||||
 * open issues / todo:
 | 
			
		||||
 *
 | 
			
		||||
 * - cleaner error reporting
 | 
			
		||||
 * - after linking, set as much stuff as possible to READONLY
 | 
			
		||||
 *   and NOEXEC
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// Override macros to use C++ style casts
 | 
			
		||||
#undef ELF_ST_TYPE
 | 
			
		||||
#define ELF_ST_TYPE(x) (static_cast<uint32_t>(x) & 0xf)
 | 
			
		||||
@@ -2444,7 +2429,7 @@ bool soinfo::prelink_image() {
 | 
			
		||||
  /* We can't log anything until the linker is relocated */
 | 
			
		||||
  bool relocating_linker = (flags_ & FLAG_LINKER) != 0;
 | 
			
		||||
  if (!relocating_linker) {
 | 
			
		||||
    INFO("[ linking %s ]", get_soname());
 | 
			
		||||
    INFO("[ linking %s ]", get_realpath());
 | 
			
		||||
    DEBUG("si->base = %p si->flags = 0x%08x", reinterpret_cast<void*>(base), flags_);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -3150,6 +3135,7 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(
 | 
			
		||||
  for (const auto& ld_preload_name : g_ld_preload_names) {
 | 
			
		||||
    needed_library_name_list.push_back(ld_preload_name.c_str());
 | 
			
		||||
    ++needed_libraries_count;
 | 
			
		||||
    ++ld_preloads_count;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  for_each_dt_needed(si, [&](const char* name) {
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,6 @@
 | 
			
		||||
 | 
			
		||||
#include "private/KernelArgumentBlock.h"
 | 
			
		||||
 | 
			
		||||
static char** _envp;
 | 
			
		||||
static bool _AT_SECURE_value = true;
 | 
			
		||||
 | 
			
		||||
bool get_AT_SECURE() {
 | 
			
		||||
@@ -150,8 +149,8 @@ static bool __is_unsafe_environment_variable(const char* name) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void __sanitize_environment_variables() {
 | 
			
		||||
  char** src  = _envp;
 | 
			
		||||
  char** dst = _envp;
 | 
			
		||||
  char** src  = environ;
 | 
			
		||||
  char** dst = environ;
 | 
			
		||||
  for (; src[0] != nullptr; ++src) {
 | 
			
		||||
    if (!__is_valid_environment_variable(src[0])) {
 | 
			
		||||
      continue;
 | 
			
		||||
@@ -168,7 +167,7 @@ static void __sanitize_environment_variables() {
 | 
			
		||||
 | 
			
		||||
void linker_env_init(KernelArgumentBlock& args) {
 | 
			
		||||
  // Store environment pointer - can't be null.
 | 
			
		||||
  _envp = args.envp;
 | 
			
		||||
  environ = args.envp;
 | 
			
		||||
 | 
			
		||||
  __init_AT_SECURE(args);
 | 
			
		||||
  __sanitize_environment_variables();
 | 
			
		||||
@@ -179,7 +178,7 @@ const char* linker_env_get(const char* name) {
 | 
			
		||||
    return nullptr;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  for (char** p = _envp; p[0] != nullptr; ++p) {
 | 
			
		||||
  for (char** p = environ; p[0] != nullptr; ++p) {
 | 
			
		||||
    const char* val = env_match(p[0], name);
 | 
			
		||||
    if (val != nullptr) {
 | 
			
		||||
      if (val[0] == '\0') {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										47
									
								
								linker/tests/Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								linker/tests/Android.bp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright (C) 2012 The Android Open Source Project
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
//      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
cc_test {
 | 
			
		||||
    name: "linker-unit-tests",
 | 
			
		||||
    multilib: {
 | 
			
		||||
        lib32: {
 | 
			
		||||
            stem: "linker-unit-tests32",
 | 
			
		||||
        },
 | 
			
		||||
        lib64: {
 | 
			
		||||
            stem: "linker-unit-tests64",
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    cflags: [
 | 
			
		||||
        "-g",
 | 
			
		||||
        "-Wall",
 | 
			
		||||
        "-Wextra",
 | 
			
		||||
        "-Wunused",
 | 
			
		||||
        "-Werror",
 | 
			
		||||
        "-std=gnu++11",
 | 
			
		||||
    ],
 | 
			
		||||
    local_include_dirs: ["/../../libc/"],
 | 
			
		||||
 | 
			
		||||
    srcs: [
 | 
			
		||||
        "linked_list_test.cpp",
 | 
			
		||||
        "linker_block_allocator_test.cpp",
 | 
			
		||||
        "../linker_block_allocator.cpp",
 | 
			
		||||
        "linker_memory_allocator_test.cpp",
 | 
			
		||||
        "../linker_allocator.cpp",
 | 
			
		||||
        // for __libc_fatal
 | 
			
		||||
        "../../libc/bionic/libc_logging.cpp",
 | 
			
		||||
    ],
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								tools/Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tools/Android.bp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
subdirs = ["relocation_packer"]
 | 
			
		||||
							
								
								
									
										119
									
								
								tools/relocation_packer/Android.bp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								tools/relocation_packer/Android.bp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,119 @@
 | 
			
		||||
//
 | 
			
		||||
// Copyright (C) 2015 The Android Open Source Project
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
//      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
common_cppflags = [
 | 
			
		||||
    "-Wall",
 | 
			
		||||
    "-Wextra",
 | 
			
		||||
    "-Wunused",
 | 
			
		||||
    "-Werror",
 | 
			
		||||
    "-Wold-style-cast",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
cc_library_host_static {
 | 
			
		||||
 | 
			
		||||
    srcs: [
 | 
			
		||||
        "src/debug.cc",
 | 
			
		||||
        "src/delta_encoder.cc",
 | 
			
		||||
        "src/elf_file.cc",
 | 
			
		||||
        "src/packer.cc",
 | 
			
		||||
        "src/sleb128.cc",
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    static_libs: ["libelf"],
 | 
			
		||||
    include_dirs: ["external/elfutils/src/libelf"],
 | 
			
		||||
    name: "lib_relocation_packer",
 | 
			
		||||
 | 
			
		||||
    cppflags: common_cppflags,
 | 
			
		||||
 | 
			
		||||
    target: {
 | 
			
		||||
        darwin: {
 | 
			
		||||
            disabled: true
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
cc_binary_host {
 | 
			
		||||
 | 
			
		||||
    srcs: ["src/main.cc"],
 | 
			
		||||
    static_libs: [
 | 
			
		||||
        "lib_relocation_packer",
 | 
			
		||||
        "libelf",
 | 
			
		||||
    ],
 | 
			
		||||
    stl: "libc++_static",
 | 
			
		||||
    include_dirs: [
 | 
			
		||||
        "external/elfutils/src/libelf",
 | 
			
		||||
        "libnativehelper/include",
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    name: "relocation_packer",
 | 
			
		||||
 | 
			
		||||
    cppflags: common_cppflags,
 | 
			
		||||
 | 
			
		||||
    target: {
 | 
			
		||||
        darwin: {
 | 
			
		||||
            disabled: true
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
cc_test_host {
 | 
			
		||||
 | 
			
		||||
    srcs: [
 | 
			
		||||
        "src/debug_unittest.cc",
 | 
			
		||||
        "src/delta_encoder_unittest.cc",
 | 
			
		||||
        "src/elf_file_unittest.cc",
 | 
			
		||||
        "src/sleb128_unittest.cc",
 | 
			
		||||
        "src/packer_unittest.cc",
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    static_libs: [
 | 
			
		||||
        "lib_relocation_packer",
 | 
			
		||||
        "libelf",
 | 
			
		||||
    ],
 | 
			
		||||
    include_dirs: ["external/elfutils/src/libelf"],
 | 
			
		||||
 | 
			
		||||
    cppflags: common_cppflags,
 | 
			
		||||
 | 
			
		||||
    name: "relocation_packer_unit_tests",
 | 
			
		||||
 | 
			
		||||
    target: {
 | 
			
		||||
        darwin: {
 | 
			
		||||
            disabled: true
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// $(1) library name
 | 
			
		||||
// ANDROIDMK TRANSLATION ERROR: unsupported directive
 | 
			
		||||
// define  copy-test-library
 | 
			
		||||
// include $(CLEAR_VARS)
 | 
			
		||||
// LOCAL_IS_HOST_MODULE := true
 | 
			
		||||
// LOCAL_MODULE := $(1)
 | 
			
		||||
// LOCAL_MODULE_CLASS := SHARED_LIBRARIES
 | 
			
		||||
// LOCAL_MODULE_PATH := $(HOST_OUT_EXECUTABLES)
 | 
			
		||||
// LOCAL_STRIP_MODULE := false
 | 
			
		||||
// LOCAL_SRC_FILES := test_data/$(1)
 | 
			
		||||
// include $(BUILD_PREBUILT)
 | 
			
		||||
//
 | 
			
		||||
// ANDROIDMK TRANSLATION ERROR: unsupported line
 | 
			
		||||
// $(eval $(call copy-test-library,elf_file_unittest_relocs_arm32.so))
 | 
			
		||||
// ANDROIDMK TRANSLATION ERROR: unsupported line
 | 
			
		||||
// $(eval $(call copy-test-library,elf_file_unittest_relocs_arm32_packed.so))
 | 
			
		||||
// ANDROIDMK TRANSLATION ERROR: unsupported line
 | 
			
		||||
// $(eval $(call copy-test-library,elf_file_unittest_relocs_arm64.so))
 | 
			
		||||
// ANDROIDMK TRANSLATION ERROR: unsupported line
 | 
			
		||||
// $(eval $(call copy-test-library,elf_file_unittest_relocs_arm64_packed.so))
 | 
			
		||||
@@ -37,11 +37,13 @@ static constexpr int32_t DT_ANDROID_RELASZ = DT_LOOS + 5;
 | 
			
		||||
static constexpr uint32_t SHT_ANDROID_REL = SHT_LOOS + 1;
 | 
			
		||||
static constexpr uint32_t SHT_ANDROID_RELA = SHT_LOOS + 2;
 | 
			
		||||
 | 
			
		||||
static const size_t kPageSize = 4096;
 | 
			
		||||
 | 
			
		||||
// Alignment to preserve, in bytes.  This must be at least as large as the
 | 
			
		||||
// largest d_align and sh_addralign values found in the loaded file.
 | 
			
		||||
// Out of caution for RELRO page alignment, we preserve to a complete target
 | 
			
		||||
// page.  See http://www.airs.com/blog/archives/189.
 | 
			
		||||
static constexpr size_t kPreserveAlignment = 4096;
 | 
			
		||||
static const size_t kPreserveAlignment = kPageSize;
 | 
			
		||||
 | 
			
		||||
// Get section data.  Checks that the section has exactly one data entry,
 | 
			
		||||
// so that the section size and the data size are the same.  True in
 | 
			
		||||
@@ -318,9 +320,13 @@ static void AdjustProgramHeaderOffsets(typename ELF::Phdr* program_headers,
 | 
			
		||||
    } else {
 | 
			
		||||
      program_header->p_vaddr -= hole_size;
 | 
			
		||||
      program_header->p_paddr -= hole_size;
 | 
			
		||||
      if (program_header->p_align > kPageSize) {
 | 
			
		||||
        program_header->p_align = kPageSize;
 | 
			
		||||
      }
 | 
			
		||||
      VLOG(1) << "phdr[" << i
 | 
			
		||||
              << "] p_vaddr adjusted to "<< program_header->p_vaddr
 | 
			
		||||
              << "; p_paddr adjusted to "<< program_header->p_paddr;
 | 
			
		||||
              << "; p_paddr adjusted to "<< program_header->p_paddr
 | 
			
		||||
              << "; p_align adjusted to "<< program_header->p_align;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user