Commit graph

1066 commits

Author SHA1 Message Date
David 'Digit' Turner
f1a39dce60 libc: Fix typo that broke NDK compatibility.
The function must be named __atomic_cmpxchg, not __android_cmpxchg.
This typo broke existing prebuilt binaries (they couldn't be loaded
at runtime anymore).

Change-Id: I25ca7d18329817f0056e616a0409113269ad7b1f
2011-11-23 14:38:36 +01:00
David 'Digit' Turner
de44d0b2bd Merge "libc: provide atomic operations will full barriers for NDK apps." 2011-11-22 02:10:06 -08:00
Jeff Brown
95a17848d3 Merge "Add tgkill syscall." 2011-11-21 13:13:26 -08:00
Jeff Brown
10c8ce59a4 Add tgkill syscall.
Use tgkill instead of tkill to implement pthread_kill.
This is safer in the event that the thread has already terminated
and its id has been reused by a different process.

Change-Id: Ied715e11d7eadeceead79f33db5e2b5722954ac9
2011-11-18 16:40:48 -08:00
Nick Kralevich
5f64df4bc3 ASLR: enable pthread stack location randomization
Allow the kernel to choose a memory location to put the
thread stack, rather than hard coding 0x10000000

Change-Id: Ib1f37cf0273d4977e8d274fbdab9431ec1b7cb4f
2011-11-18 10:07:12 -08:00
David 'Digit' Turner
0fec6b9d88 libc: provide atomic operations will full barriers for NDK apps.
__atomic_cmpxchg and other related atomic operations did not
provide memory barriers, which can be a problem for non-platform
code that links against them when it runs on multi-core devices.

This patch does two things to fix this:

- It modifies the existing implementation of the functions
  that are exported by the C library to always provide
  full memory barriers. We need to keep them exported by
  the C library to prevent breaking existing application
  machine code.

- It also modifies <sys/atomics.h> to only export
  always-inlined versions of the functions, to ensure that
  any application code compiled against the new header will
  not rely on the platform version of the functions.

  This ensure that said machine code will run properly on
  all multi-core devices.

This is based on the GCC built-in sync primitives.

The end result should be only slightly slower than the
previous implementation.

Note that the platform code does not use these functions
at all. A previous patch completely removed their usage in
the pthread and libstdc++ code.

+ rename arch-arm/bionic/atomics_arm.S to futex_arm.S
+ rename arch-x86/bionic/atomics_x86.S to futex_x86.S
+ remove arch-x86/include/sys/atomics.h which already
  provided inlined functions to the x86 platform.

Change-Id: I752a594475090cf37fa926bb38209c2175dda539
2011-11-16 17:37:15 +01:00
David 'Digit' Turner
b385229837 Merge "libc: speed-up flockfile()/funlockfile()" 2011-11-16 07:31:31 -08:00
David Turner
90c4c1e82b Merge "bionic: Do not use <sys/atomics.h> for platform code." 2011-11-16 07:29:59 -08:00
David 'Digit' Turner
e31bfae2ba bionic: Do not use <sys/atomics.h> for platform code.
We're going to modify the __atomic_xxx implementation to provide
full memory barriers, to avoid problems for NDK machine code that
link to these functions.

First step is to remove their usage from our platform code.
We now use inlined versions of the same functions for a slight
performance boost.

+ remove obsolete atomics_x86.c (was never compiled)

NOTE: This improvement was benchmarked on various devices.
      Comparing a pthread mutex lock + atomic increment + unlock
      we get:

  - ARMv7 emulator, running on a 2.4 GHz Xeon:
       before: 396 ns    after: 288 ns

  - x86 emulator in KVM mode on same machine:
       before: 27 ns     after: 27 ns

  - Google Nexus S, in ARMv7 mode (single-core):
       before: 82 ns     after: 76 ns

  - Motorola Xoom, in ARMv7 mode (multi-core):
       before: 121 ns    after: 120 ns

The code has also been rebuilt in ARMv5TE mode for correctness.

Change-Id: Ic1dc72b173d59b2e7af901dd70d6a72fb2f64b17
2011-11-16 16:28:10 +01:00
Eino-Ville Talvala
fd7d5acdeb am 0d9f87a3: Add auto-exposure/auto-white balance lock support to soc2030 image sensor.
* commit '0d9f87a3b71057cf804b2d7aa8589e3bf94eab28':
  Add auto-exposure/auto-white balance lock support to soc2030 image sensor.
