Commit graph

564 commits

Author SHA1 Message Date
Chris Wailes
559f27828c Clear the stack frame pointer in _start and __bionic_clone
This CL adds an instruction to the _start label that clears the frame
pointer.  This allows stack walking code to determine when it has
reached the end of the stack.

The __bionic_clone function is similarly modified, for architectures
that weren't already doing both.

Test: bionic-unit-tests
Test: CtsBionicTestCases
Change-Id: Iea3949f52c44f7931f9fff2d60d4d9e5c742c120
2021-05-07 15:00:55 -07:00
Elliott Hughes
c0d41db92e setjmp/longjmp: avoid invalid values in the stack pointer.
arm64 was already being careful, but x86/x86-64 and 32-bit ARM could be
caught by a signal in a state where the stack pointer was mangled.

For 32-bit ARM I've taken care with the link register too, to avoid
potential issues with unwinding.

Bug: http://b/152210274
Test: treehugger
Change-Id: I1ce285b017a633c732dbe04743368f4cae27af85
2021-04-05 17:43:36 -07:00
Chih-Hung Hsieh
5cb4d9cef9 Fix "deprecated instruction in IT block" warning
Bug: 179266557
Test: make with new clang compiler
Change-Id: I963609861659cbb2be8ed467654109938185c747
2021-02-03 20:54:52 -08:00
Evgenii Stepanov
dec48bdd9e (NFC) Symbolic names for Android ELF note types.
Bug: b/135772972
Test: none

Change-Id: Ia972200337d4e9a2adeba196edd06dd98348b6cd
2021-01-05 15:25:39 -08:00
Elliott Hughes
cf346532fc More cleanup for #inclusivefixit.
Found manually with grep, since the script seems to miss stuff.

Test: treehugger
Change-Id: I5933cbade9792801d4a0bec1ccb077efa6ad8fbc
2020-07-31 10:35:03 -07:00
Josh Gao
2303283740 Track whether a thread is currently vforked.
Our various fd debugging facilities get extremely confused by a vforked
process closing file descriptors in preparation to exec: fdsan can
abort, and fdtrack will delete backtraces for any file descriptors that
get closed. Keep track of whether we're in a vforked child in order to
be able to detect this.

Bug: http://b/153926671
Test: 32/64-bit bionic-unit-tests on blueline, x86_64 emulator
Change-Id: I8a082fd06bfdfef0e2a88dbce350b6f667f7df9f
2020-05-07 19:44:27 -07:00
Peter Collingbourne
900d07d6a1 Add arm64 string.h function implementations for use with hardware supporting MTE.
As it turns out, our "generic" arm64 implementations of certain string.h
functions are not actually generic, since they will eagerly read memory
possibly outside of the bounds of an MTE granule, which may lead to a segfault
on MTE-enabled hardware. Therefore, move the implementations into a "default"
directory and use ifuncs to select between them and a new set of "mte"
implementations, conditional on whether the hardware and kernel support MTE.

The MTE implementations are currently naive implementations written in C
but will later be replaced with a set of optimized assembly implementations.

Bug: 135772972
Change-Id: Ife37c4e0e6fd60ff20a34594cc09c541af4d1dd7
2019-10-29 16:18:31 -07:00
Ryan Prichard
22a6a058c7 Move dl_unwind_find_exidx from libdl.a to libc.a
arm32 has two special APIs to find exidx exception handling info,
dl_unwind_find_exidx and __gnu_Unwind_Find_exdix. The two functions have
identical behavior and function prototypes. libgcc's arm32 unwinder calls
__gnu_Unwind_Find_exdix, whereas LLVM's libunwind previously called
__gnu_Unwind_Find_exdix, but switched to dl_unwind_find_exidx as a result
of three patches (D30306, D30681, D39468).

In Bionic, for dynamic linking, __gnu_Unwind_Find_exdix in libc.so calls
dl_unwind_find_exidx in libdl.so.

For static executables, though, __gnu_Unwind_Find_exdix in libc.a used the
__exidx_* symbols, while dl_unwind_find_exidx in libdl.a(libdl_static.o)
was a return-0 no-op.

