Commit graph

212 commits

Author SHA1 Message Date
Elliott Hughes
ab52807685 Update to FreeBSD libm r336665.
This reverts commit 253a830631 and moves
us forward to a revision that contains fixes for the problem with the
previous attempt.

This also makes sincos(3)/sincosf(3)/sincosl(3) available to `_BSD_SOURCE`
as well as `_GNU_SOURCE`.

The new FreeBSD libm code requires the FreeBSD `__CONCAT` macro, and all
our existing callers are FreeBSD too, so update that.

There's also an assumption that <complex.h> drags in <math.h> which isn't
true for us, so work around that with `-include` in the makefile. This
then causes clang to recognize a bug -- returning from a void function --
in our fake (LP32) sincosl(3), so fix that too.

Bug: http://b/111710419
Change-Id: I84703ad844f8afde6ec6b11604ab3c096ccb62c3
Test: ran tests
2018-07-24 10:36:00 -07:00
Andreas Gampe
253a830631 Revert "Update to FreeBSD libm r336523."
This reverts commit f86ee10278.

Incorrect result for fmodf(3.0f, 0f) = 1.0f breaks ART tests.

Bug: 111710419
Test: art/test/testrunner/testrunner.py -b -t 436-rem-float --target
Change-Id: I7eae68fb92740db33415d16418447bcbbd98ecba
2018-07-21 12:23:03 -07:00
Elliott Hughes
f86ee10278 Update to FreeBSD libm r336523.
This includes an ld128 powl, plus the clog* and cpow* families.

Also teach the NOTICE generator to strip SPDX-License-Identifier lines.

Bug: N/A
Test: ran tests
Change-Id: Ic8289d1253666a19468a4088884cf7540f1ec66d
2018-07-19 16:17:06 -07:00
Chih-Hung Hsieh
ecbff8382d Work around b/24465209, do not pack relocation table.
Global flag --pack-dyn-relocs=android is used with clang lld.
For b/24465209, we need to override that with --pack-dyn-relocs=none.

Bug: 80093890
Bug: 24465209
Test: build with USE_CLANG_LLD=true and run dlext.compat_elf_hash_and_relocation_tables
Change-Id: Ic3837446ff0deccf4e66425b39d3b062abcacc5e
2018-05-23 18:45:53 -07:00
Chih-Hung Hsieh
0fc5df0fde Work around b/24465209, do not use clang lld
See longer explanation in b/80093890.
Clang lld does not generate expected DT_REL and DT_RELA tags
with --hash-style=both and --pack-dyn-relocs=android.
I am not sure about the extent of b/24465209, so
I would rather not to use lld for these .so files for now.

Bug: 80093890
Bug: 24465209
Test: build with USE_CLANG_LLD=true and run dlext.compat_elf_hash_and_relocation_tables
Change-Id: I94e9fe8d687daeadb0182ae26596ca11d3f8bd9b
2018-05-23 17:14:22 +00:00
Jiyong Park
5603c6e6b9 Mark as recovery_available: true
Libraries that are direct or indirect dependencies of modules installed
to recovery partition (e.g. toybox) are marked as recovery_available:
true. This allows a recovery variant of the lib is created when it is
depended by other recovery or recovery_available modules.

Bug: 67916654
Bug: 64960723
Bug: 63673171
Bug: 29921292
Test: m -j
Change-Id: I59bf859a10a218af6591025a0fe7d1853e328405
2018-05-14 18:08:01 +09:00
Elliott Hughes
e332f658e0 Switch to FreeBSD's actual sincos.
Before:
  BM_math_sin_fast                48 ns         48 ns   14693053
  BM_math_sincos                  61 ns         61 ns   11470219

After:
  BM_math_sin_fast                48 ns         48 ns   14725120
  BM_math_sincos                  43 ns         43 ns   16329843

Bug: N/A
Test: ran tests, benchmarks
Change-Id: I8693c64135233c0641af5302c38748f47ac76737
2018-05-09 12:25:12 -07:00
Elliott Hughes
0364a4b446 Switch to FreeBSD catrigl.c for complex arc trig functions.
Bug: N/A
Test: ran tests
Change-Id: I9efbc23bc101fcf04a01334748461f5467dcf85e
2018-05-09 12:24:28 -07:00
Elliott Hughes
8da8ca4528 Update libm from upstream.
Bug: N/A
Test: ran tests
Change-Id: Ifa03eb36d412a2776208cd2921936be4724e5547
2018-05-09 12:24:21 -07:00
Elliott Hughes
589592cb7c Remove -Wno-uninitialized from libm Android.bp.
We can turn on -Wall too, if we turn off const-unused-variable and
unused-variable.

