Commit graph

276 commits

Author SHA1 Message Date
Elliott Hughes
a93431ca4c arm64: simplify the fenv implementation a bit.
The macOS man page was helpful in advancing my understanding of
feupdateenv() in particular.

Test: treehugger
Change-Id: I511e8b31ac16f3fdf08b42eee5a2e6558ec3b70b
2022-10-14 20:38:35 +00:00
Elliott Hughes
022e1aa767 Sync libm with upstream freebsd.
This is a complete update.

Test: treehugger
Change-Id: I91cc4d57ea49b46b607fde8fa30e2e04ecc9e690
2022-07-12 17:01:46 -07:00
Elliott Hughes
291f98a66d Switch to the more common idiom for scripts in genrules.
Bug: http://b/198619163
Test: treehugger
Change-Id: I8a6e9e179aef45e1b0622a2e15f80f92041f9736
2022-06-30 23:35:11 +00:00
Dan Albert
2d8d2a0064 Disable strict abigail checking pending asm fix.
Test: m ndk
Bug: http://b/190554910
Change-Id: Ideb0c6d8ac5428c2ebe211393929f1d5c891dfba
2022-03-29 15:59:00 -07:00
Colin Cross
335e27b740 Use single module for libclang_rt.builtins-exported
The clang prebuilts now provide a single module with per-architecture
variants instead of a module per architecture.

Bug: 220019988
Test: m checkbuild
Ignore-AOSP-First: topic contains vendor projects
Change-Id: I079f36f94b13e06d59a16cf665b65db76084021a
Merged-In: I079f36f94b13e06d59a16cf665b65db76084021a
2022-03-01 11:36:55 -08:00
Elliott Hughes
99ef447d0f libm: sync with upstream.
There's potential here to maybe lose some/all of builtins.cpp, but I'll
look at that separately later.

Test: treehugger
Change-Id: I2c2bc1d0753affdd214daeb09fa1ac7cd73db347
2022-01-12 17:52:15 -08:00
Elliott Hughes
a13d0660fe Use -fno-builtin for libc and libm.
clang was getting in the way of a strftime(3) optimization, and smaller
hammers weren't working, and this seems like the right choice for libc
anyway? If we have code that can usefully be optimized, we should do it
in the source. In general, though, no libc/libm author should be
ignorant of memset(3) or memcpy(3), and would have used it themselves if
it made sense. (And the compiler isn't using profiling data or anything;
it's just always assuming it should use the functions, and doesn't
consider whether the cost of the calls can be amortized or not.)

Test: treehugger
Change-Id: Ia7e22623e47bfbfcfe46c1af0d95ef7e8669c0f6
2021-12-02 14:42:16 -08:00
Chih-Hung Hsieh
9935aa7a27 Add/allow clang-14 warnings.
* -Wstatic-in-inline found in
  libm/upstream-freebsd/lib/msun/src/s_lround.c

Test: mm in bionic/tests
Bug: 201432564
Bug: 202752322
Change-Id: I4d506fa539ab0de939d85924a5fd9a61644e4fb0
2021-10-11 12:37:56 -07:00
Pirama Arumuga Nainar
0c3bb2cf8f [libm] Set pragma FENV_EACCESS for x86_64, i386
Bug: http://b/157914307

This pragma enables
- -frounding-math, i.e. rounding mode set at runtime are honored
- -ffp-exception-behavior=strict, i.e. FPE semantics are preserved.
- Prevents use of FMA instructions.

Test: Build toolchain without revert https://r.android.com/1298100
      and run bionic-unit-tests.math_h*
Change-Id: I6249b20c93e0fd4ebbdfbe433da4ad4a65d3747b
2021-08-20 14:49:17 -07:00
Colin Cross
b5bfe0bd51 Move system_shared_libs into target.bionic clause
Use target.bionic.system_shared_libs when it is used to limit the
default shared libraries (as opposed to remove them completely).
This avoids attempting to add a host dependency on libc when
system_shared_libs is modified to apply to all variants.

