Commit graph

2759 commits

Author SHA1 Message Date
Elliott Hughes
33dd7c116d Merge "Add explicit -m32/-melf_i386 for x86 target" 2013-08-26 17:05:31 +00:00
Pavel Chupin
e85c183424 Add explicit -m32/-melf_i386 for x86 target
Required for x86 build with multilib compiler.

Change-Id: Iac71cdc3461df6fb48cb2a7b713324ca368e6704
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2013-08-23 16:46:42 +04:00
Robert Greenwalt
a31ddef36d Change how DNS resolver handle no default iface
We used to just try any iface we'd been told about as a
fallback, but that will end up mistakenly using a secondary
network's dns when we really don't have a default connection.

It also messed up our detection of whether we were doing the
lookup on the default or not (we'd get back our secondary net
iface as the default, do the compare and think we were on default).

Remove the lies and let dns fail if we don't have an iface for it.

bug:10132565
Change-Id: I5f0f2abacaaaaf23c5292b20fba9d8dcb6fb10c5
2013-08-22 21:05:49 -07:00
Elliott Hughes
713fe6463e Apply upstream commit 943a6621866e9d6e654f5cfe1494378c1fb8957a.
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Thu Aug 22 12:47:51 2013 -0700

    * localtime.c: Fix another integer overflow bug in mktime.

    (time2sub): Avoid undefined behavior on time_t overflow.
    Reported by Elliott Hughes in
    <http://mm.icann.org/pipermail/tz/2013-August/019580.html>.

Bug: 10310929
Change-Id: I3bf26f1f91371552e0a3828457d27e22af55acb2
2013-08-22 14:18:04 -07:00
Elliott Hughes
7843d44a59 Work around tzcode's reliance on signed overflow.
I've mailed the tz list about this, and will switch to whatever upstream
fix comes along as soon as it's available.

Bug: 10310929
Change-Id: I36bf3fcf11f5ac9b88137597bac3487a7bb81b0f
2013-08-22 12:21:18 -07:00
Jeff Hao
9b06cc3c1b Fix pthread_getcpuclockid.
clock_gettime was returning EINVAL for the values
produced by pthread_getcpuclockid.

Bug: 10346183
Change-Id: Iabe643d7d46110bb311a0367aa0fc737f653208e
2013-08-15 15:34:22 -07:00
Christopher Ferris
5f45d583b0 Create optimized __strcpy_chk/__strcat_chk.
This change pulls the memcpy code out into a new file so that the
__strcpy_chk and __strcat_chk can use it with an include.

The new versions of the two chk functions uses assembly versions
of strlen and memcpy to implement this check. This allows near
parity with the assembly versions of strcpy/strcat. It also means that
as memcpy implementations get faster, so do the chk functions.

Other included changes:
- Change all of the assembly labels to local labels. The other labels
  confuse gdb and mess up backtracing.
- Add .cfi_startproc and .cfi_endproc directives so that gdb is not
  confused when falling through from one function to another.
- Change all functions to use cfi directives since they are more powerful.
- Move the memcpy_chk fail code outside of the memcpy function definition
  so that backtraces work properly.
- Preserve lr before the calls to __fortify_chk_fail so that the backtrace
  actually works.

Testing:

- Ran the bionic unit tests. Verified all error messages in logs are set
  correctly.
- Ran libc_test, replacing strcpy with __strcpy_chk and replacing
  strcat with __strcat_chk.
- Ran the debugger on nexus10, nexus4, and old nexus7. Verified that the
  backtrace is correct for all fortify check failures. Also verify that
  when falling through from __memcpy_chk to memcpy that the backtrace is
  still correct. Also verified the same for __memset_chk and bzero.
  Verified the two different paths in the cortex-a9 memset routine that
  save variables to the stack still show the backtrace properly.

Bug: 9293744

(cherry-picked from 2be91915dc)

