Commit Graph

15974 Commits

Author SHA1 Message Date
Yabin Cui
6ac2fdd0f4 Merge "Fix pthread_test according to tsan report."
am: aec13988da

* commit 'aec13988dab7ff32cb005f42b952e3b9b55a4779':
  Fix pthread_test according to tsan report.
2015-11-30 21:42:42 +00:00
Yabin Cui
aec13988da Merge "Fix pthread_test according to tsan report." 2015-11-30 21:38:59 +00:00
Chih-hung Hsieh
4f94b7bfc0 Merge "Consider when building libc_thread_atexit_impl module"
am: 2bb85c848a

* commit '2bb85c848abb89951ec01342d6c8278311346395':
  Consider $(use_clang) when building libc_thread_atexit_impl module
2015-11-30 19:02:05 +00:00
Chih-hung Hsieh
2bb85c848a Merge "Consider $(use_clang) when building libc_thread_atexit_impl module" 2015-11-30 18:58:59 +00:00
Chih-Hung Hsieh
f688c5d5b4 Add bionic-unit-tests-gcc{32,64}, compiled with gcc.
* bionic-unit-tests{32,64} are compiled with clang/llvm.
* Skip one single test in __cxa_thread_atexit_test.cpp
  when compiled with aarch64 clang/llvm.
  Aarch64 clang/llvm generates relocation references to
  "thread_local" symbols not supported by Android linker.

BUG: 25642296
Change-Id: Ia0497b79c4b335228afeb48a26e0592217909953
2015-11-30 10:52:16 -08:00
Nikola Veljkovic
83f314f060 Consider $(use_clang) when building libc_thread_atexit_impl module
Change-Id: Ia369d94979f418198a2ee891385942d9bc5604d7
2015-11-25 18:09:34 +00:00
Yabin Cui
952e9eb086 Don't use __thread in __cxa_thread_finalize().
Currently we use __thread variable to store thread_local_dtors,
which makes tsan test fork_atexit.cc hang. The problem is as below:
The main thread creates a worker thread, the worker thread calls
pthread_exit() -> __cxa_thread_finalize() -> __emutls_get_address()
-> pthread_once(emutls_init) -> emutls_init().
Then the main thread calls fork(), the child process cals
exit() -> __cxa_thread_finalize() -> __emutls_get_address()
-> pthread_once(emutls_init).
So the child process is waiting for pthread_once(emutls_init)
to finish which will never occur.

It might be the test's fault because POSIX standard says if a
multi-threaded process calls fork(), the new process may only
execute async-signal-safe operations until exec functions are
called. And exit() is not async-signal-safe. But we can make
bionic more reliable by not using __thread in
__cxa_thread_finalize().

Bug: 25392375
Change-Id: Ife403dd7379dad8ddf1859c348c1c0adea07afb3
2015-11-24 17:24:06 -08:00
Colin Cross
a36d1e0d31 Merge "Remove cflags and ldflags from crt defaults"
am: a01108d9bf

* commit 'a01108d9bf415854b9d36334483133adff3d7405':
  Remove cflags and ldflags from crt defaults
2015-11-24 21:41:22 +00:00
Colin Cross
a01108d9bf Merge "Remove cflags and ldflags from crt defaults" 2015-11-24 21:33:54 +00:00
Colin Cross
912e27a4b2 Merge "move arch variant structs down a level"
am: 8bd27182c5

* commit '8bd27182c505cdc8031ab23fea5d1dccb6b7405a':
  move arch variant structs down a level
2015-11-24 20:24:24 +00:00
Colin Cross
8bd27182c5 Merge "move arch variant structs down a level" 2015-11-24 20:21:20 +00:00
Colin Cross
bff87d19f1 Remove cflags and ldflags from crt defaults
After ToolchainCflags were added to soong crt no longer needs to try to
recreate the bare minimum cflags for compiling for each architecture.
Also always use GCC to match crt.mk