Bug: N/A
Test: builds
Change-Id: I8d889ea0acd334fbacbf7e707bcc2d0be633e4d5
2018-03-15 13:52:22 -07:00
Elliott Hughes
cbc80ba9d8 Switch the rest of our internal headers to #pragma once.
We've been using #pragma once for new internal files, but let's be more bold.

Bug: N/A
Test: builds
Change-Id: I7e2ee2730043bd884f9571cdbd8b524043030c07
2018-02-13 14:27:17 -08:00
Dan Albert
40f15ec4b1 Package bionic static libraries in the NDK.
Test: build/soong/scripts/build-ndk-prebuilts.sh
Bug: https://github.com/android-ndk/ndk/issues/272
Change-Id: Ibb21d799fdcf230ed45db0b809e20dd86d2d8e52
2018-01-22 12:40:56 -08:00
Ian Pedowitz
b6310c2aa7 Fixing app compat issue b/72143978
This is a squash revert of a4a4854 and 1b0f2b4

  Revert "Remove a test for backwards compatibility we no longer support."

  This reverts commit a4a485454a.

  # This is the commit message #2:

  Revert "Remove obsolete workaround."

  This reverts commit 1b0f2b49d5.

Bug: 72143978
Bug: 24465209
Test: Tested failing case on sailfish, reverted back all CL's since
Test: 3471433 for b/24465209 and apps open
2018-01-18 16:26:45 -08:00
Elliott Hughes
1b0f2b49d5 Remove obsolete workaround.
Bug: http://b/24465209
Test: manually ran the app.
Change-Id: I1e2a498864c74ff3a9886b97f7dc60ad7f6dfa44
2018-01-10 11:05:19 -08:00
Elliott Hughes
9a1bb70ba0 Use builtins for fma/fmax/fmin/round on arm64.
Bug: http://b/27829506
Change-Id: Id243e3ba0041d5efce496f0760815e591a2c00a0
Test: ran tests and inspected arm64 assembler
2017-11-09 15:57:34 -08:00
Elliott Hughes
3b583f6330 Revert "Use builtins for fma/fmax/fmin/round on arm/arm64."
Apparently we still build non-NEON variants of bionic!

This reverts commit e57d772353.

Change-Id: I5436d913b1dc9b7d8f5e6afaea9b45002be7e825
2017-11-09 17:47:49 +00:00
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
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
5c6a7bf0dc Remove some legacy declarations from <math.h>.
These are still needed for backwards compatibility with code built by old
versions of the NDK, but we don't need to pollute the headers with them.

Also lose the hand-written code for these. The compiler-generated code
is either the same or better, and no new code is calling these functions
anyway.

Bug: N/A
Test: ran tests
Change-Id: Ib01ad9805034433e0105aec882608cc8e6526f78
2017-10-19 14:15:31 -07:00
Elliott Hughes
f1c568d1ea Add <glob.h>.
This is the FreeBSD implementation, plus some tests. The FreeBSD
implementation includes the GNU extensions and seems to be what
iOS is using too, which should provide bug compatibility for app
developers.

The code unfortunately uses a lot of stack, and uses FreeBSD locale
implementation that we don't have, but it does seem better maintained
than the other BSDs.

Bug: http://b/29251134
Test: ran tests
Change-Id: Ie477b45e42a6df1319b25712098519d2b33adf67
2017-09-26 18:46:09 -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
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
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
98414b343c Make _scan_nan a bit less visible for libandroid_support users.
Bug: N/A
Test: readelf
Change-Id: Ibb5fbf09f6ae589a3e789107a641013fc6bc375b
2017-07-17 11:23:02 -07:00
Elliott Hughes
5ea0b0667f libm symbol cleanup.
Some of this code is used in the NDK libandroid_support now, as a static
library, so just being HIDDEN in the ELF sense isn't sufficient.

Rename digittoint to __libm_digittoint so we don't trample anyone's toes.

Also remove imprecise_powl and imprecise_tgammal. It turns out (to my
surprise) that we don't even have ld128 implementations of powl and tgammal,
so even LP64 was just using the "fake_long_double.c" hack in effect. Since
that's the case, let's *actually* do that because then we're not polluting
with the internal names in addition to the aliases.

