Commit graph

29836 commits

Author SHA1 Message Date
Elliott Hughes
cfac8d0074 <sys/select.h>: add docs, and a warning against using select().
Test: N/A
Change-Id: I596d63f2c8039434e2b8023eefb944da5c4bbb40
2019-10-02 14:13:54 -07:00
Treehugger Robot
822beaeeac Merge "fortify(strings): emit diagnostics regardless of API level" 2019-10-01 21:36:11 +00:00
Elliott Hughes
2244f40e51 Merge "Move bionic ("runtime") apex definition into bionic/." 2019-10-01 20:42:23 +00:00
Treehugger Robot
803bd0a012 Merge "fortify(socket/stat): emit diagnostics regardless of API level" 2019-10-01 07:11:36 +00:00
Elliott Hughes
470d10cf0f Move bionic ("runtime") apex definition into bionic/.
Bug: http://b/139176024
Test: boots
Change-Id: Ifc3829e00b99c2f65ed932f0b42ab1ae59fec27c
2019-09-30 16:44:58 -07:00
George Burgess IV
bc37c5a8ce fortify(strings): emit diagnostics regardless of API level
Bug: 141267932
Test: m checkbuild on internal-master

Change-Id: Ief185320f93ec31f4d0a8035c450a7ab7b4e02b4
2019-09-30 13:00:35 -07:00
George Burgess IV
d0a0f72852 fortify(socket/stat): emit diagnostics regardless of API level
Bug: 141267932
Test: m checkbuild on internal-master

Change-Id: I7fe29184290e19ec080b204aa98d513ce59bc66b
2019-09-30 13:00:35 -07:00
Elliott Hughes
82ee3a08e2 Merge "Optimize tolower(3)/toupper(3) from <ctype.h>." 2019-09-30 18:49:51 +00:00
Christopher Ferris
d24c14d817 Merge "Make tls related header files platform accessible." 2019-09-30 16:15:33 +00:00
Elliott Hughes
1c8a2a99a7 Optimize tolower(3)/toupper(3) from <ctype.h>.
The tables in the BSD tolower/toupper are slower for ASCII than just
doing the bit twiddling.

We can't actually remove the tables on LP32, so move them into the
"cruft" we keep around for backwards compatibility (but remove them for
LP64 where they were never exposed).

I noticed that the new bit-twiddling tolower(3) was performing better
on arm64 than toupper(3). The 0xdf constant was requiring an extra MOV,
and there isn't a BIC that takes an immediate value. Since we've already
done the comparison to check that we're in the right range (where the
bit is always set), though, we can EOR 0x20 to get the same result as
the missing BIC 0x20 in just one instruction.

I've applied that same optimization to towupper(3) too.

Before:

  BM_ctype_tolower_n                 3.30 ns         3.30 ns    212353035
  BM_ctype_tolower_y                 3.31 ns         3.30 ns    211234204
  BM_ctype_toupper_n                 3.30 ns         3.29 ns    214161246
  BM_ctype_toupper_y                 3.29 ns         3.28 ns    207643473

  BM_wctype_towupper_ascii_n         3.53 ns         3.53 ns    195944444
  BM_wctype_towupper_ascii_y         3.48 ns         3.48 ns    199233248

After:

  BM_ctype_tolower_n                 2.93 ns         2.92 ns    242373703
  BM_ctype_tolower_y                 2.88 ns         2.87 ns    245365309
  BM_ctype_toupper_n                 2.93 ns         2.93 ns    243049353
  BM_ctype_toupper_y                 2.89 ns         2.89 ns    245072521

  BM_wctype_towupper_ascii_n         3.34 ns         3.33 ns    212951912
  BM_wctype_towupper_ascii_y         3.29 ns         3.29 ns    214651254

(Why do both the "y" and "n" variants speed up with the EOR
change? Because the compiler transforms the code so that we
unconditionally do the bit twiddling and then use CSEL to decide whether
or not to actually use the result.)

We also save 1028 bytes of data in the LP64 libc.so.