To fix the LLVM unwinder, replace the no-op dl_unwind_find_exidx in
libdl.a with a real function in libc.a(exidx_static.o), and have the GNU
function call the dl function for more consistency with dynamic linking.

dl_iterate_phdr follows a similar pattern, where the function exists in
libc.a and libdl.so (not libc.so or libdl.a).

This change makes unwinding work with an updated libunwind_llvm on arm32,
and it helps to allow unwinding in static executables without libdl.a.

Bug: https://github.com/android/ndk/issues/1094
Bug: http://b/141485154
Test: NDK tests, bionic unit tests
Change-Id: Ieeeb9b39a0e28544e21f9afe6fe51ef10d7c828c
2019-10-14 16:34:12 -07:00
Christopher Ferris
c5d3a4348a Make tls related header files platform accessible.
There are places in frameworks and art code that directly included
private bionic header files. Move these files to the new platform
include files.

This change also moves the __get_tls.h header file to tls.h and includes
the tls defines header so that there is a single header that platform
code can use to get __get_tls and the defines.

Also, simplify the visibility rules for platform includes.

Bug: 141560639

Test: Builds and bionic unit tests pass.
Change-Id: I9e5e9c33fe8a85260f69823468bc9d340ab7a1f9
Merged-In: I9e5e9c33fe8a85260f69823468bc9d340ab7a1f9
(cherry picked from commit 44631c919a)
2019-09-27 12:14:24 -07:00
Elliott Hughes
a4c7876c01 ifuncs: start sharing.
We're going to have to add ifuncs to libm, and there will be some SVE
ones for arm64 soon too, so let's start sharing the absolute minimum...

Test: builds
Change-Id: Idbb9dd9477291ed3c15dc3902f65e593b766dfb9
2019-09-17 12:44:41 -07:00
Jake Weinstein
bff53b2617 libc: import ARM strcmp from newlib
* Current version is also based on newlib, but an older revision

* The Krait and A9 specific changes no longer seem relevant, so
  let's use A15 directly.

Tested on OnePlus 3 (MSM8996):

Before (Krait strcmp):
                                       iterations      ns/op
BM_string_strcmp/8                          1000k         24    0.322 GiB/s
BM_string_strcmp/64                           20M        123    0.519 GiB/s
BM_string_strcmp/512                           2M        920    0.556 GiB/s
BM_string_strcmp/1024                       1000k       1818    0.563 GiB/s
BM_string_strcmp/8Ki                         200k      14405    0.569 GiB/s
BM_string_strcmp/16Ki                        100k      28762    0.570 GiB/s
BM_string_strcmp/32Ki                         50k      57526    0.570 GiB/s
BM_string_strcmp/64Ki                         10k     114959    0.570 GiB/s

After:
                                       iterations      ns/op
BM_string_strcmp/8                          1000k         28    0.284 GiB/s
BM_string_strcmp/64                           20M        107    0.596 GiB/s
BM_string_strcmp/512                           2M        800    0.639 GiB/s
BM_string_strcmp/1024                       1000k       1579    0.649 GiB/s
BM_string_strcmp/8Ki                         200k      12469    0.657 GiB/s
BM_string_strcmp/16Ki                        100k      24931    0.657 GiB/s
BM_string_strcmp/32Ki                         50k      49843    0.657 GiB/s
BM_string_strcmp/64Ki                         20k      99635    0.658 GiB/s

Test: bionic-benchmarks BM_string_memcmp
Change-Id: Icb3bfb0a381bcc1e10885ca5e9547842c3f620d7
2019-05-16 04:37:26 +00:00
Yi Kong
7f3527fb5c Merge "Implement __gnu_[u]ldivmod_helper methods in libc" 2019-04-23 05:54:33 +00:00
Yi Kong
b410d0e69e Implement __gnu_[u]ldivmod_helper methods in libc
These symbols were previously provided by Android's out-dated libgcc,
but they're removed/deprecated in upstream libgcc, and also won't be
available in libclang_rt.builtins. We need to provide these methods in
libc itself for compatiblity.