Change-Id: Ia407b74d3287d0b6af0139a90b6eb3bfaebf2155
2013-08-15 11:13:39 -07:00
Christopher Ferris
59a13c122e Optimize __memset_chk, __memcpy_chk. DO NOT MERGE.
This change creates assembler versions of __memcpy_chk/__memset_chk
that is implemented in the memcpy/memset assembler code. This change
avoids an extra call to memcpy/memset, instead allowing a simple fall
through to occur from the chk code into the body of the real
implementation.

Testing:

- Ran the libc_test on __memcpy_chk/__memset_chk on all nexus devices.
- Wrote a small test executable that has three calls to __memcpy_chk and
  three calls to __memset_chk. First call dest_len is length + 1. Second
  call dest_len is length. Third call dest_len is length - 1.
  Verified that the first two calls pass, and the third fails. Examined
  the logcat output on all nexus devices to verify that the fortify
  error message was sent properly.
- I benchmarked the new __memcpy_chk and __memset_chk on all systems. For
  __memcpy_chk and large copies, the savings is relatively small (about 1%).
  For small copies, the savings is large on cortex-a15/krait devices
  (between 5% to 30%).
  For cortex-a9 and small copies, the speed up is present, but relatively
  small (about 3% to 5%).
  For __memset_chk and large copies, the savings is also small (about 1%).
  However, all processors show larger speed-ups on small copies (about 30% to
  100%).

Bug: 9293744

Merge from internal master.

(cherry-picked from 7c860db074)

Change-Id: I916ad305e4001269460ca6ebd38aaa0be8ac7f52
2013-08-14 18:14:43 -07:00
Michael Wright
55bdef8677 Update kernel input headers
To upstream SHA e1c85813f3832b909d1c4309b213bb0a52c79ba5

Change-Id: I72ee3d59c105bc0252b5ca0c49c569d12ec685d1
2013-08-14 13:30:20 -07:00
Elliott Hughes
5e9b20f721 Make ctype.h a little less unhygienic.
This caused trouble for stlport.

Change-Id: Id40787c5a2b7a3a4e12fb557efe549778a01cbbd
2013-08-13 14:30:59 -07:00
Elliott Hughes
aec2ffbc5a Fix our missing abs/labs/llabs/imaxabs (and imaxdiv) symbols.
Change-Id: I94c411c22634e43184445c82e7388e51fc46a8cc
2013-08-12 12:07:05 -07:00
Elliott Hughes
d0be7c8f9a Add futimens.
Bug: 10239370
Change-Id: I518340084103dc339ef8a065d4837d6258a1381d
2013-08-08 17:13:33 -07:00
Christopher Ferris
b922ed3498 Fix strcpy.c that should have been strcpy.S. DO NOT MERGE
Merge from internal master.

(cherry-picked from 1ce6654163)

Change-Id: I376b831df42248baadde7202a30a68112f752ff7
2013-08-08 12:09:37 -07:00
Christopher Ferris
4e24dcc8d8 Optimize strcat/strcpy, small tweaks to strlen. DO NOT MERGE
Create one version of strcat/strcpy/strlen for cortex-a15/krait and another
version for cortex-a9.

Tested with the libc_test strcat/strcpy/strlen tests.
Including new tests that verify that the src for strcat/strcpy do not
overread across page boundaries.

NOTE: The handling of unaligned strcpy (same code in strcat) could probably
be optimized further such that the src is read 64 bits at a time instead of
the partial reads occurring now.

strlen improves slightly since it was recently optimized.

Performance improvements for strcpy and strcat (using an empty dest string):

cortex-a9
- Small copies vary from about 5% to 20% as the size gets above 10 bytes.
- Copies >= 1024, about a 60% improvement.
- Unaligned copies, from about 40% improvement.

cortex-a15
- Most small copies exhibit a 100% improvement, a few copies only
  improve by 20%.
- Copies >= 1024, about 150% improvement.
- Unaligned copies, about 100% improvement.

krait
- Most small copies vary widely, but on average 20% improvement, then
  the performance gets better, hitting about a 100% improvement when
  copies 64 bytes of data.
- Copies >= 1024, about 100% improvement.
- When coping MBs of data, about 50% improvement.
- Unaligned copies, about 90% improvement.

As strcat destination strings get larger in size:

