Commit Graph

15963 Commits

Author SHA1 Message Date
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
Junichi Uekawa
313632db57 Merge "Do not depend on host bits to get the right size to write." 2015-11-19 12:44:19 +00:00
Junichi Uekawa
ff35b1e659 Do not depend on host bits to get the right size to write.
x86_64 32-bit or 64-bit relocations do not depend on ELF bit size, they
are 32-bit or 64-bit respectively.

Known compiler that emits such code is nacl-clang which emits
R_X86_64_PC32 which should write 32 bits but ended up writing 64 bits.

Change-Id: Ibb6b484c0fea6a7e291362148e8ac749d6674529
2015-11-19 11:28:20 +09:00
Yabin Cui
f091c1f2f1 Merge "Implement pthread spin."
am: 2c09e5de29

* commit '2c09e5de299ca87a9e68807e2b4af41ba61710f3':
  Implement pthread spin.
2015-11-19 02:03:24 +00:00
Yabin Cui
9d4bd6f0ca Merge "Avoid tsan warning about pthread_mutex_destroy."
am: ea5bb151af

* commit 'ea5bb151af5e1e364968cb1eac70c8a2c13ca7a7':
  Avoid tsan warning about pthread_mutex_destroy.
2015-11-19 02:03:13 +00:00
Yabin Cui
2c09e5de29 Merge "Implement pthread spin." 2015-11-19 01:55:37 +00:00
Yabin Cui
ea5bb151af Merge "Avoid tsan warning about pthread_mutex_destroy." 2015-11-19 01:55:25 +00:00
Yabin Cui
fe3a83a934 Implement pthread spin.
In order to run tsan unit tests, we need to support pthread spin APIs.

Bug: 18623621
Bug: 25392375
Change-Id: Icbb4a74e72e467824b3715982a01600031868e29
2015-11-18 17:51:21 -08:00
Hung-ying Tyan
f74b041cce Add /odm/lib to shared lib search path
ODM's shared libs should live in /odm/lib on the ODM partition.

BUG: 25654402
Change-Id: I3f5c26f208af87ff2817e490e51d0b4f5b8ec98e
2015-11-18 23:45:25 +08:00
Dimitry Ivanov
3f539a1655 Merge "Ignore target sdk version for the public namespace"
am: 63f0e0db76

* commit '63f0e0db768ea9be4db3dd6a2fb62ea942afb9d6':
  Ignore target sdk version for the public namespace
2015-11-18 03:52:50 +00:00
Dimitry Ivanov
63f0e0db76 Merge "Ignore target sdk version for the public namespace" 2015-11-18 03:43:59 +00:00
Dmitriy Ivanov
3cc35e224c Ignore target sdk version for the public namespace
This fixes the bug with using the libraries loaded
prior to android_set_target_sdk_version call.

Bug: http://b/22548808
Change-Id: I3ca2d367b0fa930a437bbb65f780834803d2ef0a
2015-11-17 18:45:12 -08:00