Test: build with these symbols stripped in libgcc
Bug: 29275768
Change-Id: I04a05258c6c06b5a22ead41e148b02792ffbc941
2019-04-22 18:12:55 -07:00
Elliott Hughes
1311545bb2 Merge "Reland ifuncs for strcmp and strlen." 2019-04-22 23:32:33 +00:00
Elliott Hughes
927fe99692 Reland ifuncs for strcmp and strlen.
This reverts commit e4788d4c7e,
which undid this change during the Q betas.

Bug: http://b/120989619
Change-Id: Iea589fd0e56426971adf9f7c19c2aedf0d7a7a60
2019-04-22 18:57:21 +00:00
Elliott Hughes
782c485880 Generate assembler system call stubs via genrule.
There's no need to check in generated code.

Test: builds & boots
Change-Id: Ife368bca4349d4adeb0666db590356196b4fbd63
2019-04-16 12:31:00 -07:00
Elliott Hughes
d67b03734d libc: generate syscall stubs in one big file...
...all the better to switch to a genrule rather than checking in
generated source.

This also removes all the code in the script to deal with git,
rather than fix it. We won't need that where we're going.

Test: boots
Change-Id: I468ce019d4232a7ef27e5cb5cfd89f4c2fe4ecbd
2019-04-16 00:54:11 +00:00
Yi Kong
e3d90de50b Switch libm to libcrt.builtins
After switching libm from libgcc to libcrt.builtins, some of the symbols
are no longer getting included in libm, causing the compiler to complain
about missing symbols from the version script. Explicitly export them in
libc (since libm depends on libc).

Bug: 122993571
Test: m checkbuild
Test: bionic-unit-tests
Change-Id: Ie91765874d20df605f557b1a8c4236619553c549
2019-02-22 13:33:15 -08:00
Yi Kong
165b1cf57b Switch libc to libcrt.builtins
With the switch to libcrt.builtins, some symbols no longer becomes
exported. Add dummy references to them to force them to be exported.
This is to maintain backwards binary compatibility with ancient Android
versions.

x86 and x86_64 crashes with libcrt, keep using libgcc for now.

Test: bionic-unit-tests
Bug: 29275768
Bug: 122993569
Change-Id: Ieab5af354e3924af4a03d888b28c6e75090cb613
2019-02-15 12:46:19 -08:00
Ryan Prichard
82aea78136 Use TLS_SLOT_THREAD_ID macro in vfork.S
No functional change intended.

Bug: none
Test: bionic unit tests
Change-Id: I7ee0a2b3f0e3807abe88bfa34ef3cd56c150a8f6
2019-01-16 01:11:26 -08:00
Ryan Prichard
45024fefe7 Add ARM EABI function __aeabi_read_tp
By default, Clang uses this arm32 function to read the thread pointer,
either for ELF TLS or via __builtin_thread_pointer(). It's probably better
to inline the cp15 access using -mtp=cp15, but that's not the default yet.

See https://reviews.llvm.org/D34878?id=114573.

Bug: http://b/78026329
Test: bionic unit tests
Change-Id: I93b8926075f0b2cea8df9ef518d54f2820a8ff5b
2019-01-07 20:30:35 -08:00
Kyle Repinski
78da73adad libc: Optimize ARM memcmp by using NEON.
Because NEON_UNALIGNED_ACCESS has never been defined, it has gone unused.
This change enables NEON optimization if __ARM_NEON__ is defined.

Test: bionic-benchmarks-32 BM_string_memcmp

On Nextbit Robin (MSM8992), here are the results

Before:
                                       iterations      ns/op
BM_string_memcmp/8                            50M         28    0.277 GiB/s
BM_string_memcmp/64                           50M         54    1.169 GiB/s
BM_string_memcmp/512                           5M        444    1.151 GiB/s
BM_string_memcmp/1024                          2M        885    1.156 GiB/s
BM_string_memcmp/8Ki                         200k       7401    1.107 GiB/s
BM_string_memcmp/16Ki                        200k      14469    1.132 GiB/s
BM_string_memcmp/32Ki                        100k      28726    1.141 GiB/s
BM_string_memcmp/64Ki                         50k      57480    1.140 GiB/s