Bug: 193559105
Test: m checkbuild
Change-Id: I8d623321ce5145cf2968f83f78b5cb50711290f4
2021-07-13 16:26:28 -07:00
Colin Cross
a0a4a6c296 Replace llndk_library with llndk clause in cc_library
Remove the vestigial llndk_library and replace it with properties
in the llndk clause of the implementation cc_library.

In order to reduce duplication of the arch-specific headers used
by the implementation and LLNDK, rename libc_headers_arch to
libc_llndk_headers and hoist the "include" directory out of it,
since that directory is preproccessed separately for LLNDK
libraries.

Bug: 170784825
Test: m checkbuild
Test: compare out/soong/build.ninja
Change-Id: I75f0ff9129d910640da55eee6a6387467e6e4a9d
2021-04-26 17:45:57 -07:00
Bob Badour
aa7d835fdd Add LOCAL_LICENSE_KINDS to bionic
Added SPDX-license-identifier-Apache-2.0 to:
  apex/Android.bp
  libdl/Android.bp
  tools/Android.bp
  tools/versioner/Android.bp
  tools/versioner/src/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  benchmarks/Android.bp
  benchmarks/linker_relocation/gen/Android.bp
  libc/malloc_debug/Android.bp
  libc/system_properties/Android.bp
  tests/Android.bp
  tests/libs/Android.bp
  tests/libs/Android.build.dlext_testzip.mk
  tests/make_fortify_compile_test.mk

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-ISC SPDX-license-identifier-MIT
    legacy_notice legacy_unencumbered
to:
  libc/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT legacy_unencumbered
to:
  libm/Android.bp

Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered
to:
  libc/tools/Android.bp

Added SPDX-license-identifier-BSD
to:
  benchmarks/linker_relocation/Android.bp
  benchmarks/spawn/Android.bp
  libc/async_safe/Android.bp
  libc/malloc_hooks/Android.bp
  libfdtrack/Android.bp
  linker/Android.bp
  tests/headers/Android.bp
  tests/headers/posix/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Exempt-From-Owner-Approval: janitorial work
Change-Id: Ib05bcaa276b3aa71a7654ccbe8e67e1f16aec9f3
2021-02-19 23:38:28 +00:00
Elliott Hughes
aa8db1b9d1 Fix/update notices.
Auto-generate NOTICE files for all the directories, and for each one
individually rather than mixing libc and libm together.

Test: N/A
Change-Id: I7e251194a8805c4ca78fcc5675c3321bcd5abf0a
2021-02-16 15:06:50 -08:00
Chih-Hung Hsieh
444e2f69e9 Add -Wno-ignored-pragmas.
* https://reviews.llvm.org/D90316 changed warning on
  FENV_ACCESS pragma from unknown to ignored.
  Existing -Wno-unknown-pragmas cannot suppress the new
  -Wignored-pragmas.

Bug: 178516148
Test: make with WITH_TIDY=1
Change-Id: I783feef35324ef43946efca844cd944410875bfa
2021-02-04 23:51:53 +00:00
Ryan Prichard
15ade069b1 Merge changes from topic "builtins-exported"
* changes:
  Use exported variants of arm32/x86 builtins
  Fix -Wl,--exclude-libs typo: x86->i686
2021-02-02 00:30:03 +00:00
Ryan Prichard
c22562ce6f Use exported variants of arm32/x86 builtins
For backwards compatibility (e.g. with old apps), arm32 libc.so and
libm.so export some of the builtins. On 32-bit x86, libc.so also
exports some of the builtins.

The non-exported variant of the builtins will eventually have hidden
symbols but doesn't currently because D93431 hasn't been merged into
our toolchain yet. See:
 - https://reviews.llvm.org/D93431
 - I44ec79728db92c089e2f39823c35b6f97d24c1ab in toolchain/llvm_android

