Commit graph

21447 commits

Author SHA1 Message Date
Dan Albert
f66fa495a8 Add __ANDROID_NDK__ to identify using the NDK.
I've added some things like __ANDROID_MAJOR__ to an ndk-version.h, but
that is only in the NDK itself and so doesn't help the platform. Add
__ANDROID_NDK__ to identify that you're building for the NDK and not
the platform.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/407
Change-Id: I2d1f1c28e3764e4e658cf675b290b7a17253ee33
2017-07-26 14:27:43 -07:00
Treehugger Robot
9306889509 Merge "Build crtbegin with clang too." 2017-07-25 21:03:26 +00:00
Treehugger Robot
33f9043f48 Merge "Create global seccomp policy." 2017-07-25 20:18:51 +00:00
Elliott Hughes
b348d5cda8 Build crtbegin with clang too.
If _start_main is static, clang optimizes it out and then generates an
undefined reference from the inline assembler, so let's explicitly tell
the compiler it's used.

Bug: N/A
Test: ran tests
Change-Id: Iba3d9c63abae9a0dc32f236b01783515f0190956
2017-07-25 11:54:33 -07:00
Treehugger Robot
086b1b5a22 Merge "Split our FORTIFY implementation into libc_fortify" 2017-07-25 18:05:42 +00:00
Elliott Hughes
b8115bdf4f Merge "tests: clean up bionic-unit-tests-static linking" 2017-07-25 14:51:32 +00:00
Elliott Hughes
f32d484ace tests: clean up bionic-unit-tests-static linking
Adding libc++_static explicitly is not needed when it is specified
via stl:, and was the real reason we needed --allow-multiple-definition.

Bug: N/A
Test: ran static tests (32- and 64-bit)
Change-Id: I254a4b8c4f7955a17c970d31b427b05c1a2e0acf
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
2017-07-24 16:22:17 -07:00
George Burgess IV
6cb0687932 Split our FORTIFY implementation into libc_fortify
As requested in the bug. This also rips __memcpy_chk out of memcpy.S,
which lets us cut down on copypasta (all of the implementations look
identical).

Bug: 12231437
Test: mma on aosp_{arm,arm64,mips,x86,x86_64} internal master;
checkbuild on bullhead internal master; CtsBionicTestCases on bullhead.
No new failures.
Change-Id: I88c39ca166bacde0b692aa3063e743bb046a5d2f
2017-07-24 14:20:16 -07:00
Treehugger Robot
4fce647a5b Merge "Remove the HASLB and FREEUB macros." 2017-07-24 21:05:37 +00:00
Elliott Hughes
4dc80181cd Merge "Make xfail passes not failures." 2017-07-24 20:51:18 +00:00
Elliott Hughes
bff8da308f Merge "Replace fmemopen." 2017-07-24 20:36:16 +00:00
Elliott Hughes
89ff49942b Merge "Apply recent strto* fix, add new tests." 2017-07-24 20:18:34 +00:00
Elliott Hughes
57ad09278f Merge "Replace killpg." 2017-07-24 20:16:40 +00:00
Treehugger Robot
fd80e39546 Merge "Switch to FreeBSD for wcsstr and wmemcpy." 2017-07-24 19:23:36 +00:00
Elliott Hughes
80e4c1529d Remove the HASLB and FREEUB macros.
Because we hate macros.

Bug: N/A
Test: ran tests
Change-Id: I2c94085ff502ec5ce6d8598ec6b3c10e7a4b5510
2017-07-24 11:58:23 -07:00
Elliott Hughes
3a4c45499e Replace fmemopen.
A new implementation starting from the FreeBSD fmemopen rather than the
OpenBSD one we used to use.

The tests were arrived at by translating each sentence in
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html,
plus http://man7.org/linux/man-pages/man3/fmemopen.3.html for historical
GNU bugs.

Bug: http://b/31304889
Test: ran tests
Change-Id: Id8b168c9ecde638e9cdedbc3b8a0982fc83c7048
2017-07-24 10:48:42 -07:00
Steve Muckle
aa3f96c9c4 Create global seccomp policy.
Enabling seccomp across all processes, rather than just zygote, is
useful for auditing the syscall usage of AOSP. Create a global seccomp
policy that can optionally be enabled by init.