After:
                                       iterations      ns/op
BM_string_memcmp/8                            50M         22    0.351 GiB/s
BM_string_memcmp/64                         1000k         17    3.688 GiB/s
BM_string_memcmp/512                          20M        105    4.848 GiB/s
BM_string_memcmp/1024                         10M        190    5.367 GiB/s
BM_string_memcmp/8Ki                        1000k       1496    5.475 GiB/s
BM_string_memcmp/16Ki                       1000k       2746    5.966 GiB/s
BM_string_memcmp/32Ki                        500k       5481    5.978 GiB/s
BM_string_memcmp/64Ki                        200k      10971    5.973 GiB/s

Change-Id: I3c76ce7fa2796872e0171d5502b0ebd6e2893339
2018-12-22 01:04:27 +00:00
Haibo Huang
e4788d4c7e No ifunc for strcmp and strlen
This is a workaround to unbreak bank apps

Bug: 120254692
Test: Run broken apps
Change-Id: I47a655e9648a6d5f50856f712d8e1cf2be24b440
2018-12-12 04:28:29 +00:00
Haibo Huang
4af19611e2 Bionic: Support kryo385 CPU
Bug: 119564566
Test: build
Change-Id: I557fb6a860b777b7cdb6b97d6946847800a8cec6
2018-12-05 04:39:15 +00:00
Haibo Huang
01bfd8934e Remove denver from bionic
Test: bionic unit tests
Bug: 73545680
Change-Id: Ib142bf289ac73a3512ad1f29789ef82027160d78
2018-12-04 06:38:08 +00:00
Haibo Huang
73ad790ebe [ifunc] Use c implementation to compare cpu variant names
Did this for fun but turns out it generates better assembly code.

With a C implementation, compiler can expand both the comparison
loop and cpu_variant_names array. Results in a decision tree like
structure. For example the "cortex-a" prefix common in many variants
will only be compared once.

Test: run bionic unit tests.
Test: use debugger to check which variant is used.
Change-Id: Id70e5536f968161f20b18f35d46430457c338f0f
2018-11-30 07:56:22 +00:00
Haibo Huang
f1c8d1a6f9 Use ifunc for ARM32 fortify functions
Test: compile and run bionic unit tests
Test: make PRODUCT-sdk_phone_arm64-sdk
Change-Id: I614f495ad6053d507446a6a896b9199825325188
2018-11-28 10:56:21 -08:00
Haibo Huang
ea9957a72a Arm32 dynamic function dispatch
Previous change was reverted in 9690b121e3.
This change added .arch directive to kryo/ to avoid invalid instruction error.

Test: Run bionic unit test.
Test: Use gdb to make sure the right function is selected.
Test: Build previously failed target: make PRODUCT-sdk_phone_arm64-sdk
Change-Id: I14de41851121fc1a0b38c98fda5eb844b6a9695c
2018-11-26 20:00:55 +00:00
Izabela Orlowska
9690b121e3 Revert "Arm32 dynamic function dispatch"
This reverts commit ce4ff9c44d.

Reason for revert: broke master in ab/5138164 target sdk_phone_armv7-sdk

Change-Id: Ia4b0c7e6117a37df694509078116963f41d7865e
2018-11-19 14:14:41 +00:00
Haibo Huang
ce4ff9c44d Arm32 dynamic function dispatch
Test: Run bionic unit test.
Test: Use gdb to make sure the right function is selected.

Change-Id: I34ccd83d472c13993f75672b1aac2b2eae65c499
2018-11-16 19:50:17 +00:00
Elliott Hughes
3012b9636b Remove workarounds for old versions of clang and GCC.
Bug: N/A
Test: ran tests
Change-Id: I89d224c743f5113771de41c74161a7a5ccad05e4
2018-07-11 13:18:29 -07: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
Elliott Hughes
da46caee09 Add generic arm non-neon memmove.
From OpenBSD.