2011-11-15 18:25:18 -08:00
David 'Digit' Turner
9831ad3ce6 libc: speed-up flockfile()/funlockfile()
For Honeycomb, we added proper file thread-safety for
all FILE* operations. However, we did implement that by
using an out-of-band hash table to map FILE* pointers
to phtread_mutex_t mutexes, because we couldn't change
the size of 'struct _sFILE' without breaking the ABI.

It turns out that our BSD-derived code already has
some support code to extend FILE* objects, so use it
instead. See libc/stdio/fileext.h

This patch gets rid of the hash table, and put the
mutex directly into the sFILE extension.

Change-Id: If1c3fe0a0a89da49c568e9a7560b7827737ff4d0
2011-11-15 13:16:42 +01:00
Nick Kralevich
4b469eae40 Merge "generate PIC code." 2011-11-14 15:12:43 -08:00
David 'Digit' Turner
9bf330b567 libc: fix the pthread_sigmask implementation
The old code didn't work because the kernel expects a 64-bit sigset_t
while the one provided by our ABI is only 32-bit. This is originally
due to the fact that the kernel headers themselves define sigset_t
as a 32-bit type when __KERNEL__ is not defined (apparently to cater
to libc5 or some similarly old C library).

We can't modify the size of sigset_t without breaking the NDK ABI,
so instead perform runtime translation during the call.

Change-Id: Ibfdc3cbceaff864af7a05ca193aa050047b4773f
2011-11-14 22:57:24 +01:00
Nick Kralevich
0aa8289c6f generate PIC code.
Change-Id: I6740c30e2782ae203aa7ddaeaf3b233e90de9c4d
2011-11-11 17:28:59 -08:00
Elliott Hughes
f3dbdbe269 Update to tzdata2011n.
There are three changes of note - most urgently, Cuba (America/Havana)
has extended summer time by two weeks, now to end on Nov 13, rather than
the (already past) Oct 30.   Second, the Pridnestrovian Moldavian Republic
(Europe/Tiraspol) decided not to split from the rest of Moldova after
all, and consequently that zone has been removed (again) and reinstated
in the "backward" file as a link to Europe/Chisinau.   And third, the
end date for Fiji's summer time this summer was moved forward from the
earlier planned Feb 26, to Jan 22.