Bug: http://b/153025717
Test: bionic unit tests
Change-Id: Ic489cb06a07ef61412502fc65a21b0cf630c11ed
2021-01-28 15:42:37 -08:00
Elliott Hughes
bac0ebbf90 Sync libm with upstream FreeBSD.
Upstream SHA 78599c32efed3247d165302a1fbe8d9203e38974.

Test: treehugger
Change-Id: Ib103d211315e320df89a6f0bcb30cd8ba67dd603
2021-01-26 14:19:25 -08:00
Colin Cross
d9a9622c31 Don't set native_bridge_supported: true for ndk libraries
Native bridge modules will never compile against stubs, remove
native_bridge_supported: true.

Test: m checkbuild
Change-Id: I0eb93fe1a2c3f6ca34ce4dab17edda8807132ce8
2021-01-19 14:58:25 -08:00
Yifan Hong
02bee7182e Merge "Make vendor_ramdisk_available." 2020-10-29 17:17:29 +00:00
Yifan Hong
b04490d7e5 Make vendor_ramdisk_available.
Test: pass
Bug: 156098440
Change-Id: I8fe2deb8fa3b24c227202be02d8af648629cffeb
2020-10-27 17:06:45 -07:00
Colin Cross
8393a8bc84 Make the connection between implementation and llndk_library explicit
Instead of assuming a module with the .llndk suffix exists, add an
llndk_stubs property to every cc_library module that has a
corresponding llndk_library.  Also rename the llndk_library to have
an explicit .llndk suffix.

Bug: 170784825
Test: no changes to build.ninja (excluding comments) or Android-${TARGET_PRODUCT}.mk
Change-Id: Ib5453472a09ebc64818ceb69bcbe1184720ce86a
2020-10-19 13:37:49 -07:00
Yi Kong
15a05a77b4 No global ThinLTO for bionic
There are multiple build breakages with bionic when we enable ThinLTO
globally. Opt bionic out of ThinLTO for now.

#global-thinlto-opt-out

Test: TreeHugger
Bug: 169004486
Change-Id: I546a8074f9c3e0ddbd01d3b7cd730e215e3c0c49
2020-09-29 17:24:04 +00:00
Elliott Hughes
73ed0c4525 Merge changes from topic "arm64_branch-protection"
* changes:
  libc: Add Armv8.3-A PAuth and Armv8.5-A BTI compatibility to *.S
  Update crtbegin.c and crt*.S to support Armv8.5-A BTI
  libm: Add Armv8.3-A PAuth and Armv8.5-A BTI support to assembly files
  libc: Prepare support for Armv8.3-A PAuth and Armv8.5-A BTI in *.S
2020-09-25 16:08:14 +00:00
Dan Albert
bda85584d1 Merge "Avoid explicit use of "10000" in build files." 2020-09-24 21:02:12 +00:00
Tamas Petz
42b6530b1b libm: Add Armv8.3-A PAuth and Armv8.5-A BTI support to assembly files
This change adds both Armv8.3-A Pointer Authentication and Armv8.5-A BTI
support to *.S files.

Tests: Tested on FVP with BTI enabled

Change-Id: I82750afcbc950a91584463fbc979c2c35d41916a
2020-09-04 11:28:49 +02:00
Stephen Hines
c68ec152d1 Fix issues with .note.GNU-stack section directives.
bionic/libm/x86_64/s_log1p.S:809:2: error: changed section type for .note.GNU-stack, expected: 0x1
 .section .note.GNU-stack, ""
 ^

These assembly sources are missing @progbits to set the section flags
correctly. Without it, they end up denoting a different section type. By
adding the @progbits explicitly, we see the same section flags with
readelf.

[ 4] .note.GNU-stack   PROGBITS        0000000000000000 000593 000000 00      0   0  1