Bug: http://b/63992911
Test: ran tests
Change-Id: If7d9166922776cdc9333ff04205f9c6312a812b3
2018-05-24 14:57:15 -07:00
Treehugger Robot
4362da8076 Merge "Remove __overloadable/__RENAME_CLANG" 2018-02-10 02:30:37 +00:00
Dan Albert
55ca56c27c Fix __gnu_Unwind_Find_exidx again.
The math on the size calculation was wrong as the type of
__exidx_start/__exidx_end was unsigned rather than a char. Make a
struct that represents each item instead and remove the division.

Test: built artifacts and used them in the NDK
Bug: None
Change-Id: Ic2c0c123a369b9319e8645d806d659290eb2f69c
2018-02-06 17:23:33 -08:00
George Burgess IV
9024235005 Remove __overloadable/__RENAME_CLANG
Now that we have a clang that supports transparent overloads, we can
kill all of this cruft, and restore our upstream sources to their
untouched glory. Woohoo!

Bug: 12231437
Test: Built aosp_marlin; no obvious patch-related aosp_mips issues.
Change-Id: I520a19d014f12137f80e43f973dccd6711c571cd
2018-02-06 13:35:56 -08:00
Elliott Hughes
e58d49e76c Improve the comment in the ARM setjmp.S.
Based on code review comments for 460130b7d0.

Bug: N/A
Test: N/A
Change-Id: Ia86bc92dfe3f18261e06af33488a548ea9911b10
2018-02-05 13:36:02 -08:00
Elliott Hughes
460130b7d0 Fix sigsetjmp/siglongjmp to save/restore RT signals on arm/x86 too.
Our arm and x86 ABIs shipped with a 32-bit `sigset_t`, so we need to
use sigprocmask64 to save/restore the RT signals too. (This is important
because several are in use by the system, and the behavior of our 32-bit
`sigset_t` is to clear the RT signals.)

Bug: http://b/72493232
Test: ran tests
Change-Id: Idff91f8b2849276e5a3073d07eccd84e02a34410
2018-01-31 17:47:16 -08:00
Elliott Hughes
7ebafb365a Use sigprocmask rather than sigblock/sigsetmask.
No effect right now, because sigprocmask on LP32 also only touches
the non-RT signals, but this makes it easier to switch to __rt_sigprocmask.

Bug: http://b/72460436
Test: ran tests
Change-Id: I693f0ea36701e9ab5d10e6aefb26387ba45a6064
2018-01-29 10:23:01 -08:00
Dan Albert
aeb5bc658f Fix __gnu_Unwind_Find_exidx for static executables.
__exidx_start and __exidx_end are not actual values to be read, just
symbols placed before and after .ARM.exidx.

The default linker script for ARM static executables includes these
lines:

    __exidx_start = .;
   .ARM.exidx   : { *(.ARM.exidx*) }
    __exidx_end = .;

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0474c/BABEHEDA.html

Test: used __gnu_Unwind_Find_exidx in a static executable and showed
      non-bogus values
Test: verified that this fixes #593 in the NDK
Bug: https://github.com/android-ndk/ndk/issues/593
Change-Id: Ib35a4b6c82920666ae8a45aa0a2d43e458699b51
2018-01-25 12:48:57 -08:00
Elliott Hughes
2180978c88 Fix SYSCALLS.TXT now clock_getres comes from the vdso.
Bug: N/A
Test: ran tests
Change-Id: I122066992e1ab1aa38beed256103c3a22fd05a6f
2017-12-11 11:40:40 -08:00
Mark Salyzyn
79249b0897 bionic: add vdso clock_getres
clock_getres() should not be a hot call, nevertheless it is
~6-7 times faster for supported clock ids if it uses
__vdso_clock_getres if available.  There is a 3% performance
penalty for unsupported clock ids via __vdso_clock_getres with
respect to a direct syscall.

[TL;DR]

w/vdso32 kernel patches, locked cores to MAX, little cores only.

BEFORE:

hikey960 vdso (aarch64):