Apart from that, Moldova (MD) returns to a single entry in zone.tab
(and the incorrect syntax that was in the 2011m version of that file
is so fixed - it would have been fixed in a different way had this
change not happened - that's the "missing" sccs version id).

Change-Id: I7a0fba88d1fc6face649648013aaf2b111c29d7f
2011-10-31 14:11:32 -07:00
Eino-Ville Talvala
0d9f87a3b7 Add auto-exposure/auto-white balance lock support to soc2030 image
sensor.

Bug: 4980604
Change-Id: I1be07a23573b70eeddd9ecb2370605713aea3d03
2011-10-31 11:42:18 -07:00
Elliott Hughes
bcb2edac65 Update to tzdata2011m.
Fixes for Europe/Tiraspol (Moldova) and all four Ukrainian zones.

Also show the MD5 of the downloaded data, for comparison against the MD5
given in the announcement mails. (There's a plan to move to proper signing,
but that's not implemented on their end yet.)

Change-Id: I845e6f125c0f54298abadc643adfeca2eff4827a
2011-10-24 10:52:14 -07:00
Nick Kralevich
d9ad62343c Add linker support for PIE
Modify the dynamic linker so that executables can be loaded
at locations other than 0x00000000.

Modify crtbegin* so that non-PIC compilant "thumb interwork
veneers" are not created by the linker.

Bug: 5323301
Change-Id: Iece0272e2b708c79034f302c20160e1fe9029588
2011-10-22 13:19:23 -07:00
Jesse Wilson
b0641d4a44 Merge "Use ENTRY and EXIT macros for strcmp, memcpy, atexit." 2011-10-12 07:51:53 -07:00
Evgeniy Stepanov
487b613e57 Use ENTRY and EXIT macros for strcmp, memcpy, atexit.
Without this change strcmp size is zero (not set), and it gets
ignored by Valgrind. Changes to memcpy and atexit don't affect the
generated binary in any way.

Change-Id: I05818cb5951f75901dc8c0eef02807a2e83a9231
2011-10-11 12:12:05 +04:00
Elliott Hughes
faa7c1d29f Update to tzdata2011l.
This affects Asia/Hebron and Pacific/Fiji (and historical data for
America/Sitka).

Change-Id: I111a34038e44416f1900f774bdb78750e815eb5f
2011-10-10 14:05:53 -07:00
Lorenzo Colitti
229ab1a33e Merge "Send both A and AAAA queries if all probes fail." 2011-09-29 10:52:23 -07:00
Lorenzo Colitti
4638822fc0 Merge "Revert "Use framework hints to determine dns query type."" 2011-09-29 10:52:16 -07:00
Lorenzo Colitti
f432de2de7 Send both A and AAAA queries if all probes fail.
AI_ADDRCONFIG is currently implemented by trying to connect
to well-known addresses in order to see if IPv4 and/or IPv6
connectivity is available.

In some cases (e.g., walled gardens with no global
connectivity) both probes can fail. If this happens,
query for both IPv4 and IPv6 addresses instead of doing
nothing and failing the query.

Bug: 5284168
Change-Id: I4e3a69ea86fb6d839a6bd31236b98da81e5cbf45
2011-09-28 22:38:08 -07:00
Lorenzo Colitti
b82532d11a Revert "Use framework hints to determine dns query type."
Change Ife82a8d8 broke IPv6 on wifi. Change I4e3a69ea is
an alternate approach that does not require any framework
changes.

Bug: 5284168
Change-Id: Ib52614be3875a2ae2eaedd1be265f90e506eda41
2011-09-28 22:37:41 -07:00
Mathias Agopian
bda5da074e fix prototype of dladdr
this breaks C++ source code in particular.

Change-Id: Ie06b5d31d23b5455e6950c470adc64dd5e7784df
2011-09-28 12:17:34 -07:00
Elliott Hughes
0096491274 Update to tzdata2011k.
Affects Palestine, Gaza, Hebron, Belarus, Ukraine, and "Russia".

Change-Id: Ib17f848c3b0e86d0bfcf289c4c4a3ae53dd2f8c4
2011-09-26 10:53:50 -07:00
Robert Greenwalt
924c8785f0 am 8af58f0f: Use framework hints to determine dns query type.
* commit '8af58f0fd4ff3fb11cb8a3c61e4654e3633906a4':
  Use framework hints to determine dns query type.
2011-09-22 23:39:54 -07:00
Robert Greenwalt
8af58f0fd4 Use framework hints to determine dns query type.
Instead of checking for IPv4 or IPv6 connectivity, try using pid-specific
hints the framework has left for us.

bug:5284168
Change-Id: Id64d48db3900865a7d58ada8309870c63d6eab12
2011-09-22 11:43:06 -07:00
JP Abgrall
771600415f am 3884bfe9: libc: popen: work around data corruption
* commit '3884bfe9661955543ce203c60f9225bbdf33f6bb':
  libc: popen: work around data corruption
2011-09-17 16:32:00 -07:00
JP Abgrall
3884bfe966 libc: popen: work around data corruption
vfork() would not save the registers that the parent would expect
to have restored after execl() completed.
Specially that execl() would call execve() underneath, further messing
up the stack of the parent.
To avoid that, we fork() for now. Later we will revisit and cleanup
vfork()+execve() to actually have vfork() store all the register
that the parent expects to see, and not those left by execve().

In the original code, looking at the registers just before the call to
popen(), and after the call showed that r7 would get clobbered.
This would leave the caller with an invalid pointer, leading to all
kinds of data corruptions.
execve() is simpler that execl() in this case.


Bug: 5336252
Change-Id: I3bf718c0bb4c0439f6f2753f153cdea14175be9c
2011-09-17 15:22:21 -07:00
Glenn Kasten
d53cae0e45 Add non-NDK internal API __pthread_gettid
Tracking bugs 5267571 and 5090073 (for deadlock detection logs).

Change-Id: Icb90f91ec1525607551c2234ef921bf88296484f
2011-09-16 12:38:28 -07:00
Erik Gilling
b8ef90d679 update linux/fb.h
Change-Id: Ib00343e3b6f95eaf3d347d4b8b9df950d0686e70
Signed-off-by: Erik Gilling <konkers@android.com>
2011-09-14 11:20:23 -07:00
Elliott Hughes
5da3ed177c Merge "Update to tzdata2011j." 2011-09-12 11:19:51 -07:00
Elliott Hughes
6ea19d7815 Update to tzdata2011j.
Affects Samoa, Kenya, Uganda, and Tanzania.

Change-Id: Ibee638d415d4f0389ff27ea1c9c481543e181f1f
2011-09-12 10:28:11 -07:00
Erik Gilling
763230ae55 update kernel video/dsscomp.h
Change-Id: Ifc4f96e3a9c3435c0b0ee80ac9da295b4e9463a1
Signed-off-by: Erik Gilling <konkers@android.com>
2011-09-07 12:53:22 -07:00
Robert Greenwalt
7f84da69f8 Add some logging of dns cache operations
Added info about what entries are getting flushed due to ttl or size limits.

Change-Id: I69fb70ce23b5b820f5f1a5738c0f1aa57b6a1127
2011-09-02 07:44:36 -07:00
Elliott Hughes
b0bbbff606 Update to tzdata2011i.
Affects South Sudan (Africa/Juba), Samoa, Europe/Kalingrad, Newfoundland,
America/Resolute, Metlakatla, America/Honolulu, America/Goose_Bay and
America/St_Johns.

Change-Id: I8e60a7c7ba5ab71eedcc66937443a9e6993accd6
2011-08-29 08:58:09 -07:00
Erik Gilling
4f3465240a Merge "update video/dsscomp.h" 2011-08-24 15:01:13 -07:00
Erik Gilling
9749753889 update video/dsscomp.h
Change-Id: If4bd1d751b30ad2e65c0bd83caba436334949463
Signed-off-by: Erik Gilling <konkers@android.com>
2011-08-24 13:33:13 -07:00
Mike Lockwood
0b33d9982e Add linux/leds-an30259a.h
Change-Id: I9144b58bdc522d6ec22466adc459a40be648592f
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-08-23 10:29:30 -04:00
David 'Digit' Turner
58246b7067 libc: Add __aeabi_f2uiz to libgcc_compat.c
This patch ensure that __aeabi_f2uiz is embedded in our C library.
This is needed to avoid breaking certain applications when they are
loaded in ICS. It is likely that the issue is due to mis-linked
binaries generated with the stand-alone toolchain (the problem
should not exist if you use ndk-build), but this fix is easier
than asking all app developers to fix their custom build system.

If you want more technical details, read the comments inside
libgcc_compat.c

Change-Id: I59ac1fc781ecb70b90b5573c5a3c67560ca8f270
2011-08-22 19:53:10 +02:00
David Turner
6dcf0d73a6 am 3dc94305: am 17a40ffb: am c57fd963: Merge "NDK: x86 header file has incorrect definition for ptrdiff_t"
* commit '3dc94305e4eb243747248b43954c499ddc96638d':
  NDK: x86 header file has incorrect definition for ptrdiff_t
2011-08-09 13:37:30 -07:00
David Turner
3afafd46f3 am 951e8381: am 3906a9c1: am f5aa1382: Merge "x86 libc: Fix the range to check the error"
* commit '951e8381916464243c7601fdb41e941811aa3773':
  x86 libc: Fix the range to check the error
2011-08-09 13:37:21 -07:00
David Turner
3dc94305e4 am 17a40ffb: am c57fd963: Merge "NDK: x86 header file has incorrect definition for ptrdiff_t"
* commit '17a40ffbf0e12ee44a024a9bb37434388478b478':
  NDK: x86 header file has incorrect definition for ptrdiff_t
2011-08-05 09:42:57 -07:00
David Turner
17a40ffbf0 am c57fd963: Merge "NDK: x86 header file has incorrect definition for ptrdiff_t"
* commit 'c57fd963817afa8894af49d6c98a80d8f9100937':
  NDK: x86 header file has incorrect definition for ptrdiff_t
2011-08-05 09:41:22 -07:00
David Turner
c57fd96381 Merge "NDK: x86 header file has incorrect definition for ptrdiff_t" 2011-08-05 09:23:29 -07:00
Mark D Horn
c3c0e88bed NDK: x86 header file has incorrect definition for ptrdiff_t
See Bug http://code.google.com/p/android/issues/detail?id=19042

Change-Id: I8e975930e7f8c3c437ecdffbc6f6bc5028937829
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2011-08-05 08:34:17 -07:00
David Turner
951e838191 am 3906a9c1: am f5aa1382: Merge "x86 libc: Fix the range to check the error"
* commit '3906a9c16b971c2689e1b8ae5455feec8cf7353c':
  x86 libc: Fix the range to check the error
2011-08-05 08:25:35 -07:00
David Turner
3906a9c16b am f5aa1382: Merge "x86 libc: Fix the range to check the error"
* commit 'f5aa1382ec7592c58827ed0822c77cb5bf8df165':
  x86 libc: Fix the range to check the error
2011-08-05 08:24:22 -07:00