Bug: 37960259
Test: confirm global seccomp by removing finit_module from policy and
      observing modprobe fail, confirm regular seccomp unchanged by
      comparing length of installed bpf
Change-Id: Iac53a42fa26a80b05126f262dd9525f4f66df558
2017-07-21 20:30:21 -07:00
Elliott Hughes
93a89f84e4 Make xfail passes not failures.
Bug: http://b/63703384
Test: ran tests
Change-Id: I02dfc92cfc0e07831b8f3a974803be384bc02f1e
2017-07-21 18:51:06 -07:00
Elliott Hughes
248b5cb672 Merge "Explain how to handle device-specific headers." 2017-07-22 01:22:09 +00:00
Treehugger Robot
71853ad5c5 Merge "Remove outdated _FORTIFY_SOURCE #undefs" 2017-07-21 21:35:37 +00:00
George Burgess IV
53c4c8abb0 Remove outdated _FORTIFY_SOURCE #undefs
AFAICT, all of these were added prior to the new-style FORTIFY going
in. Because clang saw two definitions of the "same" function, it got
upset. (e.g. 35d937e4eb)

Now that our FORTIFY functions are overloads of their library functions,
these undefs can be removed.

(This is a step toward making FORTIFY a library with -U_FORTIFY_SOURCE
on it, as requested in the bug.)

Bug: 12231437
Test: CtsBionicUnitTests. No new failures.

Change-Id: I844ff77106ee2bea72ae1cd0bb85d146939ecd05
2017-07-21 11:25:52 -07:00
Treehugger Robot
b8ce93974a Merge "Use __RENAME_IF_FILE_OFFSET64 where possible." 2017-07-20 19:21:38 +00:00
Elliott Hughes
a57c87827c Explain how to handle device-specific headers.
Bug: N/A
Test: N/A
Change-Id: I12c41fcb4839ad86f5a1f62153a3348c3e40f90f
2017-07-20 10:36:27 -07:00
Elliott Hughes
7c5a851656 Use __RENAME_IF_FILE_OFFSET64 where possible.
It's not usable for cases where the off_t and off64_t functions became
available in different API levels, so it's not as big an improvement as
we'd hoped, but it cleans up several headers and should be usable for
any future additions (though recent Linux additions have _only_ supported
off64_t anyway).

Bug: N/A
Test: builds
Change-Id: I18b00f30666079d9d12d5b9c0ed916076d6c3641
2017-07-20 10:00:28 -07:00
Treehugger Robot
0d6485eca4 Merge "Add __RENAME_IF_FILE_OFFSET64." 2017-07-19 05:37:13 +00:00
Elliott Hughes
a571e9e748 Merge "Document the intricacies of _FILE_OFFSET_BITS=32 for LP32." 2017-07-18 18:04:25 +00:00
Elliott Hughes
9ada00a82c Document the intricacies of _FILE_OFFSET_BITS=32 for LP32.
Bug: https://github.com/android-ndk/ndk/issues/453
Test: N/A
Change-Id: I5c00e63c861b19071229d2eae737dfbeb550e7e8
2017-07-17 15:00:41 -07:00
Elliott Hughes
fbd8762e6e Merge "Make _scan_nan a bit less visible for libandroid_support users." 2017-07-17 21:45:46 +00:00
Dan Albert
f5605374da Add __RENAME_IF_FILE_OFFSET64.
Convenience macro for __RENAME if __USE_FILE_OFFSET64 mode. Lets us
avoid duplicating all the doxygen comments in frameworks headers.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/459
Change-Id: Ica44f22b2f1596e484694006c0926d94d16187b5
2017-07-17 14:05:44 -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
Treehugger Robot
dcdd0e3760 Merge "Hide various mbstate implementation details." 2017-07-15 03:12:36 +00:00
Treehugger Robot
65cebf0804 Merge "Allow passing filenames to generate-NOTICE.py." 2017-07-15 01:07:39 +00:00
Elliott Hughes
697f42afdb Hide various mbstate implementation details.
...by inlining them.

Also fix a couple of harmless bugs in passing. I've added tests, but in
both cases I don't think it was actually possible to hit the bad behavior:
we'd hit another test and fail immediately after in an externally
indistinguishable way.