Test: ran the bionic benchmarks and tests
Change-Id: I7829339f8cb89a58efe539c2a01c51807413aa2d
2019-09-27 14:42:39 -07:00
Ryan Prichard
41488b79c4 Merge "Revert "Revert "Add benchmarks that run simple programs""" 2019-09-27 19:59:50 +00:00
Peter Collingbourne
4096cba7f8 Merge "Disable sanitization of crt objects." 2019-09-27 19:31:13 +00: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
57a64a7172 Merge "ASCII fastpath for towupper and towlower." 2019-09-27 17:14:53 +00:00
Elliott Hughes
dc2599d16c Merge "Add trivial <ctype.h> benchmarks." 2019-09-27 16:45:26 +00:00
Balaram Makam
0e670e26a2 ASCII fastpath for towupper and towlower.
This change elides unnecessary calls to __find_icu_symbol
for ASCII chars and improves PUBG mobile game loading time by 7% on
hikey620(Cortex-A53):

name                old time/op  new time/op  delta
PUBG_0.13.0_Launch   41.5s ± 2%   37.7s ± 3%  -9.24%  (p=0.008 n=5+5)

Below are the bionic benchmark results on a Pixel 2 XL for 64-bit,
showing a large speedup for ASCII and only a small slowdown for non-ASCII.

Before:

  BM_wctype_towlower_ascii_n         10.5 ns         10.4 ns     61973065
  BM_wctype_towlower_ascii_y         10.2 ns         10.2 ns     70158659
  BM_wctype_towlower_unicode_n       10.3 ns         10.3 ns     67719478
  BM_wctype_towlower_unicode_y       10.6 ns         10.5 ns     67841545
  BM_wctype_towupper_ascii_n         10.8 ns         10.8 ns     63456778
  BM_wctype_towupper_ascii_y         10.9 ns         10.9 ns     65116910
  BM_wctype_towupper_unicode_n       10.7 ns         10.7 ns     67463276
  BM_wctype_towupper_unicode_y       10.4 ns         10.4 ns     66467890

After:

  BM_wctype_towlower_ascii_n         3.35 ns         3.34 ns    205567652
  BM_wctype_towlower_ascii_y         3.30 ns         3.29 ns    214108746
  BM_wctype_towlower_unicode_n       10.9 ns         10.8 ns     65007743
  BM_wctype_towlower_unicode_y       10.6 ns         10.6 ns     63819060
  BM_wctype_towupper_ascii_n         3.53 ns         3.53 ns    195944444
  BM_wctype_towupper_ascii_y         3.48 ns         3.48 ns    199233248
  BM_wctype_towupper_unicode_n       11.1 ns         11.1 ns     62760216
  BM_wctype_towupper_unicode_y       11.0 ns         11.0 ns     61608872

Test: bionic unit tests on device
Test: bionic benchmarks on device
Signed-off-by: Balaram Makam <b.makam@samsung.com>
Change-Id: I77ab7efb66d7bcb35d00467663607535e5c1992f
2019-09-27 16:41:03 +00:00
Elliott Hughes
9ff7d09643 Add trivial <ctype.h> benchmarks.
Just to sanity check that toupper/tolower and towupper/towlower are in
the same ballpark for the ASCII range.

Test: ran benchmarks
Change-Id: I1ddc3f4f4478b4075107831f27bf4d4b4a3bc5e8
2019-09-26 21:47:01 -07:00
Ryan Prichard
2c236bc506 Revert "Revert "Add benchmarks that run simple programs""
This reverts commit 3bf27c86d1.

Disable the 32-bit glibc target. We're not interested in benchmarking that
target, and the bench_noop_nostl executable doesn't build when ASAN is
turned on, because the libclang_rt.asan_cxx-i386.a lib contains
ubsan_type_hash_itanium.cc.o, which needs __dynamic_cast and various
STL typeinfo variables. The equivalent libclang_rt.asan_cxx-x86_64.a
lib doesn't have ubsan_type_hash_itanium.cc.o in it.

Bug: http://b/141693636
Test: m bench_noop_nostl bench_noop bench_noop_static ASAN_OPTIONS=detect_leaks=0 SANITIZE_HOST=address
Change-Id: Id6de17e622682f3a166367ad670cba5bfa6aee47
2019-09-26 16:18:37 -07:00
Elliott Hughes
f5b44a5ea6 Merge "benchmarks: remove more boilerplate." 2019-09-26 21:38:52 +00:00
John Cater
6595551e28 Merge "Fix gensyscalls.py to actually use the input argument provided in bionic/libc/Android.bp." 2019-09-26 20:55:06 +00:00
Peter Collingbourne
7eb851c7da Disable sanitization of crt objects.
The accompanying soong change causes sanitize attributes to be allowed on
cc_object targets and propagates sanitize attributes into dependencies. This
is problematic for the crt objects in sanitizer builds because everything
depends on them including the sanitizer runtime, so a circular dependency
would otherwise be created. Furthermore, some of the code in these objects
runs before sanitizer initialization so it is unlikely that sanitizing them
would work anyway. Therefore, disable sanitization on these objects.