Change-Id: I01a833ab70d989033c84f072e3660d060189688c
2015-11-24 11:11:02 -08:00
Dimitry Ivanov
321314f2e9 Merge "Introduce anonymous namespace"
am: db8caa740a

* commit 'db8caa740a409c2ce75f875df84857e6be69eb9f':
  Introduce anonymous namespace
2015-11-24 02:45:14 +00:00
Dimitry Ivanov
db8caa740a Merge "Introduce anonymous namespace" 2015-11-24 02:23:34 +00:00
Dmitriy Ivanov
1ffec1cc4d Introduce anonymous namespace
The anonymous namespace is introduced to
handle cases when linker can not find the
caller. This usually happens when caller
code was not loaded by dynamic linker;
for example mono-generated code.

Bug: http://b/25844435
Bug: http://b/22548808
Change-Id: I9e5b1d23c1c75bc78548d68e79216a6a943a33cf
2015-11-23 16:13:10 -08:00
Colin Cross
6ab8f89d1c move arch variant structs down a level
Use blueprint's new anonymous embedded struct feature to move the arch
variant properties down a level, replacing arch.cortex_a9.srcs with
arch.arm.cortex_a9.srcs, while still supporting top-level properties
like arch.arm.srcs.

Change-Id: Ib41c80e3549440d5efdfd293a15cffa3f51a0fe4
2015-11-23 14:14:57 -08:00
Yabin Cui
edcee4e401 Merge "Change _stdio_handles_locking into _caller_handles_locking."
am: 17554356cc

* commit '17554356cc865908e5cbd7814c8be7e47c9c4ec5':
  Change _stdio_handles_locking into _caller_handles_locking.
2015-11-23 19:02:08 +00:00
Yabin Cui
17554356cc Merge "Change _stdio_handles_locking into _caller_handles_locking." 2015-11-23 18:57:26 +00:00
Dimitry Ivanov
a8f8cbb3fc Merge "Handling invalid section headers"
am: a7fc7f9909

* commit 'a7fc7f9909c221a0f64c5c5ecc5fadd5fba467c5':
  Handling invalid section headers
2015-11-23 07:33:23 +00:00
Dimitry Ivanov
a7fc7f9909 Merge "Handling invalid section headers" 2015-11-23 07:28:32 +00:00
Dmitriy Ivanov
3c5248182e Handling invalid section headers
The linker crashes if native library has invalid section
headers. This change adds boundary checks on target offsets
and generates dlerror instead of crash.

Bug: http://b/25800330
Change-Id: Ibe282029997302b9b557637c3aad064d7d0febc5
2015-11-22 23:25:06 -08:00
Yabin Cui
4469973bfb Merge "Use FUTEX_WAIT_BITSET to avoid converting timeouts."
am: 74ed96d597

* commit '74ed96d59731aa3661494330804d866e825209d3':
  Use FUTEX_WAIT_BITSET to avoid converting timeouts.
2015-11-21 01:55:27 +00:00
Yabin Cui
74ed96d597 Merge "Use FUTEX_WAIT_BITSET to avoid converting timeouts." 2015-11-21 01:50:29 +00:00
Yabin Cui
76144aaa63 Change _stdio_handles_locking into _caller_handles_locking.
It is reported by tsan that funlockfile() can unlock an unlocked mutex.
It happens when printf() is called before fopen() or other stdio stuff.
As FLOCKFILE(fp) is called before __sinit(), _stdio_handles_locking is false,
and _FLOCK(fp) will not be locked. But then cantwrite(fp) in __vfprintf()
calls__sinit(), which makes _stdio_handles_locking become true, and
FUNLOCKFILE(fp) unlocks _FLOCK(fp).

Change _stdio_handles_locking into _caller_handles_locking,
so __sinit() won't change its value. Add test due to my previous fault.