Bug: http://b/155835175
Test: m for aosp_x86_64
Change-Id: Ifff35d35f5f9ded5938e88677b18805809820e9f
2020-08-21 12:17:12 -07:00
Dan Albert
48943b20c0 Avoid explicit use of "10000" in build files.
Test: treehugger
Bug: None
Change-Id: Iab713c5f4b53665f8224b3857beaa6a1d19f8d69
2020-08-13 13:35:17 -07:00
Elliott Hughes
f762275e6a Show coverage for libm too.
Test: manual
Change-Id: Idf50d918ad53ff2d5a3097dfcbd5a392d6f0ed31
2020-08-12 10:25:45 -07:00
Jooyung Han
26ddc4dccf Add 29 to stubs.versions of libc/libdl/libm
Stubs of version 29 should be provided to those APEX modules targeting
previous SDK release.

Bug: 145796956
Test: m
Change-Id: I9454fbf81377aba25e75a6fdfc77cbb070eaadde
2020-02-27 09:57:50 +00:00
Elliott Hughes
44c01c77d3 Clean up the math headers.
I had hoped that this would then let us remove more of the "introduced
in" annotations, but it looks like that's not really going to happen
until the NDK's minimum supported API is 21.

Also remove a .c file that wasn't referenced anywhere.

Test: treehugger
Change-Id: I8b4a61c082293f8445195a4fa5ee30595d70444e
2020-02-11 08:46:29 -08:00
Christopher Ferris
1cc755c8cf Fully disable clang format where needed.
Even with formatting off, clang still tries to rearrange the include
files or the using statements, so disable that too.

Test: Verified that the include directories are not rearranged.
Change-Id: I991a1b2bfa94a8202c5a486664658d654f1c7811
2020-01-30 08:10:17 -08:00
Christopher Ferris
fdaf82f96b Link .clang-format file to system/core one.
Use the .clang-format-2 found in system/core instead of this which is
not actually being used.

Also, enable clang-format running by default.

All upstream directories are marked as ignoring formatting so that
their source files are not modified.

Test: NA
Change-Id: Icee6030f373fa5f072df162f97e6f34320e3d89a
2020-01-29 15:14:20 -08:00
Yifan Hong
5a39cee1ce Make ramdisk_available.
Test: pass
Bug: 147347110
Change-Id: I142311a7558a19d209bcd63207a88e12cf6f130e
2020-01-22 12:09:33 -08:00
Elliott Hughes
4540db6fae Track library name change.
Test: treehugger
Change-Id: Ief93c2a18144ee2da134a4800e1965b91be7f32c
2020-01-07 13:48:44 -08:00
Peter Collingbourne
73166c8bfb Stop exporting certain deprecated unwinder symbols from libc.so and libm.so.
We have data that indicates that we no longer need to export the libgcc
unwinder's implementation detail symbols from libc.so, as well as the entire
unwinder interface from libm.so, so stop exporting them.

Bug: 144430859
Change-Id: Iebb591c4a121abe6368d9854ec96819abe70a006
2019-11-15 15:59:58 -08:00
Peter Collingbourne
b061e77748 Link libgcc_stripped into libc.so and libm.so with --whole-archive on ARM.
This library was previously being statically linked into both libraries as a
consequence of the relocation to __aeabi_unwind_cpp_prX present in most object
files. However, after LLVM commit 1549b469, we no longer emit these relocations
on Android, so we need to link the library explicitly with --whole-archive. The
intent is to eventually stop linking libgcc into these libraries altogether,
but for now, we need to keep linking them in order to avoid breaking the build.

Change-Id: I275109527b7cbd6c4247b3fe348975d720626273
2019-11-12 14:26:23 -08:00
Elliott Hughes
ff49a3c03a libm: sync with upstream FreeBSD.
Bug: http://b/143311272
Test: ran tests
Change-Id: I0fbf94fb5cd13e64a55957d0f951757746d0367a
2019-10-24 18:13:32 -07:00
Elliott Hughes
48da33389b Merge "Remove unused -D from libm build." 2019-10-09 15:09:59 +00:00
Elliott Hughes
2584b88469 Remove unused -D from libm build.
Test: treehugger
Change-Id: I3dd9625790f56b49fabd3fa7b58aab23bffa9dba
2019-10-08 17:53:58 -07:00
Jiyong Park
e87e0dcbae Restrict the availability of the bionic libs
The bionic libs are now restricted to be in the runtime APEX and the
platform (for bootstrapping). It can still be referenced from other
APEXes but can't be included there.