Change-Id: I25380dfc8eed5db34b034ba127a9d6b5674032fa
2019-09-26 12:16:06 -07:00
John Cater
e86e505b85 Fix gensyscalls.py to actually use the input argument provided in
bionic/libc/Android.bp.

Test: Built and tested bionic.
Change-Id: Ibb25990b2b1b5c18edfdaaab4f1593fa8d95f338
2019-09-26 15:02:04 -04:00
Raman Tenneti
0878ac991a Merge "Revert "Add benchmarks that run simple programs"" 2019-09-26 17:54:33 +00:00
Raman Tenneti
3bf27c86d1 Revert "Add benchmarks that run simple programs"
This reverts commit aa85ac2b08.

Reason for revert: builds are broken - Bug: 141693636

Change-Id: I7502813ae519719c578a05676a0adf9537019bd3
2019-09-26 17:52:48 +00:00
Elliott Hughes
96705e3712 benchmarks: remove more boilerplate.
Many of our benchmarks are basically just "call one function with a
fixed argument". We don't need to keep repeating all the boilerplate for
that.

This also ensures we don't forget the benchmark::DoNotOptimize, which --
in addition to being a good idea in general -- specifically solves the
problem with gettid benchmark and provides a more accurate result by
removing the indirection through a function pointer.

Test: ran benchmarks
Change-Id: Id67535243678cd0d48f51cf25141e2040da9af03
2019-09-26 07:42:23 -07:00
Elliott Hughes
6ebeaac69d Merge "Add trivial towlower/towupper benchmarks." 2019-09-26 14:25:21 +00:00
Elliott Hughes
bab9cfd99a Add trivial towlower/towupper benchmarks.
Currently 11ns for both ascii and unicode in 64-bit, 15ns for 32-bit.

Test: ran benchmarks
Change-Id: Ie810b324c855b52b66a96889a194bc5b5b55653f
2019-09-25 22:13:32 -07:00
Kiyoung Kim
34c0043fd8 Merge "Use generated linker config by default" 2019-09-26 00:58:15 +00:00
Ryan Prichard
ef0adb1275 Merge "run-on-host fixes" 2019-09-25 19:48:35 +00:00
Ryan Prichard
b10ac9e661 Merge "Add benchmarks that run simple programs" 2019-09-25 19:48:21 +00:00
Dongwon Kang
45d2a09c95 Merge "Remove libvorbisdec from greylist." 2019-09-25 18:50:11 +00:00
Treehugger Robot
d481848e4d Merge "Make more pthread functions weak for native bridge" 2019-09-25 17:44:22 +00:00
Evgeny Eltsin
8a18af52d9 Make more pthread functions weak for native bridge
These are using __pthread_internal_*.

Test: run bionic-unit-tests on cuttlefish
Change-Id: Idbb2503f03bd9f1f2a20fced34b734f573c1c0ad
2019-09-25 16:55:47 +02:00
Ryan Prichard
aa85ac2b08 Add benchmarks that run simple programs
Specifically, test the wall-clock time for running:
 * a C program that does nothing (i.e. no STL)
 * a C++ program that does nothing
 * a statically-linked C++ program
 * toybox true (in /system/bin and /vendor/bin)
 * mksh -c true (in /system/bin and /vendor/bin)

