Commit graph

5275 commits

Author SHA1 Message Date
Pawit Pornkitprasan
652289942d bionic: call stdio cleanup on exit
As of 61e699a133, stdio clean up
functions are no longer registered in atexit and must be called
manually via __cleanup.

The issue this fixes is some static binaries linked against bionic
cannot output properly when piped or redirected because the buffer
is not flushed before closing.

This is done by pulling in exit.c (and other dependencies) from
netbsd.

Change-Id: I193e54a6d08900f291550029fe75ce76394d9e22
2013-11-19 09:49:17 +07:00
Elliott Hughes
ae5c3dd738 Merge "Remove the mips regdef.h and fpregdef.h old kernel headers." 2013-11-14 00:18:58 +00:00
Elliott Hughes
007eced93b Remove the mips regdef.h and fpregdef.h old kernel headers.
Bug: 11559337
Change-Id: I6352cac9c4ef425cb21e34d0299223711ec079af
2013-11-13 16:13:01 -08:00
Elliott Hughes
c425043063 Merge "Add unit tests for pow's behavior with NaNs." 2013-11-13 22:57:36 +00:00
Elliott Hughes
6a8f00d49c Add unit tests for pow's behavior with NaNs.
Bug: 11669804
Change-Id: Idfa6527640c8d0c2cf3e5343bf7afe013e237545
2013-11-13 13:29:23 -08:00
Elliott Hughes
44cbe94bba Merge "Add a unit test for syscall(2)." 2013-11-13 21:29:07 +00:00
Elliott Hughes
e61dc71efc Add a unit test for syscall(2).
Change-Id: Ic7d9735d46711af93c3a1747de7b2eb8cebea094
2013-11-13 13:14:31 -08:00
Elliott Hughes
22ba86ee44 Merge "Add extra regression tests for an already-fixed dynamic linker bug." 2013-11-12 01:01:24 +00:00
Elliott Hughes
2ed710976c Add extra regression tests for an already-fixed dynamic linker bug.
Bug: https://code.google.com/p/android/issues/detail?id=61799
Change-Id: I84af68f8430a06e999297c2e57e06ecb45adf81e
2013-11-11 15:48:06 -08:00
Elliott Hughes
6768c1ee51 Merge "Add a temporary uapi/linux/compiler.h until upstream has one." 2013-11-08 23:20:18 +00:00
Elliott Hughes
740531354e Add a temporary uapi/linux/compiler.h until upstream has one.
Bug: 11559337
Change-Id: I205974b1a26e4f85d0e11503afa80669195d211c
2013-11-08 15:13:54 -08:00
Elliott Hughes
ff5b0fc8f3 Merge "Remove the dependency on the non-uapi __kernel_nlink_t." 2013-11-08 23:12:36 +00:00
Elliott Hughes
2ecc164ae9 Remove the dependency on the non-uapi __kernel_nlink_t.
The kernel doesn't have an nlink_t; it just uses the equivalent of
uint32_t. We already had a usable __nlink_t in the C library, so
let's just define our nlink_t in terms of __nlink_t, which is what
__nlink_t was meant for anyway.

Note that our struct stat just follows the kernel, and doesn't refer
to nlink_t anyway.

Change-Id: I2a56e418e42404b1741b08c50554b03c11caebae
2013-11-08 14:38:12 -08:00
Elliott Hughes
68723453ac Merge "Generate the uapi headers for mips and x86/x86_64." 2013-11-08 22:18:46 +00:00
Elliott Hughes
abd626117c Generate the uapi headers for mips and x86/x86_64.
Bug: 11559337
Change-Id: I23b1a43e7bfa8fa6f9df7e59d2e731a0ec52dafc
2013-11-08 11:46:03 -08:00
Elliott Hughes
486c8616ac Merge "Prepare to switch to the uapi <linux/signal.h>." 2013-11-07 20:41:19 +00:00
Elliott Hughes
61fb3fc770 Prepare to switch to the uapi <linux/signal.h>.
<time.h> didn't need to copy the cruft from <signal.h>, and
<signal.h> only needs the uid_t hack when it's not using
uapi headers.

pthread_exit.cpp should include what it uses.

Change-Id: I836c36abe0f0a781d41fc425b249d1c7686bb124
2013-11-07 12:29:07 -08:00
Elliott Hughes
266eb4a44c Merge "Stop using the non-uapi <linux/err.h> header file." 2013-11-07 18:44:49 +00:00
Elliott Hughes
ed74484dcb Stop using the non-uapi <linux/err.h> header file.
We only need it for MAX_ERRNO, and it's time we had somewhere to put
the little assembler utility macros we've been putting off writing.