Bug: N/A
Test: readelf
Change-Id: I273cc8fdc7ce53f9b8dfd4ef7796e358fe901837
2017-07-13 17:33:15 -07:00
Ivan Lozano
e925418bdd Disable integer_overflow sanitizer in libm.
Explicitly disables the integer_overflow sanitizer in the libm library.
This change should not impact any other build targets.

Bug: 30969751
Test: Built with and without SANITIZE_TARGET=integer_overflow
Change-Id: I98d0312344086b01394f456d4b953463b5e6cb1a
2017-07-06 15:17:54 -07:00
Dan Willemsen
51a9bf1673 Remove .(ll)ndk suffix from (ll)ndk_library
Soong handles these automatically now.

Bug: 33241851
Test: Android-aosp_arm.mk is the same before/after
Test: build.ninja is the same before/after
Test: build-aosp_arm.ninja is the same before/after
Merged-In: Ibfe4cf5db732d9007b1cc12dbc523c427de1b23d
Change-Id: Ibfe4cf5db732d9007b1cc12dbc523c427de1b23d
2017-04-11 15:15:30 +00:00
Dan Willemsen
b8f7fde4bd Add LLNDK stub libraries for the VNDK
The stub libraries are the same as the (equivalent version) NDK, but
they also contain symbols tagged with 'vndk'. Except there are none of
those in Bionic currently.

For headers, the LLNDK/VNDK isn't using a sysroot like the NDK. Nor is
it hardcoding an explicit source path list like the platform. Instead it
runs the bionic/libc/include directory through versioner like the NDK,
then exports those generated headers and the kernel headers from the
stub library like any other exported header. Except it uses -isystem
instead of -I due to export_headers_as_system.

Test: aosp_arm; m -j
Test: Enable BOARD_VNDK_VERSION on aosp_arm; m -j
Test: Inspect out/soong/build.ninja before/after (w/o vndk)
Change-Id: Ief58a73907a83053b408b1d4b62999cba470d61c
2017-04-05 22:42:08 +00:00
Stephen Hines
0779f57760 Disable coverage sanitizer when address sanitizer is disabled on libm.
Test: Built bullhead with SANITIZE_TARGET="address coverage".
Change-Id: I9a8f9f42b3b8fdff6c5ff41ddd42a60c04f85a27
2016-12-01 02:23:13 -08:00
Evgenii Stepanov
f347046f2d Merge changes Iade6a185,Iab3050bd
* changes:
  Cleanup: replace sanitize:never with address:false.
  Add __libc_arc4random_unlimited_entropy.
2016-11-30 21:34:05 +00:00
Evgenii Stepanov
bc232b9f34 Cleanup: replace sanitize:never with address:false.
Bug: 33091541
Test: NFC
Change-Id: Iade6a1852e7b1f34e06c26ccadcc17bac5d81c14
2016-11-29 15:56:36 -08:00
Dan Willemsen
7ec52b12ef Enable libc/libdl/libm/linker for host bionic
Disables debuggerd integration unless building for android.

Bug: 31559095
Test: Diff out/soong/build.ninja before/after, only change is moving
      linker's libdebuggerd_client static lib to the beginning of the
      list.
Test: lunch aosp_arm64-eng; mmma -j bionic
Change-Id: I62e725f7a9b98b7fe31637d0a835fd5846b0aff0
2016-11-29 21:09:05 +00:00
Dan Albert
60dc6b2840 Mark LIBC_DEPRECATED as platform-only.
These symbols should not be exposed in the NDK.

Test: make native
Bug: None
Change-Id: I660ddce6d67bfdac029e31ef8dde2985fd4b1de5
2016-11-04 16:51:45 -07:00
Elliott Hughes
dfb74c5f59 Minor copyright header unification.
Regenerating the NOTICE file the other day left me scratching my head at
various "how do they differ?" cases, resolved by this patch.

Test: N/A
Change-Id: I4230bfa1d7ec842a4b9fb8c73dd3b39443d74054
2016-10-24 12:57:55 -07:00
Dan Albert
c30862fdbc One NOTICE file to rule them all.
Generate a single NOTICE file rather than one per library. All the
headers come from libc these days anyway.