Test: bionic-spawn-benchmarks
Change-Id: I961850ec90004cac83088feab5783f4f27768be1
2019-09-25 09:35:43 +00:00
Dongwon Kang
b2a1c11c77 Remove libvorbisdec from greylist.
Test: build and boot. Checked libvorbisdec.so is not in /system/lib[64]
Bug: 141257741
Change-Id: Id9d9f691d5e5fa089a9d98a1be49754c8355202f
2019-09-24 18:55:44 -07:00
Ryan Prichard
3cfb89d451 run-on-host fixes
* Fix the path to bionic-benchmarks-glibc

 * Add symlinks for the toybox symlink commands. Each symlink bypasses the
   intermediate symlink in ${OUT}/system/bin and points to the final
   toybox binary. Suppress a bunch of warnings by skipping symlinks for
   non-existent files.

   The new spawn benchmarks try to run /system/bin/true. (They also try to
   run /vendor/bin/true and print an error.)

 * Quote "$@"

 * Use soong_ui.bash --dumpvars-mode to set a bunch of variables, rather
   than get_build_var, which invokes Soong once per variable. This reduces
   the "build/run-on-host.sh" runtime from 4s to 1.3s.

 * build/run-on-host.sh isn't executable and is only useful when it's
   sourced into another shell, so remove its shebang to reduce confusion.

Bug: none
Test: \
  . build/envsetup.sh
  lunch aosp_x86_64-userdebug
  . bionic/build/run-on-host.sh
  prepare MODULES-IN-bionic MODULES-IN-external-toybox
  /system/bin/true

Change-Id: I59e9a6aca77d35b16bdf51759c5fc7e725bfc67c
2019-09-24 15:36:31 -07:00
Christopher Ferris
f97dcc15e8 Merge "Revert "Temporarily disable some clock_getres tests."" 2019-09-24 19:19:28 +00:00
Christopher Ferris
a9dfe1c352 Revert "Temporarily disable some clock_getres tests."
This reverts commit 8eba2a59ac.

Reason for revert: The kernel update has been reverted.

Change-Id: I21d9ac3c319b8c6e8546a0b40c5646c5610cc8c5
2019-09-24 16:20:17 +00:00
Christopher Ferris
849f0db7ca Merge "Temporarily disable some clock_getres tests." 2019-09-24 14:12:13 +00:00
Christopher Ferris
8eba2a59ac Temporarily disable some clock_getres tests.
A kernel update broke three clock_getres tests, so disable
them while the kernel is fixed.

Bug: 141515847

Test: All tests pass on cuttlefish.
Change-Id: I7db789b2b8ba0bc5f8b13bb06e85711031735925
2019-09-23 18:44:22 -07:00
Christopher Ferris
7c852064bb Merge "Stop executing if skip occurs." 2019-09-24 01:14:15 +00:00
Christopher Ferris
103b998a52 Stop executing if skip occurs.
Bug: 141358530

Test: Forced a skip and verified it registers as a skip.
Change-Id: I9915c67ebae4389a26f28e16375ad4a41f3e4837
2019-09-23 09:41:13 -07:00
Kiyoung Kim
89b9528445 Use generated linker config by default
Use generated linker config by default, but with some back up plan
(sys.linker.use_generated_config property). Linker config generator
still does not support non-treblelized devices and vndk-lite, so these
cases should be handled later.

Bug: 138920271
Test: m -j && atest passed
Test: Tested from cuttlefish
Change-Id: I39e9d089a82f9409eccdcaa4fb26660caf3f5779
2019-09-23 14:25:40 +09:00
Treehugger Robot
14d5c12ed6 Merge "fortify: remove pragma diagnostic error from tests" 2019-09-20 23:49:33 +00:00
George Burgess IV
8a4414ef9c fortify: remove pragma diagnostic error from tests
This was necessary because we weren't doing -Werror=fortify-source
everywhere. As of I2715ea411ef067f801534dab4d306fef5431f290, we should
be doing this.

Bug: 131861088
Test: mma
Change-Id: I00d499938ae24c3870760470576d6be603fbecd1
2019-09-19 15:23:45 -07:00
Elliott Hughes
1db8fdb76e Merge "Remove global seccomp list." 2019-09-18 18:10:13 +00:00
Elliott Hughes
fa43309a59 Merge "ifuncs: start sharing." 2019-09-18 18:01:54 +00:00
Treehugger Robot
252eccfc84 Merge "libm: track arm-optimized-routines changes." 2019-09-18 11:57:37 +00:00
Treehugger Robot
e2075ee6d1 Merge "Remove bionicbb." 2019-09-18 07:36:52 +00:00
Elliott Hughes
5bd4f335a5 Remove bionicbb.
Turned down years ago, and we can get it from the history if we ever
need it again...

Test: N/A
Change-Id: I6923bd4cbc68139e0b89149280864b9da422013d
2019-09-17 16:41:20 -07:00