Commit graph

23429 commits

Author SHA1 Message Date
Elliott Hughes
d6541c2a97 Make <math.h> renames compatible with GCC.
GCC is fussy about the order in which attributes and renames occur.

Bug: N/A
Test: builds
Change-Id: Icee5ec00aa4626ddad0d89d2d7cee5ec6891c368
2017-09-18 16:22:32 -07:00
Elliott Hughes
d6c678ca90 Support larger guard regions.
This also fixes a long-standing bug where the guard region would be taken
out of the stack itself, rather than being -- as POSIX demands -- additional
space after the stack. Historically a 128KiB stack with a 256KiB guard would
have given you an immediate crash.

Bug: http://b/38413813
Test: builds, boots
Change-Id: Idd12a3899be1d92fea3d3e0fa6882ca2216bd79c
2017-09-18 16:09:43 -07:00
Christopher Ferris
7982914fae Drop thread list lock before abort.
Bug: 65656273

Test: Ran the app and verified it crashes instead of deadlocks.
Change-Id: I7dbe653d50a635a23993c99c5f73ca094ee80b28
2017-09-18 14:40:35 -07:00
Treehugger Robot
0c9ea17e0c Merge "Always log errno when aborting." 2017-09-18 21:33:54 +00:00
Elliott Hughes
df862454b6 Merge "Use __RENAME for long double functions." 2017-09-18 21:33:06 +00:00
Elliott Hughes
7b0af7ad82 Always log errno when aborting.
(Where errno is relevant.)