Bug: 25392375
Change-Id: I483e3c3cdb28da65e62f1fd9615bf58c5403b4dd
2015-11-20 17:44:26 -08:00
Dimitry Ivanov
8bd9e9ec69 Merge "Move some utility functions to linker_utils"
am: fb3219fbd1

* commit 'fb3219fbd1dbb0a369d52cbd0200330fd8852bc1':
  Move some utility functions to linker_utils
2015-11-20 21:45:36 +00:00
Dimitry Ivanov
fb3219fbd1 Merge "Move some utility functions to linker_utils" 2015-11-20 21:42:18 +00:00
Dmitriy Ivanov
84bab5a955 Move some utility functions to linker_utils
Also adds unit-tests for page_start, page_offset, and safe_add

Change-Id: Ia1325b4682d367328a01599a19848e4ffcd2c0ea
2015-11-20 21:37:51 +00:00
Dimitry Ivanov
d34c33764e Merge "Improve error message for files with no sections"
am: a1ab0d8ed1

* commit 'a1ab0d8ed1c4025233b0d816164eefb1b84159b9':
  Improve error message for files with no sections
2015-11-20 19:19:40 +00:00
Dimitry Ivanov
a1ab0d8ed1 Merge "Improve error message for files with no sections" 2015-11-20 19:16:14 +00:00
Chih-hung Hsieh
bb06a84672 Merge "Disable clang for mips/mips64 libc."
am: 8d5fb0d787

* commit '8d5fb0d78716379d07eddbd75c88c9b7082436ef':
  Disable clang for mips/mips64 libc.
2015-11-20 18:57:17 +00:00
Dmitriy Ivanov
b76123fed8 Improve error message for files with no sections
Bug: http://b/25801618
Change-Id: I4f4f368e727ff48c84781279e3d17d4ac2d1b6b0
2015-11-20 10:49:12 -08:00
Chih-hung Hsieh
8d5fb0d787 Merge "Disable clang for mips/mips64 libc." 2015-11-20 18:27:14 +00:00
Chih-Hung Hsieh
b4bc156c6c Disable clang for mips/mips64 libc.
* Many processes, including adbd, failed to start in mips/mips64
  emulator when libc.so was compiled by clang.

BUG: 25291096
Change-Id: If3434ebdca4a3a6bf6102b120ee838a7ab66cd74
2015-11-20 09:55:35 -08:00
Elliott Hughes
cb3af215dc Merge "mmap: fix calculation of is_private_anonymous variable"
am: 43c9045017

* commit '43c90450174ab8839c05702ac01c4092f5b6cd19':
  mmap: fix calculation of is_private_anonymous variable
2015-11-20 17:34:03 +00:00
Elliott Hughes
43c9045017 Merge "mmap: fix calculation of is_private_anonymous variable" 2015-11-20 17:19:19 +00:00
Vitaly Vul
ee67dd75e2 mmap: fix calculation of is_private_anonymous variable
Currently is_private_anonymous is calculated as true if _either_
MAP_PRIVATE or MAP_ANONYMOUS is set, which is a mistake.
According to Documentation/vm/ksm.txt, "KSM only merges anonymous
(private) pages, never pagecache (file) pages". MAP_PRIVATE can
still be set on file cache pages so in order to not redundantly
set MADV_MERGEABLE on pages that are not fitted for it, both
MAP_PRIVATE and MAP_ANONYMOUS should be set.

Along with this fix, add an extra check that the mapped page is
not a stack page before setting MADV_MERGEABLE for it. Stack pages
change too quickly and always end up in KSM 'page_volatile' list.

Change-Id: If4954142852f17cc61f02985ea1cb625a7f3dec6
2015-11-20 09:16:59 -08:00
Josh Gao
8af9a739c9 Merge changes I73a39c6d,Iab2af242
am: f30170dfa5

* commit 'f30170dfa514266a0bf007091aa54a866920208c':
  Fix test build break.
  extend the PTRDIFF_MAX size check to mremap