cortex-a9
- about 40% improvement for small dst strings (>= 32).
- about 250% improvement for dst strings >= 1024.

cortex-a15
- about 200% improvement for small dst strings (>=32).
- about 250% improvement for dst strings >= 1024.

krait
- about 25% improvement for small dst strings (>=32).
- about 100% improvement for dst strings >=1024.

Merge from internal master.

(cherry-picked from d119b7b6f4)

Change-Id: I296463b251ef9fab004ee4dded2793feca5b547a
2013-08-08 11:13:46 -07:00
Elliott Hughes
cd927519a9 Merge "Fix stdint.h intptr_t/uintptr_t for x86_64/x32" 2013-08-05 20:55:24 +00:00
Elliott Hughes
a0473d77b2 Merge "syslog needs a valid socket path for _PATH_LOG" 2013-08-05 20:41:50 +00:00
Robert Greenwalt
1d8d9a308c Fix the detection of alt-network in dns resolver.
Used to determine proper A/AAAA record request.

bug:10132565
Change-Id: I7229f6672e879920a6fae58672cddd72db78546c
2013-08-05 18:44:30 +00:00
Alexander Ivchenko
baa91f4f89 Add ssse3 implementation of __memcmp16.
__memcmp16 was missing in x86. Also added C-version for backward
compatibility. Added bionic test for __memcmp16 and for wmemcmp.

Change-Id: I33718441e7ee343cdb021d91dbeaf9ce2d4d7eb4
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
2013-08-02 17:57:23 -07:00
Ben Cheng
772b797b7b Update the comments to reflect the current status.
Change-Id: I3a6348b568230fe8b21d121e5b8d30561a9703c2
2013-08-02 15:53:18 -07:00
Elliott Hughes
a6ed05c1c4 Merge "libgcc_compat: Introduce __aeabi_lasr for cortex-a9 and higher" 2013-08-02 22:39:08 +00:00
Pavel Chupin
0a9c615a89 Fix stdint.h intptr_t/uintptr_t for x86_64/x32
Patch is required in NDK headers as well to be able to build multilib
GCC with libgomp support.
It's here: https://android-review.googlesource.com/#/c/62982

Change-Id: I2bec25d8cbca0e5ef1a0857008ececd92f4911be
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2013-08-02 19:23:37 +04:00
Robert Greenwalt
e0805a94c5 Tell the dns resolver about our domains.
A refactor caused us to not tell the resolver about search domains
until after it had done the domain fanout.

bug:6799630
Change-Id: Ibabd8fa5bcc69b1490fc5e329e62eb0f2d1a5e63
2013-07-31 16:53:46 -07:00
Elliott Hughes
c03e1e7439 Define PTHREAD_KEYS_MAX and _POSIX_THREAD_KEYS_MAX in a POSIX-compliant way.
Also make sysconf use PTHREAD_STACK_MIN rather than redefining its
own, different, constant.

Bug: 9997352
Change-Id: I9a8e7d2b18e691439abfb45533e82c36eee9e81d
2013-07-29 17:09:36 -07:00
synergydev
efddf44c8e libgcc_compat: Introduce __aeabi_lasr for cortex-a9 and higher
This is needed when passing -mcpu=cortex-a9 or higher on a modern
toolchain for prebuilt library compatibility

Change-Id: I73eb2393377914ae26216a8c2828ad973d1c1225
2013-07-29 16:55:08 -07:00
Elliott Hughes
838f01fdc7 Bump the number of TLS slots to 128.
Bug: 9997352
Change-Id: I7bde7228d803e9d4bb83309c5891d54a07e3b025
2013-07-25 14:14:22 -07:00
Elliott Hughes
e320a8c780 Avoid sign extension of the mmap offset.
off_t is signed to support seeking backwards, but that's a liability
when using off_t to represent a subset of a file.

Change-Id: I2a3615166eb16212347eb47f1242e3bfb93c2022
2013-07-25 10:15:07 -07:00
Elliott Hughes
bfba6aac99 am a8d06766: Merge "[MIPS] __dso_handle.S and __dso_handle_so.S not needed."
* commit 'a8d06766c7674bbfde852e8bfee4200e75ad8f24':
  [MIPS] __dso_handle.S and __dso_handle_so.S not needed.