Bug: N/A
Test: readelf
Change-Id: I8466050b0bfe2b7b94c76b383cf10c1d9d28debd
2017-07-14 17:00:05 -07:00
Elliott Hughes
aac7c3affa Allow passing filenames to generate-NOTICE.py.
For the libandroid_support NOTICE file, we need to combine all the files
in that directory, plus the specific files pulled from bionic.

Also cleaned up some of the Python style.

Bug: N/A
Test: used for libandroid_support
Change-Id: If433e3a0f0478f06d99a9b3556e99dde06a7e5e1
2017-07-14 15:41:11 -07:00
Treehugger Robot
b1c3da1d89 Merge "__cfi_slowpath[_diag] are available to NDK and VNDK clients" 2017-07-14 22:09:50 +00:00
Treehugger Robot
4ebed99e25 Merge "libm symbol cleanup." 2017-07-14 18:51:03 +00: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
Treehugger Robot
03e9c498d4 Merge "Fix unistd._POSIX_macros_smoke test." 2017-07-13 19:25:38 +00:00
Treehugger Robot
78c8b306ee Merge "Move wchar _l functions out of wchar.cpp." 2017-07-13 19:21:11 +00:00
Dan Albert
3f03579589 Move wchar _l functions out of wchar.cpp.
We don't need these in libandroid_support, but we do need the other
parts of wchar.cpp, and they're not really related.

Test: make checkbuild
Bug: None
Change-Id: I40f3089b034abfd4873e81c0b6216a7cfd977d8d
2017-07-13 10:29:20 -07:00
Elliott Hughes
a35293534f Fix unistd._POSIX_macros_smoke test.
We now claim _POSIX2_VERSION, but the test wasn't updated.

Bug: N/A
Test: ran tests
Change-Id: Idb3369b3df4b964f585597f0d37962ae619322d2
2017-07-13 10:20:41 -07:00
Elliott Hughes
20f3399956 Switch to FreeBSD for wcsstr and wmemcpy.
Almost all of our w* functions come from FreeBSD already. The one downside is
that we can't take all our w* functions from FreeBSD because FreeBSD handles
locales very differently from us.

Bug: N/A
Test: ran tests
Change-Id: I177b4332499992babd5d5afe5b3f469f8c4345a5
2017-07-13 09:45:00 -07:00
Elliott Hughes
f826a37b95 Apply recent strto* fix, add new tests.
The behavior with "0xy" was wrong: we'd swallow the 'x'.

Bug: N/A
Test: ran tests
Change-Id: I2464d22a2408e99880303876306f18a25c390ad9
2017-07-13 09:35:15 -07:00
Dan Albert
2d585e0070 Merge changes from topic 'locale-android-support'
* changes:
  Add a non-TLS slot implementation of locale.cpp.
  Move non-locale.h APIs out of locale.cpp.
2017-07-13 08:34:57 +00:00
Christopher Ferris
ada33eb9b4 Merge "Really fix the mac build." 2017-07-13 06:13:14 +00:00
Christopher Ferris
5fc1f6e887 Really fix the mac build.
I forgot an underscore.

Test: Builds.
Change-Id: Ib7da13dea315822af89c53a569fb0a0c2fd5d321
2017-07-12 23:10:07 -07:00
Treehugger Robot
b1e4cc31a4 Merge "Fix max build." 2017-07-13 04:32:33 +00:00
Christopher Ferris
bad43c7af4 Fix max build.
Test: Built properly.
Change-Id: I37b8ac7d42653617be6611b640a883066257214c
2017-07-12 19:33:54 -07:00
Jiyong Park
f1cee9662f __cfi_slowpath[_diag] are available to NDK and VNDK clients
When a vendor lib (or vendor-available platform lib) is built with
sanitizer on, __cfi_slowpath_diag is required. However, when building
for those libs, the llndk stub of libdl.so is provided for them and
__cfi_slowpath_diag is not exposed to the stub. In order to make the
sanitizing build successful, expose the symbol.

These symbols are also exposed to NDK clients since we may want to CFI
for unbundled apps.

Bug: 63053790
Bug: 63342219
Test: BOARD_VNDK_VERSION=current m -j libstagefright_foundation.vendor

Change-Id: I081deddb4f66354aaecec4b395d4e17e5566c578
2017-07-13 10:18:56 +09:00
Christopher Ferris
61b7e114dd Merge "Support memory alignment tests for string_benchmark.cpp" 2017-07-12 22:56:13 +00:00