Commit graph

25370 commits

Author SHA1 Message Date
Christopher Ferris
76a1d45599 Update to v4.17.3 kernel headers.
Test: Builds, boots on a walleye.
Change-Id: I389d8b61ec00ea309e38d1b1a2e0dace48c21edb
2018-06-27 14:12:29 -07:00
Treehugger Robot
6747bd1631 Merge "Set __bionic_asm_align to 16 for arm64" 2018-06-26 21:22:31 +00:00
Adhemerval Zanella
37d4e67bb0 Set __bionic_asm_align to 16 for arm64
As for others targets, it is better to align function text by minimim
cacheline size.  This patch changes arm __bionic_asm_align to 16.

Test: bionic tests on aarch64.
Change-Id: Ib121663c65493d33d6803e2c5139d247a8cae858
2018-06-26 15:58:52 -03:00
Treehugger Robot
92c6f7ee90 Merge "Remove relocation_packer." 2018-06-25 18:22:00 +00:00
Treehugger Robot
41e22b86cf Merge "bionic: Remove libc/Android.mk file" 2018-06-25 10:03:00 +00:00
Elliott Hughes
386ae3aff6 Remove relocation_packer.
We'll be using the lld built-in relocation packing going forward.

Bug: http://b/110715614
Test: builds
Change-Id: Ib3c086b642b8e3ab1dac022c0edef3b91665e477
2018-06-22 15:52:27 -07:00
Elliott Hughes
cff9dfacdc Merge "Don't emit warning on missing directories" 2018-06-21 21:16:25 +00:00
Jiyong Park
d3c08f28a3 Don't emit warning on missing directories
Some directories (e.g., /product/bin, etc.) in ld.config.txt may
not exist in some devices. Since many of them are optional directories,
don't emit warning when realpath() gives ENOENT for the paths.

Test: m -j
Change-Id: Ic4fa7db05bde53d3aa5df47291e83b4cdc09aa1f
2018-06-22 00:59:23 +09:00
Treehugger Robot
23f86f4f34 Merge "Resolve paths of dir.${section} if possible" 2018-06-21 05:05:17 +00:00
Treehugger Robot
90a20cd28d Merge "Add sinf/cosf/sincosf benchmark" 2018-06-21 02:05:27 +00:00
Treehugger Robot
3e637de184 Merge "Add logf and log2f benchmark" 2018-06-20 23:34:19 +00:00
Treehugger Robot
52a7e7e1bc Merge "Add powf benchmark" 2018-06-20 21:47:45 +00:00
Treehugger Robot
5fbda0ddb4 Merge "Add expf and exp2f benchmark" 2018-06-20 19:43:06 +00:00
Treehugger Robot
a03fbbd37b Merge "Mark bionic-loader-test-libs-target as a phony rule" 2018-06-19 15:10:30 +00:00
Adhemerval Zanella
7871ca1075 Add sinf/cosf/sincosf benchmark
Similar to expf/exp2f, this patch add two benchmarks for sinf, cosf, and
sincosf: one which measures thoughput as default and one which measures
latency.

The input in 512 random value divided in 8 ranges:

  1. 0.0 <= x < 0.1
  2. 0.1 <= x < 0.7
  3. 0.7 <= x < 3.1
  4. -3.1 <= x < 3.1
  5. 3.3 <= x < 33.3
  6. 100.0 <= x < 1000.0
  7. 1e6 <= x < 1e32
  8. 1e32 < x < FLT_MAX

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: I92bc2f1fac911c573c5122911d08ca590311578a
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
ff5a353112 Add logf and log2f benchmark
Similar to expf/exp2f, this patch add two benchmarks for logf and log2f:
one which measures thoughput and one which measures latency.

The input data is based on a reduced trace based on 2.8 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: If4fbd7eb3d40f8e155935149a82f162b222d5506
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
872c8b5133 Add powf benchmark
As for expf/exp2f benchmark, this patch add two benchmark for powf:
one which measures thoughput and one which measures latency.

The input data is based on a reduced trace from 2.3 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: Id8943d90dd5452146e55fb75708daaf7bf0e25fa
2018-06-19 11:34:54 -03:00
Adhemerval Zanella
357f6c1b47 Add expf and exp2f benchmark
This patch add two benchmarks for both expf and exp2f, one which
measures thoughput, as default, and one which measures latency. The
latency benchmark works by creating a dependency on the previous
iteration and with a zero multiply to avoid changing the input value.

The input is based on a reduced trace based on 2.4 billion samples
extracted from specpu2017 521.wrf_r benchmark.

