Commit graph

24250 commits

Author SHA1 Message Date
Elliott Hughes
e57d772353 Use builtins for fma/fmax/fmin/round on arm/arm64.
Bug: http://b/27829506
Test: ran tests and inspected arm/arm64/x86/x86-64 assembler
Change-Id: I8af60b44c75dddbb11949f208a8a70ed3cff12c8
2017-11-08 15:13:58 -08:00
Treehugger Robot
3404bb11a3 Merge "Allow 32-bit fseeko/fseeko64 SEEK_CUR/SEEK_SET to exceed 2 GiB" 2017-11-08 01:57:38 +00:00
Ryan Prichard
bf54986d19 Allow 32-bit fseeko/fseeko64 SEEK_CUR/SEEK_SET to exceed 2 GiB
Bug: http://b/68837650
Test: /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Change-Id: I367e0238c31d35f76d8ad89fd0aa27ecfeb7c149
2017-11-07 15:34:23 -08:00
Treehugger Robot
8574a1f630 Merge "Fix arm/arm64 <fenv.h> to match current reality." 2017-11-07 18:50:41 +00:00
Dimitry Ivanov
62c43ed23c Merge "Add test checking library unload on dlclose" 2017-11-07 17:06:22 +00:00
dimitry
109040c868 Add test checking library unload on dlclose
Bug: http://b/68262627
Test: Run bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: Ied85bc4ab37524cfcdbc33fd6c6e69b8d87ee08a
2017-11-07 10:51:59 +01:00
Treehugger Robot
691758c1c2 Merge "versioner: properly handle extern "C", "C++"." 2017-11-07 04:31:31 +00:00
Josh Gao
8e13b67c64 versioner: properly handle extern "C", "C++".
extern "C" and "C++" are parsed as a LinkageSpecDecl with the real Decl
as a child node. This leads to the preprocessor sticking its guard
between the extern specifier and the declaration.

Update the AST visitor to add a special-case for calculating the
SourceRange on a LinkageSpecDecl, and add a test.

Bug: https://github.com/android-ndk/ndk/issues/440
Test: python run_tests.py
Change-Id: I76445fe366cef46cfd2f16fb93d534d410c5edca
2017-11-06 17:23:36 -08:00
Treehugger Robot
db4f334695 Merge "Clean up crt defaults" 2017-11-06 22:09:22 +00:00
Colin Cross
8697f10e74 Merge "Remove no_default_compiler_flags from crt*" 2017-11-06 18:59:00 +00:00
Elliott Hughes
2ca61ebe97 Merge "Fix for dlfcn.rtld_next_from_library." 2017-11-04 17:03:26 +00:00
Elliott Hughes
b6c7f6e595 Fix arm/arm64 <fenv.h> to match current reality.
ARM stopped supporting enabling of FP exceptions years ago.

Bug: http://b/68832485
Test: ran tests
Change-Id: I8450baa78e04d994c352180975b0a1ecd5a9f662
2017-11-03 16:46:32 -07:00
Elliott Hughes
c18f55ca2b Merge "10x printf speedup." 2017-11-03 23:11:06 +00:00
Raj Mamadgi
527229cb72 Fix for dlfcn.rtld_next_from_library.
Using fclose to get the same address for the test assertion because
Samsung already uses LD_PRELOAD to intercept `close`.

Bug: http://b/67978141
Bug: http://b/68855476
Test: ran tests
Change-Id: I2da463e8b27e0db5cb1ba370d30f0402d7531396
Signed-off-by: Raj Mamadgi <r.mamadgi@samsung.com>
2017-11-03 15:00:09 -07:00
Treehugger Robot
b06bb71672 Merge "Remove mips/mips64 headers from the NDK sysroot." 2017-11-03 21:30:15 +00:00
Elliott Hughes
5305a4d4a7 10x printf speedup.
Android is UTF-8. Don't make everyone pay to convert UTF-8 to ASCII just
so we can recognize '%'. With UTF-8 we can just strchr forwards.

Before:

  ---------------------------------------------------------------
  Benchmark                        Time           CPU Iterations
  ---------------------------------------------------------------
  BM_stdio_printf_literal       1290 ns       1290 ns     442554
  BM_stdio_printf_s             1204 ns       1204 ns     582446
  BM_stdio_printf_d             1206 ns       1206 ns     578311
  BM_stdio_printf_1$s           2263 ns       2263 ns     310002

After:

  ---------------------------------------------------------------
  Benchmark                        Time           CPU Iterations
  ---------------------------------------------------------------
  BM_stdio_printf_literal        178 ns        178 ns    3394001
  BM_stdio_printf_s              246 ns        246 ns    2850284
  BM_stdio_printf_d              252 ns        252 ns    2778610
  BM_stdio_printf_1$s            363 ns        363 ns    1929011

Add missing __find_arguments error checking to the wide variant to match
the regular one.

Also replace various char/wchar_t differences with the macro.