Test: tools/update_notice.sh
Bug: None
Change-Id: I127da185fdabc2815042e19aea74c507ec108f46
2016-10-20 11:48:55 -07:00
Elliott Hughes
0568ee2641 Remove obsolete -std request.
Bug: http://b/32019064
Test: builds
Change-Id: Id662a63f08054634721750d26e0dcd3c366ed2e6
2016-10-07 10:43:30 -07:00
Dan Albert
4238a35007 Add modules for NDK headers and libraries.
Test: make checkbuild
Bug: http://b/27533932
Change-Id: I285e483ba9fb80cc3baf0d025c85344e5b79a08b
2016-09-13 14:16:14 -07:00
Dan Albert
519a4f2c05 Run genversion-scripts.py.
Test: make checkbuild
Bug: None
Change-Id: Ib81bd82db1397a8fc628bc32d9c244188865d58a
2016-09-08 13:08:47 -07:00
Dan Albert
ea4717fceb Annotate libm.map.txt.
Test: make checkbuild
Bug: http://b/30465923
Change-Id: I9a57fca0b73fb9017914e8f9984886b7d0635d28
2016-09-08 13:08:47 -07:00
Elliott Hughes
5470c18361 Make it possible to build bionic with -I instead of -isystem.
Various things:

* work around -Wnullability-completeness.
* use C++ casts in C++ and C casts in C.
* stop using attributes clang doesn't support (such as `warning`).
* remove duplicate definitions of XATTR_CREATE and XATTR_REPLACE.

Change-Id: I07649e46275b28a23ca477deea119fe843999533
2016-07-22 13:12:53 -07:00
Elliott Hughes
9c8d711aa5 Don't expose all BSD extensions.
Just expose the ones that bionic historically leaked.

Also, many of the M_* constants in <math.h> are actually POSIX.

Change-Id: I6275df84c5866b872b71f1c8ed14e2aada12b793
2016-06-13 14:14:43 -07:00
Elliott Hughes
3ba55f8022 Rationalize visibility.
If it's C or POSIX, it's in. If it's BSD or GNU, it's guarded by __USE_BSD
or __USE_GNU.

Bug: https://code.google.com/p/android/issues/detail?id=194631
Change-Id: Ife51a21c2b37b060db56780d29c929805b199cb6
2016-06-09 17:40:19 -07:00
Elliott Hughes
7581f9cee8 Clean up obsolete libm makefile cruft.
Change-Id: I52a80c182546168bc31ccc04d8bf815350dba28c
2016-06-09 15:04:27 -07:00
Colin Cross
7510c33b61 Remove deprecated Android.mk files
These directories all have Android.bp files that are always used now,
delete the Android.mk files.

Change-Id: Ib0ba2d28bff88483b505426ba61606da314e03ab
2016-05-26 16:41:57 -07:00
Elliott Hughes
882b8afedc Regenerate NOTICE files.
Also clean up some near-miss copyright headers in libm, and remove
some cruft in <grp.h>/<pwd.h> that the script can't automatically
ignore since we stripped all the tabs in those files.

Change-Id: I10796c54dda1ceba87822ae0de26b5d71b54972b
2016-05-16 17:46:00 -07:00
Dan Willemsen
0c6570817f Update Android.bp to match Android.mk
* Remove --exclude-libs ldflags (e29e99c51)
* Mips strlen check was inverted
* ARM specific libc changes only apply to the shared library
* Reorder libjemalloc and malloc_common to match Make's ordering (for
  better binary diffing)

Change-Id: Ib41bd47565b1e8fadd285daa7b337cff1edd0808
2016-05-12 13:34:35 -07:00
Dan Albert
e29e99c514 Remove --exclude-libs ldflags.
This is now done by default in the build system.

The comments say don't do this, but we have linker scripts that
protect the few symbols we have to actually keep now.

Bug: http://b/24166967
Change-Id: Iff1beeb0f54f80b23fb1561f37a39f208e0bf676
2016-05-06 13:18:59 -07:00
Colin Cross
7941678b39 Update Android.bp to match Android.mk
Change-Id: Idaaf5019599739c50f387382ca6749af968d7095
2016-05-04 12:23:25 -07:00
Elliott Hughes
3d125175d7 Move <machine/endian.h> somewhere more private.
Bug: http://b/28519060
Change-Id: I1c7811f95f46c65d4152bcf509b6e048c45bc28b
2016-05-02 15:44:56 -07:00
Colin Cross
27c43c505e Update sanitize property format
Change-Id: I2fd35d6d85c7da7e96ffcefcd81350c836f0db9c
2016-04-15 16:36:13 -07:00