Test: ran 32-bit and 64-bit x86 tests on host
Change-Id: Ic0d40cc4977dd6875fb7431146fc38ea0e6e0bc2
2018-06-19 11:34:54 -03:00
Dan Willemsen
901055eec7 Mark bionic-loader-test-libs-target as a phony rule
This essentially was phony before, but it wasn't marked as such. Mark it
so that we can turn on some more sanity checks in the build.

Test: Fewer warnings when --warn_real_to_phony is enabled for kati
Change-Id: I5f02b291ca01141dea75977df8b5ef9630917eb2
2018-06-18 20:23:14 -07:00
Inseob Kim
216323bd84 Resolve paths of dir.${section} if possible
Some devices place some of their partitions under /system. If the linker
resolves that paths, verboseness of ld.config.txt will be reduced as we
don't need to add both /system/{partition} and /{partition}.

Bug: http://b/80422611
Test: m -j, boot on taimen, atest
Change-Id: I6b712170bb89229b764026e2cc517c426e6e6063
2018-06-18 19:16:34 +09:00
Bernie Innocenti
0912d76b96 bionic: Remove libc/Android.mk file
Since there are no longer any Android.mk files in subdirs, the
top-level one can go.

Test: m
Change-Id: Ifc51545fc82a5eaa0801babd3ede20d911f1b9c3
2018-06-18 05:22:15 +00:00
Christopher Ferris
520ad0cae8 Merge "Change heap dump format slightly." 2018-06-15 21:36:42 +00:00
Christopher Ferris
2e1a40a203 Change heap dump format slightly.
Bump the version from v1.1 to v1.2 and add a build fingerprint line.

Update the heap dump documentation to match the new format and reflect
what made it in P and what made it in Q.

Update the unit tests for this change.

Add -O0 to unit test code to make it easier to debug.

Add an external function that can be used by the framework code
so that there is only one way to dump the heap.

Bug: 110095681

Test: Ran unit tests.
Test: Did a dump of a real process and verified fingerprint.
Test: Did a dump of a process without malloc debug enabled.
Change-Id: I769a476cbeaf4c85c5d75bd6d6385f0e3add948c
Merged-In: I769a476cbeaf4c85c5d75bd6d6385f0e3add948c
(cherry picked from commit c84a2a2601)
2018-06-15 12:29:13 -07:00
Treehugger Robot
2583b0adb2 Merge changes from topic "sharedlib_in_recovery"
* changes:
  dynamic linker is running for init
  Build recovery variant of the dynamic linker