Also consistently use -1 as the fd for anonymous mmaps. (It doesn't matter,
but it's more common, and potentially more intention-revealing.)

Bug: http://b/65608572
Test: ran tests
Change-Id: Ie9a207632d8242f42086ba3ca862519014c3c102
2017-09-15 16:18:49 -07:00
Treehugger Robot
5e80552642 Merge "[cfi] Fix __cfi_check address calculation." 2017-09-15 23:08:31 +00:00
Evgenii Stepanov
ded4524cb0 [cfi] Fix __cfi_check address calculation.
The current code is incorrect when the target address is 18 bit aligned.

Test: stops random (and extremely rare) crashes in media.extractor
Bug: 63400743
Bug: 65590288

Change-Id: I65b45ff0c4b57a7ff08d3f5b3d80f41167d3c0f8
2017-09-15 14:15:54 -07:00
Bill Yi
5828840e72 Merge remote-tracking branch 'aosp/oreo-cts-dev' into HEAD 2017-09-15 13:44:31 -07:00
Elliott Hughes
50cda38f1d Use __RENAME for long double functions.
We can cut a lot of stuff out of the NDK's libandroid_support with this,
and reduce unnecessary relocations for all LP32 code. LP64 code should
be unaffected.

Bug: https://issuetracker.google.com/64450768
Bug: https://github.com/android-ndk/ndk/issues/507
Test: ran tests, plus manual readelf on the _test.o files
Change-Id: I3de6015921195304ea9c829ef31665cd34664066
2017-09-14 16:10:43 -07:00
Isaac Chen
3b64f8ecb3 Merge "Enable 32-bit armv8 NEON for libm" 2017-09-14 01:56:29 +00:00
Isaac Chen
e719ceb35b Enable 32-bit armv8 NEON for libm
Since ARM neon instructions were only used on armv7-a-neon architecture
variant, the default implementation for 32-bit armv8-a cores doesn't
use these advanced SIMD instructions. By using "neon" key in the
Android.bp, both arch variants (armv7-a-neon and armv8-a) are covered.

Bug: 65569003
Test: lunch aosp_arm64; emulator # on oc-mr1-dev; boot to home screen
      Also checked if sqrt.o and floor.o are actually built and linked
      in the resulted libm.a for both armv7-a-neon/cortex-a15 and
      armv8-a/generic (2nd) arch/cpu variant.
Change-Id: I2084dbdb12e252b06bba5adc65adb59e97a99332
2017-09-13 19:31:08 +08:00
Treehugger Robot
7e6f98b93d Merge "Remove clang: true" 2017-09-11 21:39:41 +00:00
Elliott Hughes
40756d61ac Merge "Cast __builtin_swap64 to uint64_t." 2017-09-11 20:43:36 +00:00
Elliott Hughes
4c0803d165 Cast __builtin_swap64 to uint64_t.
strace 4.19 causes clang to emit a questionable warning:

  external/strace/nlattr.c:254:35: error: format specifies type 'unsigned long' but the argument has type 'unsigned long long' [-Werror,-Wformat]
                tprintf("htobe64(%" PRIu64 ")", be64toh(num));
                                 ~~~            ^~~~~~~~~~~~
  bionic/libc/include/sys/endian.h💯20: note: expanded from macro 'be64toh'
  #define be64toh(x) htobe64(x)
                     ^~~~~~~~~~
  bionic/libc/include/sys/endian.h:80:17: note: expanded from macro 'htobe64'
  #define htobe64 __swap64
                  ^
  bionic/libc/include/sys/endian.h:48:18: note: expanded from macro '__swap64'
  #define __swap64 __builtin_bswap64
                   ^

What's happened here is:

* be64toh is __builtin_bswap64

* PRIu64 is "lu"

* __builtin_bswap64 is internally declared a "ULLiULLi"

All of which leads to the `unsigned long` != `unsigned long long` complaint.

It seems like __builtin_bswap64 should be ULiULi on 64-bit architectures,
where `long` rather than `long long` is the natural way to refer to 64-bit
types, as evidenced by the "lu" for PRIu64.

As long as clang behaves like this, though, we can work around it with a cast.

Also clean up the other casts in the file, be more consistent about whether
these function-like macros are defined with an argument, and remove an
incorrect comment.

Bug: http://b/65495954
Test: ran tests, built strace 4.19 without warnings
Change-Id: I8e06d4bf71e95d62f556eab8661033e04d487e0d
2017-09-11 13:21:35 -07:00
Lennart Wieboldt
2286b9f5ae Remove clang: true
clang is the default compiler since Android nougat

Test: mma & verified it´s still build with clang
Change-Id: Id8b5361d18c1b2febb2dc6cc44502feaa08f605c
Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2017-09-11 21:43:58 +02:00
Elliott Hughes
4c9d528a25 Merge "Finish <search.h>." 2017-09-11 18:39:30 +00:00
Treehugger Robot
d74088bc46 Merge "For devices which are not treble enabled, return the system shell." 2017-09-11 18:20:59 +00:00
Elliott Hughes
60103831eb Merge "Trivial tests for <inttypes.h>/<stdlib.h> *abs and *div functions." 2017-09-08 19:37:16 +00:00
Jayant Chowdhary
ab2f79c0da For devices which are not treble enabled, return the system shell.
For treble enabled devices, still return the appropriate shell depending
on whether the process is a vendor process or a system one.

Test: Manual testing: on a bullhead device, ran test programs from
      /vendor/bin which used popen() and system(). The calls succeeded.

Bug: 65054230

Bug: 64516799

Merged-In: I15dfdbb107cfca7c0f92f337c9bb46b9876eb38e
Change-Id: I15dfdbb107cfca7c0f92f337c9bb46b9876eb38e
(cherry picked from commit 1e52871773)
2017-09-07 17:19:21 -07:00
Elliott Hughes
00d8a8b779 Trivial tests for <inttypes.h>/<stdlib.h> *abs and *div functions.
Because I want something to copy & paste into the NDK support library test
that's slightly better than taking the address of the function...

Bug: https://github.com/android-ndk/ndk/issues/502
Test: ran tests
Change-Id: If43089d16691d6a4dcf5d972450b14ed85bbca81
2017-09-07 17:01:37 -07:00
Elliott Hughes
04503da174 Merge "<stdbool.h> not necessary in C++." 2017-09-07 23:11:22 +00:00
Elliott Hughes
7379018162 <stdbool.h> not necessary in C++.
Bug: N/A
Test: builds
Change-Id: I40fffe92d4273eab5a98bd65013bb9da2aea2171
2017-09-07 13:28:14 -07:00
Christopher Ferris
5a905961f8 Merge "Provide method to dump backtrace heap data." 2017-09-06 01:37:47 +00:00
Christopher Ferris
602b88ccdd Provide method to dump backtrace heap data.
For non-zygote spawned processes, we might want to dump the backtrace
data. Provide a method to send a signal to a process and then dump the
data to a file.

Adds a method to dump the backtrace data on exit.

Update documentation and explain format of heap dump data.

Test: Ran unit tests, enabled new options and used them.
Change-Id: Ie2fa706694160731afe02c1382b037d06df1d069
2017-09-05 15:57:00 -07:00
Treehugger Robot
0f6dd63e06 Merge "Use env to invoke python" 2017-09-01 00:44:43 +00:00
Elliott Hughes
5702c6ff45 Finish <search.h>.
I'm unable to find a bug, but we've had requests for this internally
once or twice (though I pointed those folks at the STL), and there's
code we build for the host or in our bootloaders that would use this,
and there's reasonable-looking FreeBSD implementation ready and waiting.

Bug: N/A
Test: ran tests
Change-Id: I6ddee4b71bea4c22ed015debd31d3eaac4fcdd35
2017-08-31 17:38:51 -07:00
Treehugger Robot
b20c246fc9 Merge "Add an extra test for a POSIX iconv requirement." 2017-08-31 23:45:27 +00:00
Stephen Crane
77bb564dc7 Use env to invoke python
/usr/bin/python may be python3. We should respect PATH to find the python
executable so it can be locally overridden to be python2.

Test: Build libc, repo upload
Change-Id: Iaddd7cd4a1c2177c32786e4fa0fc664ab0ad36de
2017-08-31 15:11:50 -07:00
Elliott Hughes
d40a833ab0 Add an extra test for a POSIX iconv requirement.
Bug: N/A
Test: ran tests
Change-Id: If211bf2a74ac3a6e8e84375c88f6c2580c392d50
2017-08-31 14:14:16 -07:00
Treehugger Robot
7f9f1b6f91 Merge "Don't run disable_ld_config_file test on non-production devices" 2017-08-30 23:57:40 +00:00
Elliott Hughes
e0e2798f11 Merge "Explicitly name DT_RPATH." 2017-08-30 19:37:53 +00:00
Treehugger Robot
b3aea2bb9a Merge "Use have_dl to guard all tests that rely on icu4c." 2017-08-30 18:22:37 +00:00
Jiyong Park
4945d8f121 Don't run disable_ld_config_file test on non-production devices
The test always fails when run on non-production devices. Silence the
expected failure.

Bug: 64908138
Test: run CtsBionicTestCases on userdebug device. disable_ld_config_file
test does not fail.

Merged-In: Icd24a356dfbc62f540e3263070434a4fd065bfbc
Change-Id: Icd24a356dfbc62f540e3263070434a4fd065bfbc
(cherry picked from commit 157655dc67)
2017-08-31 01:42:55 +09:00
Elliott Hughes
966d8a321e Use have_dl to guard all tests that rely on icu4c.
Bug: http://b/65138342
Test: ran tests
Change-Id: Iddded068a2481e8b15e102c8705545a886ae2772
2017-08-30 16:17:40 +00:00
Dimitry Ivanov
352afd0e93 Merge "Restore dummy libdl.a implementation" 2017-08-30 16:15:55 +00:00
Elliott Hughes
6eae4cc57b Explicitly name DT_RPATH.
The specific case of finding a DT_RPATH entry is a pretty common harmless
warning. An alternative to this change would be to just add a case to the
switch for DT_RPATH to just silently ignore it, since it's never been
supported and is deprecated anyway.

Bug: N/A
Test: builds
Change-Id: I01986da8f1f8d411fc2ea32d492c53b9f4488c72
2017-08-30 09:02:33 -07:00
Elliott Hughes
76a4bb980c Merge "Add tests for all C11 headers." 2017-08-30 15:57:40 +00:00
dimitry
dc7cc6258a Restore dummy libdl.a implementation
Bug: http://b/36206043
Test: bionic-unit-tests-static
Change-Id: If0400b72b51570e5ca0d70ec0bd9fb77664b9210
2017-08-30 10:52:19 +02:00
Treehugger Robot
dbd48e1d8c Merge "Add missing libm introduced=26 annotations." 2017-08-30 03:54:23 +00:00
Treehugger Robot
274e2661a2 Merge "Add new status document, based on internal wiki." 2017-08-30 00:06:04 +00:00
Elliott Hughes
45da326324 Add tests for all C11 headers.
Well, all except <threads.h> which we have no current plans to implement.

The only thing this turned up is that clang's <float.h> doesn't define
FLT_HAS_SUBNORM/DBL_HAS_SUBNORM/LDBL_HAS_SUBNORM, so for now we assert
that those are missing so that when we get a fixed clang, we notice.

Also the <tgmath.h> is utterly perfunctory, but seems like an appropriate
amount of effort to put in.

Bug: N/A
Test: ran tests
Change-Id: I7f7a7040b3271ceda625bee8a40a9d8cef52ee44
2017-08-29 15:32:18 -07:00
Dimitry Ivanov
0d5d0746e8 Merge changes from topic "version-script-for-binaries"
* changes:
  Replace artificial symbol table with proper one
  Implement __gnu_Unwind_Find_exidx/__cxa_type_match
2017-08-29 18:51:05 +00:00
Elliott Hughes
b6a6ac5ab2 Add missing libm introduced=26 annotations.
Without this, the NDK stub libm.so files think we've had the new O
functions since the beginning of time.

Bug: N/A
Test: nm
Change-Id: Ibdd7b910934b706348cc6d10b2b6b63a283d7320
2017-08-29 11:45:31 -07:00
Elliott Hughes
0bfcbaf4d0 Add new status document, based on internal wiki.
Also start breaking up the monolithic top level README.md, pulling the
32-bit ABI stuff out into its own file, and moving the remaining benchmark
documentation in with the rest of the benchmark documentation.

Bug: N/A
Test: N/A
Change-Id: Ic1b9995e27b5044199ed34883cc0b8faa894df0e
2017-08-29 11:07:36 -07:00
dimitry
7abea57ba5 Replace artificial symbol table with proper one
This change also replaces elf-hash with gnu-hash.

Test: make
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: Ibc4026f7abc7e8002f69c33eebaf6a193f1d22eb
2017-08-29 18:18:28 +02:00
dimitry
25bf29bbad Implement __gnu_Unwind_Find_exidx/__cxa_type_match
Leaving these unimplemented causes linker to have 2 weak undefined
symbols which in turn results in 3 unwanted relocations for arm arch.
Implementing them removes unwanted relocations from resulted dynamic
object

Test: make && readelf --dyn-sym linker
Test: linker-unit-tests && bionic-unit-tests --gtest_filter=dl*:Dl*
Test: flash and boot angler
Change-Id: I10120271936c770659239898aaf852d31c5483c2
2017-08-29 18:18:27 +02:00
Treehugger Robot
0e23c87de5 Merge "Allow io_* syscalls." 2017-08-29 03:28:25 +00:00
Treehugger Robot
8468a1be01 Merge "Pretend the <fts.h> functions didn't appear until 21." 2017-08-26 00:02:50 +00:00
Treehugger Robot
6a4c0eff12 Merge "Improve names for function arguments in <unistd.h> for Studio." 2017-08-25 23:47:26 +00:00