Change-Id: I9354d2e0dc47c689296a34b5b229fc9ba75f1a83
2013-11-07 10:31:05 -08:00
Elliott Hughes
a034e1d3e0 Merge "Remove pathconf's dependencies on non-uapi header files." 2013-11-07 01:32:27 +00:00
Elliott Hughes
7250d2e5b4 Remove pathconf's dependencies on non-uapi header files.
Change-Id: I597996e4b141b009916f7ad2866dd100e08aa4d3
2013-11-06 17:21:09 -08:00
Elliott Hughes
f945732e21 Merge "Fix a TODO; we've had SOCK_CLOEXEC for a while now." 2013-11-07 01:16:48 +00:00
Elliott Hughes
9be07fa527 Fix a TODO; we've had SOCK_CLOEXEC for a while now.
Change-Id: I4bc39b57f3c33441ead74127f576bf5a4e311566
2013-11-06 17:04:56 -08:00
Elliott Hughes
9e63e03d34 Merge "Clean up the 32-bit kernel support, fix LP64 fcntl declaration." 2013-11-07 01:02:55 +00:00
Elliott Hughes
062092543f Clean up the 32-bit kernel support, fix LP64 fcntl declaration.
In practice, thanks to all the registers the stubs don't actually change,
but it's confusing to have an incorrect declaration.

I suspect that fcntl remains broken for aarch64; it happens to work for
x86_64 because the first vararg argument gets placed in the right register
anyway, but I have no reason to believe that's true for aarch64.

This patch adds a unit test, though, so we'll be able to tell when we get
as far as running the unit tests.

Change-Id: I58dd0054fe99d7d51d04c22781d8965dff1afbf3
2013-11-06 16:33:39 -08:00
Ben Cheng
af10f9e927 Merge "Add processed uapi kernel headers for ARM." 2013-11-06 23:55:25 +00:00
Ben Cheng
a6b53f03c7 Add processed uapi kernel headers for ARM.
Change-Id: Id34de841b7b4b5a1bf7d22eb793860f92f24a6e5
2013-11-06 15:51:05 -08:00
Elliott Hughes
7115c80231 Merge "Fix pread/pwrite for LP64." 2013-11-06 22:25:17 +00:00
Elliott Hughes
8fbf8deb34 Fix pread/pwrite for LP64.
Unlike on 32-bit systems where off_t is 32-bit, we don't want to
throw away the top 32 bits of an LP64 system's 64-bit off_t.

Change-Id: Ib2e0daeb4fc0b8ab3d1b983d0b371d8f81033b50
2013-11-06 13:10:37 -08:00
Elliott Hughes
c4dbc16eb0 Merge "Make cpp.py less braindead." 2013-11-06 20:31:10 +00:00
Elliott Hughes
40596aa005 Make cpp.py less braindead.
The old code ignored operator precedence (!), despite having two tables
of operator precedence. The code's still pretty awful, but I've cleaned
it up enough to fix this, the most important bug.

This patch lets us correctly clean the uapi unistd.h, stat.h, and swab.h files,
and also fixes the mess we were already making of various old kernel
header files. I've added a bunch more tests, fixed the existing tests that
the existing script was already failing (!), and changed the script so that
the tests are run every time the script is run.

We can probably remove some of the old kernel header files that we were
parsing incorrectly, but we can worry about that later.