2018-06-13 23:14:29 +00:00
Treehugger Robot
79d8ecb9fb Merge "Remove valgrind workarounds." 2018-06-13 00:30:28 +00:00
Elliott Hughes
95bca3f7d4 Remove valgrind workarounds.
Bug: http://b/77856586
Test: ran 32-bit x86 tests on host
Change-Id: I98f6262bb1363ed5c8dd533b1f89b59b2b188525
2018-06-12 15:29:36 -07:00
Haibo Huang
2bf96b73bb Merge "Make memcpy memmove" 2018-06-12 18:09:36 +00:00
Haibo Huang
8a0f0ed5e7 Make memcpy memmove
Bug: http://b/63992911
Test: Change BoardConfig.mk and compile for each variant
Change-Id: Ia0cc68d8e90e3316ddb2e9ff1555a009b6a0c5be
2018-06-11 18:12:45 +00:00
Jiyong Park
31cd08f9eb dynamic linker is running for init
init is now built as a dynamic executable, so the dynamic linker has to
be able to run in the init process. However, since init is launched so
early, even /dev/* and /proc/* file systems are not mounted and thus
some APIs that rely on the paths do not work. The dynamic linker now
goes alternative path when it is running in the init process.

For example, /proc/self/exe is not read for the init since we always now
the path of the init (/init). Also, arc4random* APIs are not used since
the APIs rely on /dev/urandom. Linker now does not randomize library
loading order and addresses when running in the init process.

Bug: 80454183
Test: `adb reboot recovery; adb devices` shows the device ID
Change-Id: I29b6d70e4df5f7f690876126d5fe81258c1d3115
2018-06-08 14:50:14 +09:00
Jiyong Park
8d7866c58f Build recovery variant of the dynamic linker
In order to support shared libraries in the recovery mode, the dynamic
linker is now built with recovery_available: true option.

In addition, a few more modules (such as libasync, etc.) are also marked
as recovery_available: true as they are transitive dependencies of the
dynamic linker.

Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: `adb root && adb shell` and then
$ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from
the /lib directory.

Change-Id: Idd981d8cf25568a85b24032cf78e50adfd5f4a7f
2018-06-08 14:49:56 +09:00
Treehugger Robot
42596b7bf0 Merge "Add missing __INTRODUCED_IN to pthread_attr_setinheritsched/pthread_attr_getinheritsched." 2018-06-07 18:15:41 +00:00
Elliott Hughes
7c5bbf627c Add missing __INTRODUCED_IN to pthread_attr_setinheritsched/pthread_attr_getinheritsched.
Bug: https://github.com/android-ndk/ndk/issues/716
Test: N/A
Change-Id: Ie49f96976f93b0f0d59796169e98918a9f69c0df
2018-06-07 09:11:47 -07:00
Dimitry Ivanov
3bc5e74c54 Merge "Relax check on number of segments in a .so file" 2018-06-06 16:07:53 +00:00
dimitry
3b0a5b7347 Relax check on number of segments in a .so file
This check was not necessary since it is perfectly fine for a dso to
have any number of PT_LOAD segments, given that the number is > 0.

Bug: http://b/109747297
Test: make
Change-Id: I0e3b400fddf05ed7b9342bacbfffd3b578f26cf3
2018-06-06 11:22:20 +02:00
Christopher Ferris
910c11767f Merge "Add an example of how to use multiple options." 2018-06-05 19:22:47 +00:00
Christopher Ferris
1d52a7b1be Add an example of how to use multiple options.
Test: NA
Change-Id: I67b6c2f8eb8ad8ead98969e69990f540ecd9a770
2018-06-01 13:42:25 -07:00
Treehugger Robot
5b867699fd Merge "Avoid post-reloc GOT usage in __linker_init" 2018-06-01 03:50:36 +00:00
Ryan Prichard
742982d3a0 Avoid post-reloc GOT usage in __linker_init
A GOT lookup happening prior to soinfo::link_image causes a segfault. With
-O0, the compiler moves GOT lookups from after __linker_init's link_image
call to the start of __linker_init.

Rename the existing __linker_init_post_relocation to linker_main, then
extract the existing post-link_image code to a new
__linker_init_post_relocation function.

Bug: http://b/80503879
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Test: manual
Change-Id: If8a470f8360acbe35e2a308b0fbff570de6131cf
2018-05-31 17:04:52 -07:00
Treehugger Robot
fe55c272ad Merge "Initialize __libc_sysinfo early on." 2018-05-31 22:32:32 +00:00
Treehugger Robot
30144561a4 Merge "Fix name of env variable in malloc_hooks README." 2018-05-31 18:17:40 +00:00
Florian Mayer
14e54c0d30 Fix name of env variable in malloc_hooks README.
Change-Id: I172ef71c9d74ec6e4bc51fe2bd8e4587b801b71c
2018-05-31 17:36:24 +01:00
Treehugger Robot
6ef8415d09 Merge "Inline __libc_init_global_stack_chk_guard." 2018-05-31 02:22:06 +00:00
Treehugger Robot
8b14ed45ec Merge "Clean up TLS_SLOT_BIONIC_PREINIT usage a bit" 2018-05-31 01:45:41 +00:00
Ryan Prichard
27475b5105 Initialize __libc_sysinfo early on.
__libc_sysinfo is hidden, so accessing it doesn't require a relocated GOT.
It is important not to have a relocatable initializer on __libc_sysinfo,
because if it did have one, and if we initialized it before relocating the
linker, then on 32-bit x86 (which uses REL rather than RELA), the
relocation step would calculate the wrong addend and overwrite
__libc_sysinfo with garbage.

Asides:

 * It'd be simpler to keep the __libc_sysinfo initializer for static
   executables, but the loader pulls in libc_init_static (even though it
   uses almost none of the code in that file, like __libc_init).

 * The loader has called __libc_init_sysinfo three times by the time it
   has relocated itself. A static executable calls it twice, while libc.so
   calls it only once.

Bug: none
Test: lunch aosp_x86-userdebug ; emulator
Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
Change-Id: I5944f57847db7191608f4f83dde22b49e279e6cb
2018-05-30 16:44:23 -07:00
Ryan Prichard
cb5f410006 Inline __libc_init_global_stack_chk_guard.
Prior to b6453c52ac, this function
was called from two C++ files.

Test: boot hikey
Change-Id: Ieeae6ea617c5b19e2cd76c1b37c9511a72d01597
2018-05-30 16:10:35 -07:00
Ryan Prichard
6631f9b03d Clean up TLS_SLOT_BIONIC_PREINIT usage a bit
- It is only needed for dynamic executables, so move the initialization
   out of __libc_init_main_thread and just before the solib constructor
   calls. For static executables, the slot was initialized, then never
   used or cleared. Instead, leave it clear.

 - For static executables, __libc_init_main_thread already initialized the
   stack guard, so remove the redundant __init_thread_stack_guard call.

 - Simplify the slot access/clearing a bit in __libc_preinit.

 - Remove the "__libc_init_common() will change the TLS area so the old one
   won't be accessible anyway." comment. AFAICT, it's incorrect -- the
   main thread's TLS area in a dynamic executable is initialized to a
   static pthread_internal_t object in the linker, then reused by libc.so.

Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
Change-Id: Ie2da6f5be3ad563fa65b38eaadf8ba6ecc6a64b6
2018-05-30 15:43:43 -07:00
Haibo Huang
d0c330b5d8 Merge "Use cortex-a53/bionic/memmove.S by default for arm64" 2018-05-30 22:26:57 +00:00
Haibo Huang
ece43e14c9 Use cortex-a53/bionic/memmove.S by default for arm64
cortex-a53/bionic/memmove.S looks like a more optimized version. It
should be used in most cases. It delegates small (<= 96 bytes) moves
to memcpy.

The only exception is denver64. It is using its own memcpy, which
doesn't allow overlap for < 96 bytes copies. Only for this variant we
need generic/bionic/memmove.S.

Benchmark result looks pretty close through (on marlin)

Before: using generic/bionic/memmove.S

-------------------------------------------------------------------
Benchmark                            Time           CPU Iterations
-------------------------------------------------------------------
BM_string_memcpy/8/0/0               6 ns          6 ns  108872005   1.15787GB/s
BM_string_memcpy/64/0/0              7 ns          7 ns  107387438   9.14365GB/s
BM_string_memcpy/512/0/0            21 ns         20 ns   34165353   23.2734GB/s
BM_string_memcpy/1024/0/0           40 ns         39 ns   17766657   24.2346GB/s
BM_string_memcpy/8192/0/0          311 ns        310 ns    2259904   24.6339GB/s
BM_string_memcpy/16384/0/0         616 ns        613 ns    1143027   24.8852GB/s
BM_string_memcpy/32768/0/0        1322 ns       1316 ns     530799   23.1835GB/s
BM_string_memcpy/65536/0/0        2672 ns       2661 ns     229638    22.937GB/s
BM_string_memcpy/131072/0/0       5379 ns       5357 ns     128316    22.788GB/s

After: using cortex-a53/bionic/memmove.S

-------------------------------------------------------------------
Benchmark                            Time           CPU Iterations
-------------------------------------------------------------------
BM_string_memcpy/8/0/0               6 ns          6 ns  116610749   1.24646GB/s
BM_string_memcpy/64/0/0              6 ns          6 ns  115634093   9.84708GB/s
BM_string_memcpy/512/0/0            21 ns         21 ns   34167322   22.8938GB/s
BM_string_memcpy/1024/0/0           39 ns         39 ns   17859445   24.3312GB/s
BM_string_memcpy/8192/0/0          311 ns        310 ns    2260192   24.6325GB/s
BM_string_memcpy/16384/0/0         610 ns        608 ns    1151889   25.0987GB/s
BM_string_memcpy/32768/0/0        1488 ns       1482 ns     532508   20.5988GB/s
BM_string_memcpy/65536/0/0        2421 ns       2411 ns     290502   25.3146GB/s
BM_string_memcpy/131072/0/0       5278 ns       5256 ns     132710   23.2234GB/s

Test: Build and benchmark on marlin
Bug: http://b/63992911
Change-Id: Id85961aca18ba841bcbcfe0d8b162843eab30584
2018-05-30 11:09:19 -07:00
Dimitry Ivanov
aa922bbaf3 Merge "Add secondary counter in place of tls_nodelete flag" 2018-05-30 15:32:40 +00:00
dimitry
55547db434 Add secondary counter in place of tls_nodelete flag
The tls_nodelete state should apply to load_group not
isolated soinfo. This actually also means that multiple
soinfos may have tls_counter on their dso_handles.

This change replaces TLS_NODELETE flag with secondary counter.
Note that access to the secondary counter (located inside soinfo)
is pretty expensive because it requires soinfo lookup by dso_handle
whereas dso_handle counter is much faster. This is why it is updated
only when dso_handle counter starts or hits 0.

Bug: http://b/80278285
Test: bionic-unit-tests --gtest_filter=dl*
Change-Id: I535583f6714e45fa2a7eaf7bb3126da20ee7cba9
2018-05-30 10:56:59 +02:00