----------------------------------------------------------------------
Benchmark                               Time           CPU Iterations
----------------------------------------------------------------------
BM_time_clock_getres                  126 ns        126 ns    5577874
BM_time_clock_getres_syscall          127 ns        127 ns    5505016
BM_time_clock_getres_REALTIME         126 ns        126 ns    5574682
BM_time_clock_getres_BOOTTIME         126 ns        126 ns    5575237
BM_time_clock_getres_TAI              126 ns        126 ns    5576810
BM_time_clock_getres_unsupported      128 ns        128 ns    5480189

hikey960 vdso32 (aarch32):

----------------------------------------------------------------------
Benchmark                               Time           CPU Iterations
----------------------------------------------------------------------
BM_time_clock_getres                  199 ns        199 ns    3508708
BM_time_clock_getres_syscall          220 ns        220 ns    3184676
BM_time_clock_getres_REALTIME         199 ns        199 ns    3509697
BM_time_clock_getres_BOOTTIME         199 ns        199 ns    3513551
BM_time_clock_getres_TAI              200 ns        199 ns    3512412
BM_time_clock_getres_unsupported      196 ns        196 ns    3575609

x86_64 (glibc):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                 252 ns        252 ns    2370263
BM_time_clock_getres_syscall         215 ns        215 ns    3287497
BM_time_clock_getres_REALTIME        214 ns        214 ns    3294228
BM_time_clock_getres_BOOTTIME        213 ns        213 ns    3277519
BM_time_clock_getres_TAI             213 ns        213 ns    3294991
BM_time_clock_getres_unsupported     206 ns        206 ns    3450654

imx7d_pico IOT nyc (w/arm,cpu-registers-not-fw-configured) (armv7a):
(Virtual Timers)

Benchmark                           Time(ns)    CPU(ns) Iterations
------------------------------------------------------------------
BM_time_clock_getres                      16        345    2000000
BM_time_clock_getres_syscall              16        339    2121212
BM_time_clock_getres_REALTIME             17        350    2058824
BM_time_clock_getres_BOOTTIME             17        345    2000000
BM_time_clock_getres_TAI                  16        350    2000000
BM_time_clock_getres_unsupported          13        284    2500000

AFTER:

hikey960 vdso (aarch64):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                  18 ns         18 ns   37880389
BM_time_clock_getres_syscall         127 ns        127 ns    5520029
BM_time_clock_getres_REALTIME         18 ns         18 ns   37879962
BM_time_clock_getres_BOOTTIME         19 ns         18 ns   37878361
BM_time_clock_getres_TAI             131 ns        131 ns    5368484
BM_time_clock_getres_unsupported      97 ns         97 ns    7182864

hikey960 vdso32 (aarch32):

---------------------------------------------------------------------
Benchmark                              Time           CPU Iterations
---------------------------------------------------------------------
BM_time_clock_getres                  36 ns         36 ns   19205240
BM_time_clock_getres_syscall         212 ns        212 ns    3297100
BM_time_clock_getres_REALTIME         36 ns         36 ns   19219109
BM_time_clock_getres_BOOTTIME         36 ns         36 ns   19222490
BM_time_clock_getres_TAI             206 ns        206 ns    3402868
BM_time_clock_getres_unsupported     159 ns        159 ns    4409492

imx7d_pico IOT nyc (wo/arm,cpu-registers-not-fw-configured) (armv7a):
(Physical Timers)

Benchmark                           Time(ns)    CPU(ns) Iterations
------------------------------------------------------------------
BM_time_clock_getres                       2         48   14000000
BM_time_clock_getres_syscall              14        335    2058824
BM_time_clock_getres_REALTIME              2         49   14583333
BM_time_clock_getres_BOOTTIME              2         48   14000000
BM_time_clock_getres_TAI                  14        350    2058824
BM_time_clock_getres_unsupported           8        203    3500000

Test: taskset F \
        /data/benchmarktest{64}/bionic-benchmarks/bionic-benchmarks \
        --bionic_xml=vdso.xml --benchmark_filter=BM_time_clock_getres*
Bug: 63737556
Change-Id: I80c0a5106625d76720287f715fcf145d2aad1705
2017-12-07 09:41:48 -08:00
Elliott Hughes
12533271fb Give ELF notes 4-byte alignment.
Use .balign because what the argument means doesn't vary between
architectures.