Bug: http://b/67371539
Test: ran tests
Change-Id: I18f122009c22699943ab5d666a98ea594a972c40
2017-11-03 14:19:00 -07:00
Colin Cross
7d7b368a44 Clean up crt defaults
Make crt_so_defaults inherit from crt_defaults, remove duplicates
from crt_so_defaults, and make the users of crt_so_defaults not
directly use crt_defaults.

Test: m checkbuild
Change-Id: I1448a5a4c86521b994fd4d79120e0b7d3a9c5ba9
2017-11-03 13:38:40 -07:00
Colin Cross
6a2610dbd3 Remove no_default_compiler_flags from crt*
no_default_compiler_flags is unnecessary and causes problems when
necessary flags like -no-canonical-prefixes are not passed.

Bug: 68719465
Test: m checkbuild
Change-Id: Ifdc68067eb3208b151b0a96820aa9a57b82db057
2017-11-03 13:37:42 -07:00
Elliott Hughes
e11e7fbfeb Merge "test: trivial fixes in documentation" 2017-11-03 19:23:29 +00:00
Dan Albert
050f046d3d Remove mips/mips64 headers from the NDK sysroot.
Test: build/soong/scripts/build-ndk-prebuilts.sh
Bug: None
Change-Id: Iac212939636abbbf8402c85c5e89c724fb531c91
2017-11-03 12:02:50 -07:00
Elliott Hughes
232541aa02 Merge "More printf de-duplication." 2017-11-03 15:26:02 +00:00
Sergii Piatakov
c3e30604b4 test: trivial fixes in documentation
Fix wrong names of test binaries in README.md.

Test: bionic device tests
Change-Id: Ie96d8edb7e2aa85f3c690e0f92064b37f66debfd
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2017-11-03 10:33:56 +02:00
Elliott Hughes
3a33da5d73 Merge "Fix pthread test race conditions." 2017-11-03 04:55:33 +00:00
Elliott Hughes
4f97cffd29 Merge "Add basic tests for the remaining 9 libm <fenv.h> functions." 2017-11-03 02:52:03 +00:00
Elliott Hughes
618303ca4a More printf de-duplication.
Fix the 'j' (intmax_t/uintmax_t) length qualifier in the wide
variant. (With new tests that fail without this fix.)

Fix a typo in the wide support for intmax_t*, which isn't testable because
%n is disabled on Android (and will be removed in a later cleanup pass).

Also move the public vfprintf/vfwprint functions into stdio.cpp.

Bug: http://b/67371539
Test: ran tests
Change-Id: Ib003599b1e9cb789044a068940b59e447f2cb7cb
2017-11-02 16:58:44 -07:00
Elliott Hughes
18a1957444 Add basic tests for the remaining 9 libm <fenv.h> functions.
It seems that feenableexcept/fegetexcept are lying to us on arm/arm64
because the hardware doesn't actually support such functionality. When
I get confirmation of that from ARM I'll fix the <fenv.h> implementation
correspondingly --- writing to/reading from reserved FP control register
bits as we currently do doesn't seem like the best of ideas.

Bug: http://b/31742322
Test: ran tests on arm/arm64/x86/x86-64
Change-Id: If78f83ddab221b568fa168c3364a7ae95c024983
2017-11-02 16:18:43 -07:00
Treehugger Robot
c7f296ad99 Merge "tools: fix error when /bin/sh isn't bash" 2017-11-02 22:56:40 +00:00
Elliott Hughes
0bd9d13572 Fix pthread test race conditions.
Guarantee that threads live long enough for us to fiddle with them.

Bug: http://b/68768209
Test: ran tests
Change-Id: I06b1bb64fec9f8181b5f5b43ca1030e255fdccc1
2017-11-02 13:11:13 -07:00
Sergii Piatakov
564ed96caf tools: fix error when /bin/sh isn't bash
The following scripts use `bash` specific variable `${BASH_SOURCE[0]}`
so this doesn't work correct in case when `/bin/sh` isn't `bash`.

Test: repo upload bionic
Change-Id: I12ce0666f9404107dceb03960bad4ec11b14ba2d
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2017-11-02 20:41:59 +02:00
Elliott Hughes
eed523e7cb Merge "Test __fpclassify/__isinf/__isnan." 2017-11-02 16:54:40 +00:00
Elliott Hughes
46621f43b0 Merge "Start de-duplicating the regular and wide printf implementations." 2017-11-02 15:44:32 +00:00
Elliott Hughes
9ecd2cc0a2 Test __fpclassify/__isinf/__isnan.
These are obsolete aliases for equally obsolete functions, but apps built
with old versions of the NDK might still be emitting references to them.

Bug: N/A
Test: ran tests
Change-Id: I6eab910e3cd4d322604167799e83b5b7411c04c3
2017-11-01 22:17:26 -07:00
Chih-hung Hsieh
261dbdf1d0 Merge "Use -Werror in bionic/tests" 2017-11-02 02:16:46 +00:00
Elliott Hughes
2f9c8ce38a Start de-duplicating the regular and wide printf implementations.
This patch switches to C++ (in anticipation of needing it later), removes
a little duplication (via a macro for now), and ensures uniform support
for %C/%lc and %S/%ls between regular and wide (with new tests).

