Commit Graph

21558 Commits

Author SHA1 Message Date
Elliott Hughes 82e950c9fb Actually turn on -Werror for crtbegin.
And then -Wno-gcc-compat in the right place this time. (But leaving the
other one because I don't care in the non-crtbegin code either.)

Bug: N/A
Test: builds without warnings now
Change-Id: Id2cfa3392ee80c045644ebfdf92c6d341db90964
2017-07-27 16:39:02 -07:00
Dan Albert 5f7135eddd Allow calling v?dprintf for any target API level.
Old versions of Android called these fdprintf and vfdprintf out of
fears that the glibc names would collide with user debug printfs.

Allow users to just use dprintf and vfdprintf on any version by
renaming those calls to their legacy equivalents if needed.

Test: built trivial NDK module targeting android-14 and using dprintf
Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/72
Change-Id: I90de149278f931380418536abaef47c5cee5c195
2017-07-27 16:32:01 -07:00
Christopher Ferris 525ce914ed Update to kernel headers v4.12.3.
Test: Built angler.
Change-Id: Icbcf4fac2334de8409b049ed7a3b4c24b4e98ce9
2017-07-27 16:01:39 -07:00
Elliott Hughes f54fa4e585 Remove workaround in <sys/epoll.h>.
Linux 4.12 has a better fix: https://lkml.org/lkml/2017/2/23/416 and
https://lkml.org/lkml/2017/2/23/417.

Bug: N/A
Test: builds
Change-Id: I9cbf0c60817332142c48297899062f1a25f2b082
2017-07-27 15:14:52 -07:00
Elliott Hughes 38bcf2b704 Merge "Use O_APPEND for stdio append mode." 2017-07-27 15:33:30 +00:00
Treehugger Robot 9faa95c9eb Merge "Fix error condition on strtof inline." 2017-07-27 02:40:40 +00:00
Dan Albert bd3f657e56 Fix error condition on strtof inline.
Test: make checkbuild
Test: pull into ndk, ./run_tests.py
Bug: https://github.com/android-ndk/ndk/issues/415
Change-Id: I1575f799c9e849d66456c785208a36709a7b8122
2017-07-26 17:21:47 -07:00
Treehugger Robot d3e656abeb Merge "Add __ANDROID_NDK__ to identify using the NDK." 2017-07-26 23:47:38 +00:00
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 4f36cabd8d Merge "libc: Move FORTIFY into one file; make style fixups" 2017-07-26 02:44:21 +00:00
Elliott Hughes 33a8cb1d1a Use O_APPEND for stdio append mode.
"Although not explicitly required by this volume of POSIX.1-2008, a good
implementation of append (a) mode would cause the O_APPEND flag to be set."

Yeah, about that...

Bug: N/A
Test: ran tests
Change-Id: I23c4bc5c1ebc92e0cb44025d2d313f321f9ffa68
2017-07-25 18:11:23 -07:00
George Burgess IV d34b0a946c libc: Move FORTIFY into one file; make style fixups
This addresses post-commit feedback from
I88c39ca166bacde0b692aa3063e743bb046a5d2f. With this, our FORTIFY impl
now sits in one file.

Bug: 12231437
Test: mma; no new CtsBionicTestCases failures on bullhead internal
master.
Change-Id: I6f9ff81c3e86cf9d6a0efa650eb5765f1e2fa09c
2017-07-25 17:39:21 -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