Bug: http://b/70166421
Test: builds
Change-Id: I1d54f2f6942dd2893f3fda30bac08d07ea9cd346
2017-12-04 13:21:01 -08:00
dimitry
fa432524a6 Mark __BIONIC_WEAK_FOR_NATIVE_BRIDGE symbols
To make it easier for Native Bridge implementations
to override these symbols.

Bug: http://b/67993967
Test: make
Change-Id: I4c53e53af494bca365dd2b3305ab0ccc2b23ba44
2017-10-27 10:01:46 +02:00
Elliott Hughes
d4ca231ae2 Unified sysroot: kill arch-specific include dirs.
<machine/asm.h> was internal use only.

<machine/fenv.h> is quite large, but can live in <bits/...>.

<machine/regdef.h> is trivially replaced by saying $x instead of x in
our assembler.

<machine/setjmp.h> is trivially inlined into <setjmp.h>.

<sgidefs.h> is unused.

Bug: N/A
Test: builds
Change-Id: Id05dbab43a2f9537486efb8f27a5ef167b055815
2017-10-12 13:19:51 -07:00
Elliott Hughes
8465e968a8 Add <sys/random.h>.
iOS 10 has <sys/random.h> with getentropy, glibc >= 2.25 has
<sys/random.h> with getentropy and getrandom. (glibc also pollutes
<unistd.h>, but that seems like a bad idea.)

Also, all supported devices now have kernels with the getrandom system
call.

We've had these available internally for a while, but it seems like the
time is ripe to expose them.

Bug: http://b/67014255
Test: ran tests
Change-Id: I76dde1e3a2d0bc82777eea437ac193f96964f138
2017-09-29 05:31:35 +00:00
Elliott Hughes
896362eb0e Add syncfs(2).
GMM calls this system call directly at the moment. That's silly.

Bug: http://b/36405699
Test: ran tests
Change-Id: I1e14c0e5ce0bc2aa888d884845ac30dc20f13cd5
2017-08-24 16:31:49 -07:00
Isaac Chen
b890336756 Merge "Build support for 32-bit armv8-a" 2017-08-17 07:19:33 +00:00
Isaac Chen
d544fb7da0 Build support for 32-bit armv8-a
The assembly in arm's generic strlen implementation contains deprecated
instruction sequence:
    it      eq  ; start of IT block
    ldreq   ... ; 32-bit T32 insruction in IT block deprecated in armv8
This will cause compiler error because of -Winline-asm and -Werror.

The fix here is to change the sequence:
    it      eq
    ldreq   ...
    bne     1f
to equivalent sequence:
    bne     1f
    ldr     ...
The resulted sequence is (1 instruction) shorter.

See ARM for ARMv8 for details:
F6.2 Partial Deprecation of IT
... All uses of IT that apply to instructions other than a single
subsequent 16-bit instruction from a restricted set are deprecated, ...

Bug: 62895439
Test: "bionic-unit-tests-static --gtest_filter=*strlen*" on Nexus 4
      (krait), emulator (armv7), and sailfish (armv8).
      The test binary for the first 2 is built with armv7-a as its
      TARGET_CPU_ARCH; The test binary for the last is built with
      armv8-a as its TARGET_2ND_CPU_ARCH.
      TARGET(_2ND)_CPU_VARIANTs of both binaries are set to "generic".

Change-Id: Ia2208b4e2ba2cad589975bc7b4617688cbb8826a
2017-08-14 06:05:20 +00:00
George Burgess IV
d34b0a946c libc: Move FORTIFY into one file; make style fixups
This addresses post-commit feedback from
I88c39ca166bacde0b692aa3063e743bb046a5d2f. With this, our FORTIFY impl
now sits in one file.

Bug: 12231437
Test: mma; no new CtsBionicTestCases failures on bullhead internal
master.
Change-Id: I6f9ff81c3e86cf9d6a0efa650eb5765f1e2fa09c
2017-07-25 17:39:21 -07:00