Bug: 11253477
Change-Id: Ie66c65b3a7ae13b4e98ed8038a6a534f06eae0e5
2013-11-06 12:04:48 -08:00
Elliott Hughes
f1258672d1 Merge "Fix <sys/select.h> for LP64, clean up <time.h>." 2013-11-05 21:54:38 +00:00
Elliott Hughes
3503ce2177 Fix <sys/select.h> for LP64, clean up <time.h>.
The 64-bit uapi headers don't define FD_CLR and friends, so this
patch updates libc/kernel/common/linux/time.h after the change
b934bbec145e9e084bf48149a3a94ae3dd132157 in external/kernel-headers,
then fixes <sys/select.h> to work in this new world, and removes
some now-unnecessary duplication from <time.h> (with other cruft
cleaned up while I'm here).

Change-Id: Ifd26f901b4d200c65065b3e6ef1b74055127e052
2013-11-05 13:28:36 -08:00
Elliott Hughes
9b9f0d0cd0 Merge "Remove unnecessary #include." 2013-11-05 20:00:30 +00:00
Elliott Hughes
6fa79c5cf5 Remove unnecessary #include.
Change-Id: I99dade0b3803272ee29eba2ad36b0311f8a24c31
2013-11-05 11:59:06 -08:00
Elliott Hughes
943cc1b588 Merge "Refresh libc/kernel/common/linux/uinput.h" 2013-10-31 23:03:16 +00:00
Scott Anderson
126f66a601 Refresh libc/kernel/common/linux/uinput.h
Change-Id: Icd830af5aee63276554ebf7bfe8192965209cc59
Signed-off-by: Scott Anderson <saa@google.com>
2013-10-31 15:45:32 -07:00
Elliott Hughes
4d2ab4c758 Merge "Fix linker crashes during unknown symbol lookup" 2013-10-31 22:07:00 +00:00
Sergey Melnikov
ebd506c69e Fix linker crashes during unknown symbol lookup
Integration of kernel VDSO into internal bionic data structures using
common functions.
Fix for dl_iterate_phdr function: the function provides incorrect
address of object in case of nonzero virtual and base addresses.
Location in address space of a particular program header should be
calculated using the formula:  addr = base_addr + virtual_addr.

Signed-off-by: Sergey Melnikov <sergey.melnikov@intel.com>
Change-Id: Ie2ab4257fd456242aab8afed0bd5bd6b29e81d6d
2013-10-31 15:06:20 -07:00
Elliott Hughes
cc9b7456b6 Merge "Move the pthread debugging flags to the right place." 2013-10-31 21:23:29 +00:00
Elliott Hughes
66759d6041 Move the pthread debugging flags to the right place.
Change-Id: Ie805bd837d1f72cdf1818e056c0baeb0857e4e84
2013-10-31 14:09:39 -07:00
Elliott Hughes
0360e3ab2d Merge "<pthread.h> fixes and pthread cleanup." 2013-10-31 20:36:48 +00:00
Elliott Hughes
c3f114037d <pthread.h> fixes and pthread cleanup.
<pthread.h> was missing nonnull attributes, noreturn on pthread_exit,
and had incorrect cv qualifiers for several standard functions.

I've also marked the non-standard stuff (where I count glibc rather
than POSIX as "standard") so we can revisit this cruft for LP64 and
try to ensure we're compatible with glibc.

I've also broken out the pthread_cond* functions into a new file.

I've made the remaining pthread files (plus ptrace) part of the bionic code
and fixed all the warnings.

I've added a few more smoke tests for chunks of untested pthread functionality.

We no longer need the libc_static_common_src_files hack for any of the
pthread implementation because we long since stripped out the rest of
the armv5 support, and this hack was just to ensure that __get_tls in libc.a
went via the kernel if necessary.

This patch also finishes the job of breaking up the pthread.c monolith, and
adds a handful of new tests.

Change-Id: Idc0ae7f5d8aa65989598acd4c01a874fe21582c7
2013-10-31 12:31:16 -07:00
Elliott Hughes
d0d0b52da3 Merge "Remove an obsolete ARM gdb hack." 2013-10-30 21:37:56 +00:00
Elliott Hughes
b5b97f20a8 Remove an obsolete ARM gdb hack.
Experiment shows that the claim in the makefile was false: gdb works fine
setting breakpoints in these functions when compiled without special treatment.

Change-Id: Ibdf4dd5a14d171c954b8c2089daaf28e1c310be9
2013-10-30 14:32:42 -07:00
Elliott Hughes
47a73363fc Merge "Factor out some of the makefile cruft." 2013-10-30 02:13:34 +00:00
Elliott Hughes
2f287bc728 Factor out some of the makefile cruft.
I really don't want to add yet another copy for aarch64.

Also sort arm, mips, and x86.

Also silence the "TARGET_ARCH_VARIANT" warning for non-ARM; Intel and MIPS
have both complained about it.

Change-Id: I32c592a90c0cf0cdae250d84035b3e4655543781
2013-10-29 16:59:54 -07:00
Elliott Hughes
7a8e20c9c7 Merge "Explain the sigprocmask in pthread_exit." 2013-10-29 23:29:07 +00:00
Elliott Hughes
2b6e43e00e Explain the sigprocmask in pthread_exit.
Also remove the SIGSEGV special case, which was probably because
hand-written __exit_with_stack_teardown stubs used to try to cause
SIGSEGV if the exit system call returned (which it never does, so
that dead code disappeared).

Also move the sigprocmask into the only case where it's necessary ---
the one where we unmap the stack that would be used by a signal
handler.

Change-Id: Ie40d20c1ae2f5e7125131b6b492cba7a2c6d08e9
2013-10-29 16:11:06 -07:00
Christopher Ferris
f084f7dc1e Merge "Fix up failing glibc tests." 2013-10-29 22:32:33 +00:00