Bug: 139870423
Test: m
Change-Id: I7f99eef27ccf75844ca5c9a7ea866496841b738f
2019-10-07 13:52:32 +09:00
Elliott Hughes
3984a99742 libm: track arm-optimized-routines changes.
Test: builds
Change-Id: I194ba29a2cabbf2fb2ef5c14ac6ad6252b43c76d
2019-09-17 13:08:02 -07:00
Elliott Hughes
ef14a89f72 libm: remove unused x86/x86_64 assembler.
Test: treehugger
Change-Id: Icefa51fe2d204f0ad5700fd67649a1d4b1e6a38f
2019-08-27 09:16:12 -07:00
Elliott Hughes
8947972afd SSE4.1 is part of the Android x86/x86-64 ABI.
We shouldn't be treating this as a special variant.

Test: builds
Change-Id: I80722f941b5aefe34d777db329453cbedf249620
2019-07-15 10:17:16 -07:00
Mitch Phillips
dfde0eeee1 Change SANITIZE_TARGET refs from 'coverage' to 'fuzzer'.
Cleanup of references to 'coverage' in build files. Part of a larger
cleanup to make fuzzing work again in the Android build tree.

Also fixed a test issue with emulated TLS with the new changes, and
removed libc.so fuzzer support until a linked bug is fixed
(b/132640749).

Bug: 121042685
Test: With all patches in the bug merged: mmma bionic
Change-Id: I592352fe9210ff811a2660a88cbbfe48d70a1e57
Merged-In: I592352fe9210ff811a2660a88cbbfe48d70a1e57
2019-05-30 16:49:13 +00:00
dimitry
7f04880820 Enable native_bridge_support
Enable native bridge support for bionic libraries.
Makes it possible to use them in binaries for translated
architectures.

Bug: http://b/77159578
Test: make
Change-Id: Iccd4ad7aecfa5260cc15f09ca975d2e18987278a
2019-05-06 17:13:51 +02:00
Jiyong Park
036e09c36e Don't install *.mountpoint targets
The *.mountpoint targets that installs /bionic/lib/lib*.so and
/bionic/bin/linker* are no longer needed.

Now, /system/lib/lib*.so and /system/bin/linker* are simply symlinks to
the corresponding files in the runtime apex. For example,

/system/lib/libc.so -> /apex/com.android.runtime/lib/bionic/libc.so

This is made possible because we now activate APEXes even before the
data partition is mounted. Before the data partition mounting, the
APEXes from the system partition are ativated. After the data partition
is mounted, updated APEXes in the partition (if any) are activated. As a
result, the symlink always points to the valid path regardless of
whether /data is mounted or not.

Bug: 125549215
Test: device boots
Change-Id: Ie7d83686abe00b3c436f9f9db75d4244200a0fc9
2019-03-14 07:35:52 +09:00
Yi Kong
1ac113dc6b Turn on XOM for libm
Test: bionic-unit-tests
Bug: 122993571
Bug: 123241361
Change-Id: I070d3a2627ee64124ff415a646ddfbcc767b54d1
2019-02-22 14:03:15 -08: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
16f947281f Use no_libcrt property instead of hard coding projects to exclude
Test: m checkbuild
Change-Id: If34c72d37dc4077ca3e83135391256bc53d295b5
2019-02-12 09:49:23 -08:00
Elliott Hughes
2d1a2aa13d libm: sync with upstream FreeBSD.
Test: ran tests
Change-Id: I16b5930b0dc652ceac60d8ed1d57c6126c74699c
2019-02-04 13:43:48 -08:00