2015-11-20 02:00:16 +00:00
Josh Gao
f30170dfa5 Merge changes I73a39c6d,Iab2af242
* changes:
  Fix test build break.
  extend the PTRDIFF_MAX size check to mremap
2015-11-20 01:55:56 +00:00
Yabin Cui
b690cae8dd Merge "Fix tsan abort for lake of __libc_auxv initialization."
am: 79f8d64632

* commit '79f8d64632a57ccd62315286b809819de09e0317':
  Fix tsan abort for lake of __libc_auxv initialization.
2015-11-20 00:48:40 +00:00
Yabin Cui
79f8d64632 Merge "Fix tsan abort for lake of __libc_auxv initialization." 2015-11-20 00:40:00 +00:00
Colin Cross
75ba57de43 Merge "Update libc/Android.bp to match libc/Android.mk"
am: 9c6157c81d

* commit '9c6157c81d123d8c6ba1aa8d7ee5c67b0840666c':
  Update libc/Android.bp to match libc/Android.mk
2015-11-19 22:58:20 +00:00
Colin Cross
9c6157c81d Merge "Update libc/Android.bp to match libc/Android.mk" 2015-11-19 22:48:33 +00:00
Yabin Cui
284068f44f Fix tsan abort for lake of __libc_auxv initialization.
If tsan is used, the following callchain can happen:
__libc_preinit() -> __libc_init_globals() ->
__libc_init_vdso() -> strcmp() -> __tsan_init()
-> sysconf(_SC_PAGE_SIZE) -> getauxval().
But __libc_auxv is initialized in __libc_init_common(),
after __libc_init_globals(). One simple way to fix
this is to initialize __libc_auxv at __libc_init_globals().

Bug: 25392375
Change-Id: I3893b1f567d5f3b7a8c881c0c1b8234b06b7751b
2015-11-19 14:24:06 -08:00
Colin Cross
a35d23d251 Update libc/Android.bp to match libc/Android.mk
Change-Id: I4dfadc55688213f095949c56306e5071b2ab6135
2015-11-19 14:18:06 -08:00
Josh Gao
2feb9dde60 Fix test build break.
Change-Id: I73a39c6d4bb9baebbfb5572e9259bcd405116039
2015-11-19 13:44:20 -08:00
Yabin Cui
c9a659c57b Use FUTEX_WAIT_BITSET to avoid converting timeouts.
Add unittests for pthread APIs with timeout parameter.

Bug: 17569991

Change-Id: I6b3b9b2feae03680654cd64c3112ce7644632c87
2015-11-19 13:42:03 -08:00
Hung-ying Tyan
ce77e47b2f Merge "Add /odm/lib to shared lib search path"
am: 0ebe2f07c3

* commit '0ebe2f07c35d4b764bc5d8b5226004e3db46da91':
  Add /odm/lib to shared lib search path
2015-11-19 16:45:08 +00:00
Hung-ying Tyan
0ebe2f07c3 Merge "Add /odm/lib to shared lib search path" 2015-11-19 16:38:51 +00:00
Daniel Micay
c22a7de798 extend the PTRDIFF_MAX size check to mremap
This removes another way to obtain objects larger than PTRDIFF_MAX. The
only known remaining hole is now jemalloc's merging of virtual memory
spans.

Technically this could be wrapped in an __LP64__ ifndef since it can't
occur on 64-bit due to the 1:1 split. It doesn't really matter either
way.

Change-Id: Iab2af242b775bc98a59421994d87aca0433215bd
2015-11-19 08:57:47 -05:00
Junichi Uekawa
1ab4088062 Merge "Do not depend on host bits to get the right size to write."
am: 313632db57

* commit '313632db574d101275206ca025d21a5a3cd62150':
  Do not depend on host bits to get the right size to write.
2015-11-19 12:51:01 +00:00