2013-07-23 18:07:12 -07:00
Elliott Hughes
a8d06766c7 Merge "[MIPS] __dso_handle.S and __dso_handle_so.S not needed." 2013-07-24 01:05:18 +00:00
Rom Lemarchand
c5749f1f42 am 061246b6: Merge "Restore dlmalloc mmap threshold to 64k"
* commit '061246b600c16a80b246804221b9e3fa65e507d9':
  Restore dlmalloc mmap threshold to 64k
2013-07-23 13:52:29 -07:00
Rom Lemarchand
d0f2a6014c Restore dlmalloc mmap threshold to 64k
Restoring DEFAULT_MMAP_THRESHOLD to 64k, the way it was before
999089181e.

This forces allocations in the 64k-256k range to be mmaped.

Change-Id: Iace55ed638edd272b3e94fa6cd2ddd349042be84
Signed-off-by: Rom Lemarchand <romlem@google.com>
2013-07-23 13:48:39 -07:00
Pete Delaney
0995a7b322 [MIPS] __dso_handle.S and __dso_handle_so.S not needed.
Global hidden variable __dso_handle is now declared in:
       bionic/libc/private/__dso_handle.h

Change-Id: I8e951a8d7c65877bafc1be23a7fff6d44d3a2846
Signed-off-by: Pete Delaney  <piet.delaney@imgtec.com>
Signed-off-by: Chao-Ying Fu  <chao-ying.fu@imgtec.com>
2013-07-22 23:16:02 -07:00
Elliott Hughes
c2902edfc4 am 6fe4a58f: Merge "Move stuff only needed by pthread-timers.c into pthread-timers.c."
* commit '6fe4a58f84954523f17114f1f7cf060a3573c073':
  Move stuff only needed by pthread-timers.c into pthread-timers.c.
2013-07-19 17:13:33 -07:00
Elliott Hughes
4cf1395217 Move stuff only needed by pthread-timers.c into pthread-timers.c.
Change-Id: I4915b3fff9c4f5a36b4f51027fb22019c11607b0
2013-07-19 16:42:27 -07:00
Elliott Hughes
178c418573 am e8bd8c2e: Merge "Upgrade mktemp.c to the current upstream version."
* commit 'e8bd8c2ed9c71c73682f29020456934c55f260e3':
  Upgrade mktemp.c to the current upstream version.
2013-07-19 16:37:52 -07:00
Elliott Hughes
284f788032 Upgrade mktemp.c to the current upstream version.
Yet another archaic relic containing bugs that had been fixed years before the
Android project even started...

Bug: 9935113
Change-Id: I3c9d019a216efd609ee568cf8c70bc360f357403
2013-07-19 15:20:31 -07:00
Elliott Hughes
81b4698059 am f8a66bb3: Merge "Remove some non-unused makefile generality."
* commit 'f8a66bb31204b42f830c1865a795b5f3eb1e0147':
  Remove some non-unused makefile generality.
2013-07-17 17:41:43 -07:00
Elliott Hughes
4c6b925bac Remove some non-unused makefile generality.
MIPS uses .c files like ARM and x86 now.

Change-Id: Ie580647e385121c380316c443ec199dabf657ff8
2013-07-17 17:38:45 -07:00
Elliott Hughes
b6b2375df8 am 8fa9081f: Merge "[MIPS] Rewrite MIPS crtbegin* as C files."
* commit '8fa9081f48c4861f83737d59bf2c2c8f21c7da3f':
  [MIPS] Rewrite MIPS crtbegin* as C files.
2013-07-17 17:36:26 -07:00
Elliott Hughes
8fa9081f48 Merge "[MIPS] Rewrite MIPS crtbegin* as C files." 2013-07-18 00:34:22 +00:00
Pete Delaney
368860124c [MIPS] Rewrite MIPS crtbegin* as C files.
This updates the MIPS arch to be much more in
sync with the commit Nick Kralevich made last
June; see 9d40326830.

    Rewrite
     crtbegin.S        -> crtbegin.c
     crtbegin_so.S     -> crtbegin_so.c
     __dso_handle.S    -> __dso_handle.c
     __dso_handle_so.S -> __dso_handle_so.c
     atexit.S          -> atexit.c