Since it's so hard to debug problems in printf (as the time I've wasted
already today will testify), that's all I want to do in this change. The
other 500 lines of diff can wait...

(Also merge "floatio.h" into "local.h" now all the users are in forked
code.)

Bug: http://b/67371539
Test: ran tests
Change-Id: I083353d89c32b9302d759ca6967cc6d8a62cd8a5
2017-11-01 18:13:36 -07:00
Treehugger Robot
48228fb572 Merge changes from topic "versioner_cpp"
* changes:
  versioner: compile headers in both C and C++ mode.
  versioner: follow __asm__ labels.
2017-11-01 22:33:10 +00:00
Chih-Hung Hsieh
b1cc5bd276 Use -Werror in bionic/tests
* Should not use -Wno-error

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I92552b0d9860835216500c4f57574cd2928b24f1
2017-11-01 14:13:24 -07:00
Elliott Hughes
0cbbdaa5cf Merge "Add missing ELF constants from the spec." 2017-11-01 15:32:39 +00:00
Elliott Hughes
a8a23f520e Add missing ELF constants from the spec.
Also add links to the relevant documentation.

Bug: N/A
Test: builds
Change-Id: I65b1a1ec0c63e1f07749ab4e4b0cf3905acc1df7
2017-10-31 17:26:48 -07:00
Elliott Hughes
b1ba8cfffb Merge "elf.h: add STN_UNDEF" 2017-11-01 00:23:57 +00:00
Treehugger Robot
07e412419b Merge "More missing _unlocked <stdio.h> functions." 2017-10-31 22:43:34 +00:00
Treehugger Robot
555a6d19c8 Merge "Rename the fortify compile-time diags test" 2017-10-31 22:13:03 +00:00
Treehugger Robot
c905afa1f2 Merge "clang-format the printf/scanf implementation." 2017-10-31 22:11:46 +00:00
Greg Hackmann
8874d88083 elf.h: add STN_UNDEF
ELF uses index STN_UNDEF = 0 for undefined symbols.  glibc and musl
define this constant in elf.h, and it's needed to build the kernel's
vDSO selftest suite.

Test: Overwrite elf.h in standalone NDK toolchain, then
	cd $kernel/tools/testing/selftests/vDSO && \
	make CC="aarch64-linux-android-gcc -pie" vdso_test
Change-Id: I495586e9ca43d2f0d148ded9f4bd61ec8d14d53b
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2017-10-31 13:52:45 -07:00
Elliott Hughes
37ad959783 More missing _unlocked <stdio.h> functions.
Also simplify trivial one-liners like perror/puts/fputs, and clean up
fread/fwrite slightly.

Fix perror to match POSIX.

Add basic perror and *_unlocked tests.

Bug: N/A
Test: ran tests
Change-Id: I63f83c8e0c15c3c4096509d17421ac331b6fc23d
2017-10-31 13:23:41 -07:00
George Burgess IV
0086fc813e Rename the fortify compile-time diags test
Following up on comments from I40c66ff9e638b306878ada006bc2c98f2346e77a.
My best attempt at a name that conveys "a test that fails to compile in
N different ways with FORTIFY enabled, and is intended to be used with
either FileCheck, or as a cheap way to check that FORTIFY is getting
properly disabled given some set of flags."

Bug: None
Test: mma.
Change-Id: I6d62875bd1cabc5d01b10ae0f03accd5ee5c8c0a
2017-10-31 13:14:56 -07:00
Elliott Hughes
c8f2c520fa clang-format the printf/scanf implementation.
Bug: N/A
Test: builds
Change-Id: I490fdc1d568cba901c123b9efe0b9053b0d83b64
2017-10-31 13:07:51 -07:00
Treehugger Robot
f6dfe57e41 Merge "Remove some always-on #ifdefery." 2017-10-31 18:26:30 +00:00
Treehugger Robot
9fe034b7bb Merge "libc: Disable FORTIFY if we're using clang-tidy." 2017-10-31 17:36:18 +00:00
Elliott Hughes
d9a7de1b77 Remove some always-on #ifdefery.
Bug: N/A
Test: ran tests
Change-Id: I02d3c0a639f48ae9c415fb59f37ade015e6f46a2
2017-10-31 09:55:40 -07:00
George Burgess IV
e5d66eb86a libc: Disable FORTIFY if we're using clang-tidy.
Having FORTIFY enabled for clang-tidy adds no value, and breaks some
heuristics for recognizing standard library functions (see the bug).

This also disables FORTIFY for the static analyzer (which we use
through clang-tidy), because it presumably tries to recognize standard
library functions through similar heuristics.

Bug: 36664104
Test: mma with and without the patch to cdefs. New test breaks without.
Change-Id: I40c66ff9e638b306878ada006bc2c98f2346e77a
2017-10-30 22:30:40 -07:00