Previously __do_global_dtors_aux was in the tasks
__FINI_ARRAY__ linked with crtbegin.S and it now being
removed as there is no need to call a destructor just
before terminating a process.

Shared libraries, on the other hand, are linked with
crtbegin_so.c and have a hidden destructor declared
to allow the bionic linker to call __on_dlclose().

Change-Id: Ieb4da5199b54573de05743990e309db381a11cb8
Signed-off-by: Pete Delaney  <piet.delaney@imgtec.com>
Signed-off-by: Chao-Ying Fu  <chao-ying.fu@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
2013-07-17 14:23:29 -07:00
Elliott Hughes
cbf07a2514 am 2be511d4: Merge "Improve stack overflow diagnostics (take 2)."
* commit '2be511d405d47eccc61a6e3c338d1877bf33b4fa':
  Improve stack overflow diagnostics (take 2).
2013-07-17 13:50:15 -07:00
Elliott Hughes
84114c8dd5 Improve stack overflow diagnostics (take 2).
This reverts commits eb1b07469f and
d14dc3b87f, and fixes the bug where
we were calling mmap (which might cause errno to be set) before
__set_tls (which is required to implement errno).

Bug: 8557703
Change-Id: I2c36d00240c56e156e1bb430d8c22a73a068b70c
2013-07-17 13:33:19 -07:00
Elliott Hughes
e35d6c28df am 40e7a878: Merge "Prevent the madvise(MADV_MERGEABLE) mmap hack from affecting errno."
* commit '40e7a87864fee75f7af2caf8e1972d0d764135cd':
  Prevent the madvise(MADV_MERGEABLE) mmap hack from affecting errno.
2013-07-17 13:22:39 -07:00
Elliott Hughes
107cdd406b Prevent the madvise(MADV_MERGEABLE) mmap hack from affecting errno.
Bug: 9889616
Change-Id: I4a7323e0ae5aeb5cbe0da1b2bc7501d83b3a2aa4
2013-07-17 13:12:26 -07:00
Elliott Hughes
4763ef2b5b am b7b36b81: Merge "mmap: Reinstate passing MADV_MERGEABLE on private anonymous maps"
* commit 'b7b36b819e8029a152859f3204ba2da38a0e2879':
  mmap: Reinstate passing MADV_MERGEABLE on private anonymous maps
2013-07-17 13:05:13 -07:00
Rom Lemarchand
e459bba398 mmap: Reinstate passing MADV_MERGEABLE on private anonymous maps
Reinstate mmap calling madvise(MADV_MERGEABLE) removed in
635df850e5

(cherry-pick of c702a904679a36511bead29c51eeac15d81f4fd2.)

Change-Id: I18803fb54701b2b3d8186dff5c678211ee3efa1f
2013-07-17 13:00:45 -07:00
Guang Zhu
6f08b8659a am 2cf5a6f6: Merge "Revert "Improve stack overflow diagnostics.""
* commit '2cf5a6f6627549842c0c840ff3615ae942a90ea3':
  Revert "Improve stack overflow diagnostics."
2013-07-16 20:18:57 -07:00
Guang Zhu
849bfd5811 am 8c1b9668: Merge "Revert "Clean up our alternate signal stacks.""
* commit '8c1b96681af91fda86a5493e7f7e4381ce489648':
  Revert "Clean up our alternate signal stacks."
2013-07-16 20:18:57 -07:00
Guang Zhu
2cf5a6f662 Merge "Revert "Improve stack overflow diagnostics."" 2013-07-17 03:17:19 +00:00
Guang Zhu
d14dc3b87f Revert "Improve stack overflow diagnostics."
This reverts commit aa754dca90.

Change-Id: Ifa76eee31f7f44075eb3a48554315b2693062f44
2013-07-17 03:17:05 +00:00