Commit graph

934 commits

Author SHA1 Message Date
Elliott Hughes
acc06a0b74 Merge "Add a test for float registers across setjmp/logjmp." 2015-01-27 19:08:33 +00:00
Yabin Cui
4a82ede754 Rename "TIMEWARN" to "SLOW" in bionic gtest.
Bug: 19109188.
Change-Id: Idfe769ac652bf37642da24e4abb6061ca861d57e
2015-01-26 20:56:20 -08:00
Elliott Hughes
87dd503018 Add a test for float registers across setjmp/logjmp.
Change-Id: I17cc056b185755e0b91de096b5ceefee4f4e0b3a
2015-01-26 20:52:34 -08:00
Yabin Cui
0e6af17a35 Merge "Support --gtest_ouput option in bionic gtest main." 2015-01-27 01:01:05 +00:00
Yabin Cui
657b1f9bef Support --gtest_ouput option in bionic gtest main.
Bug: 19109500
Change-Id: Ib18f90ad522e66ea62dd4e02e314585d9b36e15f
2015-01-26 16:53:05 -08:00
Elliott Hughes
247cfe0382 Merge "Add <error.h>." 2015-01-26 20:38:46 +00:00
Elliott Hughes
b8a8cf0d1a Add <error.h>.
Bug: https://code.google.com/p/android/issues/detail?id=79170
Change-Id: Id91765fac45124545e2674a5b2c814707c1a448b
2015-01-26 11:57:11 -08:00
Elliott Hughes
14152b9f31 Remove obsolete BUILD_TINY_ANDROID.
Change-Id: If2fc97134340fd09ec2583b666ace2f673cbdf66
2015-01-24 19:01:58 -08:00
Elliott Hughes
e6bb5a2776 Fix optimized fread.
gcov does writes after reads on the same stream, but the bulk read optimization
was clobbering the FILE _flags, causing fwrite to fail.

Bug: 19129055
Change-Id: I9650cb7de4bb173a706b502406266ed0d2b654d7
2015-01-24 12:35:41 -08:00
Dmitriy Ivanov
31005ca4c8 Merge "Minimize calls to mprotect" 2015-01-24 00:45:25 +00:00
Dmitriy Ivanov
279a22f96e Minimize calls to mprotect
Implement refcounter based data protection guard
  to avoid unnecessary calls to mprotect when dlopen/dlclose
  is called from a constructor.

Bug: 19124318
Big: 7941716
Change-Id: Id221b84ce75443094f99756dc9950b0a1dc87222
2015-01-23 16:30:34 -08:00
Dan Albert
4ce907d2ce Allow make to set a timeout for the host tests.
Change-Id: Icc2ebf64bd1da1687bf313fe7a5640155c5795d8
2015-01-23 11:35:48 -08:00
Elliott Hughes
62284dd2cc There's no such thing as LOCAL_CXXFLAGS.
Change-Id: Iad70e6bd4cb7cec9e0ece500a540e4dadc83d92e
2015-01-22 15:36:24 -08:00
Elliott Hughes
0ed7e08cda Fix the stdio.fread_EOF test.
Another sizeof/strlen screwup caused by trying to be too clever. Use
std::string instead.

Also fix all the ASSERT_STREQ calls in this file that had the arguments
the right^Wwrong way round. If I ever see Kent Beck...

Change-Id: I47a1bdfee99cf4e7bed9b398f3158a308fbcf1e8
2015-01-22 15:28:48 -08:00
Elliott Hughes
bcb378d643 Fix fread_EOF test name.
Change-Id: I53a7f1428fd27c0b2a5c80f2e8af4845d17f5b4b
2015-01-22 14:18:35 -08:00
Elliott Hughes
8c4994bbc1 Implement __fsetlocking.
The old __isthreaded hack was never very useful on Android because all user
code runs in a VM where there are lots of threads running. But __fsetlocking
lets a caller say "I'll worry about the locking for this FILE*", which is
useful for the normal case where you don't share a FILE* between threads
so you don't need any locking.

Bug: 17154740
Bug: 18593728
Change-Id: I2a8dddc29d3edff39a3d7d793387f2253608a68d
2015-01-21 10:33:30 -08:00
Elliott Hughes
c053a42831 Merge "Optimized fread." 2015-01-21 00:11:31 +00:00
Elliott Hughes
75b99387dd Optimized fread.
This makes us competitive with glibc for fully-buffered and unbuffered reads,
except in single-threaded situations where glibc avoids locking, but since
we're never really single-threaded anyway, that isn't a priority.

Bug: 18593728
Change-Id: Ib776bfba422ccf46209581fc0dc54f3567645b8f
2015-01-20 15:59:17 -08:00
Yabin Cui
516eb53113 Remove testcase time printing in bionic-unit-tests.
Bug: 19075565
Change-Id: Icccb60657a2985e96abb1703673f0ebe2199586a
2015-01-20 14:46:03 -08:00
Yabin Cui
6104eb9fa7 Add target libbionic_gtest_main for cts test.
Bug: 17589740
Change-Id: I37f2d3fe72870b9dc867407fa1619c9a6fcd5cbb
2015-01-20 14:32:07 -08:00
Elliott Hughes
1d7b3f3ccc Merge "Improve <stdio_ext.h> testing." 2015-01-20 18:07:37 +00:00
Elliott Hughes
df8f1a42d1 Improve <stdio_ext.h> testing.
I almost fixed a non-bug. Add a test to prevent me from doing that.

Change-Id: I4a1dc13e603a7a377bdaee2e78132015087f7107
2015-01-16 16:40:55 -08:00
Yabin Cui
cfe7e75fc1 Merge "Make sys_resource test more robust." 2015-01-16 21:52:11 +00:00
Yabin Cui
4853f40f3f Make sys_resource test more robust.
"ulimit -c xxx" command may run before bionic-unit-tests.
Make sure sys_resource test fails gently in that case.

Change-Id: Ic3b5ed8b20acba56df8c5ef082c88e5050e761aa
2015-01-16 13:28:43 -08:00
Yabin Cui
19e246dda6 Fix possible leak in pthread_detach.
If pthread_detach() is called while the thread is in pthread_exit(),
it takes the risk that no one can free the pthread_internal_t.
So I add PTHREAD_ATTR_FLAG_ZOMBIE to detect this, maybe very rare, but
both glibc and netbsd libpthread have similar function.

Change-Id: Iaa15f651903b8ca07aaa7bd4de46ff14a2f93835
2015-01-15 10:45:25 -08:00
Yabin Cui
deab11acd7 Merge "Make bionic-unit-tests default run isolate mode." 2015-01-15 18:10:30 +00:00
Yabin Cui
a35cd8cdc2 Test that ip6-localhost exists in etc/hosts.
Addition change: make netdb_test pass on host.

Bug: 18791191
Change-Id: I7a9e29aa559ff6557288b47323d8a436379201a2
2015-01-13 17:30:51 -08:00
Yabin Cui
be837360c3 Make bionic-unit-tests default run isolate mode.
Fix bug of handling signal terminated tests.

Bug: 17589740
Bug: 18951146
Change-Id: I4803382b26cd5454693090202b3ba38e3dbe66e5
2015-01-08 20:34:58 -08:00
Elliott Hughes
c62a4b5a7a Fix freeaddrinfo(NULL).
Bug: https://code.google.com/p/android/issues/detail?id=13228
Change-Id: I5e3b126d90d750a93ac0b8872198e50ba047e603
2015-01-08 17:28:46 -08:00
Yabin Cui
917d390510 Make pthread stack size match real range.
Bug: 18908062
Change-Id: I7037ac8273ebe54dd19b1561c7a376819049124c
2015-01-08 14:27:24 -08:00
Dmitriy Ivanov
bfa15e464e Set linux 32bit personality for 32 bit processes
Bug: 18069809
Change-Id: Ie143d56b0f8f03510dc451649291067e1add1d2f
2015-01-07 16:32:05 -08:00
Yabin Cui
597800f1d7 Merge "better gtest runner for bionic" 2015-01-02 22:38:41 +00:00
Yabin Cui
541b0b187d Merge "Reserve enough user request stack space in pthread_create." 2015-01-02 22:37:56 +00:00
Yabin Cui
6a7aaf4675 Reserve enough user request stack space in pthread_create.
Bug: 18830897
Change-Id: I1ba4aaeaf66a7ff99c5d82ad45469011171b0a3b
2015-01-02 14:33:48 -08:00
Elliott Hughes
ba09edcb41 Merge "Fix nan output in the printf family." 2014-12-21 02:54:06 +00:00
Elliott Hughes
1b18aff9ba Fix nan output in the printf family.
Bug: https://code.google.com/p/android/issues/detail?id=82452
Change-Id: I51f226c8b033de6e81baeea5e6db3de6ed196f73
2014-12-20 18:53:08 -08:00
Yabin Cui
370a3e573d Merge "Sync with upstream for gethnamaddr.c." 2014-12-18 01:06:10 +00:00
Yabin Cui
58d33a51f3 Sync with upstream for gethnamaddr.c.
Bug: 18566967
Change-Id: I37e7410226b49eec67614e20b2c1d5e3e47817a5
2014-12-17 16:19:27 -08:00
Dmitriy Ivanov
92b9cb2c89 Merge "Add another test for weak-reference" 2014-12-16 22:01:47 +00:00
Dmitriy Ivanov
bfa88bca5c Add another test for weak-reference
This one covers undefined weak reference in .so
  referenced via JUMP_SLOT relocation.

Bug: 17526061
Change-Id: Ib8764bd30c1f686c4818ebbc6683cf42dee908b2
2014-12-16 19:46:45 +00:00
Yabin Cui
294d1e2c9e better gtest runner for bionic
1. option to run each test in a separate forked process: "--isolate".
2. warnings about slow tests: "--warnline".
3. run multiple tests at the same time: "-j N".

Bug: 17589740
Change-Id: Ife5f4cafec43aa051ad7bd9c9b2b7e2e437db0de
2014-12-13 18:53:34 -08:00
Yabin Cui
6c238f2926 Fix pthread key num calculation.
Bug: 18723085
Change-Id: Iba2c834b350e4cdba0b2d771b221560a3e5df952
2014-12-12 17:00:08 -08:00
Yabin Cui
562ae1e6e4 make stack_protector_DeathTest work for gcc4.9
Bug: 18721888
Change-Id: I5f0b5c84319f56dbc4efb88e9d828138944667ae
2014-12-11 17:24:55 -08:00
Elliott Hughes
1510a1c1ae Fix the setjmp tests for mips.
Although the LP32 mips sigset_t is large enough to represent all signals,
their jmp_buf is too small. This test succeeded on arm and x86 because the
RT signals were never in the 'expected' sigset_t, so the equality comparison
with the 'actual' sigset_t worked fine --- everyone was blind to the RT
signal. On mips the tests fail because the 'expected' sigset_t does contain
the RT signal but the 'actual' doesn't because the jmp_buf only saves and
restores the first 32 signals.

There are 32 free bits (currently used as padding) in the LP32 mips jmp_buf,
and they might choose to use those to provide better support than the other
two platforms, but I'll leave that to them. It will be easy to just remove
the #if defined(__LP64__) from this change in that case.

For mips64 it's not to late to increase the size of the jmp_buf and fix
the setjmp family, but since there are decisions to be made here for LP32,
I'll leave it all to Imagination folks...

Bug: 16918359
Change-Id: I6b723712fce0e9210dafa165d8599d950b2d3500
2014-12-10 11:48:19 -08:00
Yabin Cui
94926f8cfa Merge "support _POSIX_REALTIME_SIGNALS" 2014-12-09 20:10:19 +00:00
Yabin Cui
b033761cbf Merge "Change _POSIX_CPUTIME macro to make it compitable with glibc." 2014-12-09 17:51:37 +00:00
Yabin Cui
725756045e Change _POSIX_CPUTIME macro to make it compitable with glibc.
Change-Id: I7a8dbb74bd622693c9fef60bd779687207517b7d
2014-12-09 09:16:11 -08:00
Yabin Cui
634816055f support _POSIX_REALTIME_SIGNALS
Bug: 18489947
Change-Id: I2e834d68bc10ca5fc7ebde047b517a3074179475
2014-12-08 21:52:43 -08:00
Elliott Hughes
1c0c0ede57 Fix signal mask save/restore for x86-64.
Bug: 16918359
Change-Id: I30bf61e7d5f1c21daa3a1a21d361e98d77220bf3
2014-12-08 12:46:15 -08:00
Yabin Cui
5afae64a1b implement posix_madvise
Bug: 18472477
Change-Id: I8183de6c281acf69ed5f7f88351b056b9827b162
2014-12-04 11:01:28 -08:00
Elliott Hughes
65f0df7873 Implement <pty.h>.
Based on the package/apps/Terminal implementation. I'll switch them over
shortly. This also lets us build the toybox version of netcat.

Change-Id: Ia922a100141a67409264b43b937eeca07b21f344
2014-12-03 15:55:34 -08:00
Dmitriy Ivanov
6995c1dcb5 Merge "Extract bionic-prepare-run-on-host to inc file." 2014-12-03 00:02:13 +00:00
Dmitriy Ivanov
06b1b8ceac Extract bionic-prepare-run-on-host to inc file.
Make benchmark run-on-host depend on bionic-prepare-run-on-host.

Change-Id: I0bdbf561b2580d607a49b7c83cc273320ac55429
2014-12-02 15:15:34 -08:00
Elliott Hughes
27d276f3a6 Avoid pathological behavior in OpenBSD's fread.
(cherry picked from commit 20841a137b)

Bug: https://code.google.com/p/android/issues/detail?id=81155
Bug: 18556607
Change-Id: Ibdfebc20dce4c34ad565014523c9b074e90ea665
2014-12-02 14:54:52 -08:00
Elliott Hughes
20841a137b Avoid pathological behavior in OpenBSD's fread.
Bug: https://code.google.com/p/android/issues/detail?id=81155
Bug: 18556607
Change-Id: Idc60976b79610e2202cc42dc393dcb4ca6c42e05
2014-12-02 14:22:02 -08:00
Dmitriy Ivanov
a55126f1f6 Create /system/lib(64)? symlinks for host tests.
Replace LD_LIBRARY_PATH with default path for
  the tests run on host.

Bug: 18589961

Change-Id: Id4a84b73d25c2ca9c557fcfa19b8169daeaa016b
2014-12-02 12:11:08 -08:00
Dmitriy Ivanov
291dbf65ca Merge "Count references for groups instead of instances" 2014-12-02 19:10:04 +00:00
Dmitriy Ivanov
ab972b9adf Count references for groups instead of instances
Count references on the group level to avoid
  partially unloading function that might be
  referenced by other libraries in the local_group

  Bonus: with this change we can correctly unload recursively
  linked libraries. is_recursive check is removed.

  Also dynamic executables (not .so) with 0 DT_NEEDED libraries
  are now correctly linked.

Change-Id: Idfa83baef402840599b93a875f2881d9f020dbcd
2014-12-02 10:54:26 -08:00
Yabin Cui
e323e99ffb restore sigprocmask in setjmp/longjmp test.
Bug: 18571921
Change-Id: Ib8ca7a36abd3ccc729c20c0e32d45b1b33069f65
2014-12-02 10:35:25 -08:00
Yabin Cui
3e6ef3f902 Merge "support _POSIX_CPUTIME" 2014-12-01 17:06:02 +00:00
Yongqin Liu
9fea4090f1 bionic tests: add setjmp/_setjmp/sigsetjmp tests.
Bug: 17288973
Change-Id: I2808eee58cbddae1b16fbe19a715b72d6dbaaec3
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-26 17:31:24 -08:00
Yabin Cui
d5c652756b support _POSIX_CPUTIME
Bug: 18490039
Change-Id: I01fa83b48e1b908de1f227b6e4f98e280bcd50ee
2014-11-26 17:14:50 -08:00
Yabin Cui
eb3a5e026e Merge "flesh out sysconf(3) and the _POSIX_* constants" 2014-11-24 01:59:23 +00:00
Yabin Cui
1c19194c9d flesh out sysconf(3) and the _POSIX_* constants
Bug: 17571891
Change-Id: I81036615486bde65969ae5662587fcc88348474e
2014-11-21 19:10:52 -08:00
Dmitriy Ivanov
0864d8bc47 Rename test_forked -> test_isolated
Change-Id: Ie72627e986c159832cbd3635d8ff5b1af3d5b1eb
2014-11-20 22:53:59 -08:00
Dmitriy Ivanov
8b4b827338 Merge "Add test_forked() option" 2014-11-21 01:21:16 +00:00
Dmitriy Ivanov
00e37818a7 Add test_forked() option
Executing test via test_forked() allows us to
 avoid undesired global state changes in tests like
 atexit, dlopen(.., RTLD_NODELETE) and similar.

Change-Id: I118cdf009269ab5dd7b117c9b61dafa47de2a011
2014-11-20 17:11:06 -08:00
Elliott Hughes
770198d3f7 Merge "Make the ftw(3) tests a bit more thorough." 2014-11-20 00:09:32 +00:00
Elliott Hughes
63bd43bbdc Make the ftw(3) tests a bit more thorough.
These also test much of fts(3).

Change-Id: Ia9245d6acbbd071191563ab1b91a400044104028
2014-11-19 15:47:53 -08:00
Dmitriy Ivanov
6b48b20a1e Merge "Yet another relocation test" 2014-11-19 19:35:59 +00:00
Dmitriy Ivanov
7699d13a74 Yet another relocation test
This time we check if a -> b -> c function in 'a' relocates against
 implementation in 'c'.

Change-Id: I528180c3efd346bd447ea0237e5a8a0ac3cc031f
2014-11-19 10:39:05 -08:00
Yabin Cui
649f78df79 Merge "fix shared gid support in getpwnam/getgrnam" 2014-11-19 04:25:24 +00:00
Yabin Cui
a04c79b9d3 fix shared gid support in getpwnam/getgrnam
Bug: 18374693
Change-Id: I5353403cbbead6f6abac87bee2cf53a60dba408c
2014-11-18 19:58:04 -08:00
Dmitriy Ivanov
a2547055f2 Fix jump to unmapped memory on atexit
Split d-tor calls and soinfo_free to 2 separate steps

Bug: 18338888
Change-Id: Idbcb7242ade16fa18cba7fe30505ebd8d6023622
2014-11-18 13:16:27 -08:00
Elliott Hughes
8eda0a6d69 Merge "libc: Fix mktime returns an uncorrect time in empty TZ case" 2014-11-17 23:14:58 +00:00
Dmitriy Ivanov
ee4c8febb7 Merge "bionic/test: migrate sysconf tests from system/extras to bionic/tests" 2014-11-17 18:43:32 +00:00
Elliott Hughes
f2c882095b Merge "Add getaddrinfo(3) tests for NULL arguments." 2014-11-17 18:26:46 +00:00
Elliott Hughes
32fea147ea Add getaddrinfo(3) tests for NULL arguments.
According to https://github.com/ukanth/afwall/pull/213 some OEMs have
shipped a getaddrinfo(3) that crashes given NULL hostnames.

Change-Id: I9cea5fdd68546b7c64cf47e10e2b2b4d672b69d0
2014-11-16 12:14:04 -08:00
Dan Albert
eef1eb64bb Merge "Allow asan for glibc tests." 2014-11-15 06:47:08 +00:00
Dan Albert
01f1ff2440 Allow asan for glibc tests.
SANITIZE_HOST will break if we don't allow ASAN.

Change-Id: I0beed82b058db391f633e0ea1098f140497c65d4
2014-11-14 20:00:06 -08:00
Satoru Takeuchi
154e2026c8 libc: Fix mktime returns an uncorrect time in empty TZ case
The mktime API returned an uncorrect time when TZ is set as empty.
A timezone UTC/GMT+0 should be implied in the empty case. However
mktime keeps previous information about timezone. If mktime was called
with a timezone which has DST before, the "defaulttype" member of
"state" structure wouldn't be 0. Then it would be used next time,
even though UTC/GMT+0 doesn't have DST.

Added initialization of the "defaulttype" in the empty TZ case.

Change-Id: Ic480c63c548c05444134e0aefb30a7b380e3f40b
2014-11-14 18:13:07 -08:00
Derek Xue
bc6447673f bionic/test: migrate sysconf tests from system/extras to bionic/tests
The old test are implemented in file:
  system/extras/tests/bionic/libc/other/test_sysconf.c
This change is to migrate them to bionic/tests with the gtest format.

and since the sysconf is defined in unistd.h, will put the test under
bionic/tests/unistd_test.cpp file as unistd.syscon test

Change-Id: Ie519147c1c86a6c4cefa8c88b18bf58bdfbffbdb
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-15 09:48:36 +08:00
Yabin Cui
9d93986481 Add functions in sysinfo.h.
Bug: 17703902

Change-Id: I699d12d76a8fc483c919be730c2ac63641b71a1d
2014-11-14 16:22:48 -08:00
Yabin Cui
661423a453 Merge "Increase support of pathconf options." 2014-11-14 23:45:45 +00:00
Yabin Cui
b5e581abfe Increase support of pathconf options.
Bug: 18206366
Change-Id: Ie770e49f5af3631eb9fbd2cd5174edf004c81e00
2014-11-14 23:45:24 +00:00
Dmitriy Ivanov
9df4b13baf Fix host build for arm/arm64
Change-Id: Id92543e4080aede205b3e63099fa2baa36ba21f0
2014-11-14 12:17:06 -08:00
Dmitriy Ivanov
b3356773c6 Add test for --hash-style=sysv
With build system switched to gnu-hash we need
 a test for sysv-hashed library.

Change-Id: I34adc216fa79199aa46066cf13fcc1c1f2581f0e
2014-11-14 11:19:22 -08:00
Christopher Ferris
59b1dea882 Merge "Add missing function prototypes wcpcpy/wcpncpy." 2014-11-14 03:23:35 +00:00
Christopher Ferris
5c7d9584d9 Add missing function prototypes wcpcpy/wcpncpy.
Also add smoke tests for a few of the wchar functions.

Change-Id: Id1be522f55a6708564d444941f42097548f16497
2014-11-13 18:56:12 -08:00
Elliott Hughes
e3c4acf1e3 Fix our <mntent.h> implementation.
Used by toybox.

Change-Id: I36a5053423e5cc54ae02a68f4fe110d75134accd
2014-11-13 15:51:36 -08:00
Elliott Hughes
68d98d832b Assume glibc >= 2.15.
This catches one trivial difference between us and glibc --- the error
returned by pthread_setname_np for an invalid pthread_t.

Change-Id: If4c21e22107c6488333d11184f8005f8669096c2
2014-11-12 21:03:26 -08:00
Elliott Hughes
92a585c91a Merge "Fix glibc 2.15 build." 2014-11-13 03:37:47 +00:00
Elliott Hughes
fb50057138 Fix glibc 2.15 build.
glibc 2.15 has prlimit64, has an unsetenv that's declared nonnull,
and hasn't fixed the problems we were having trying to use the
POSIX strerror_r in C++ code.

Change-Id: I834356a385e5ae55500bd86781691b6c1c9c8300
2014-11-12 19:31:21 -08:00
Dmitriy Ivanov
ec18ce06f2 Add support for hash-style=gnu
Change-Id: I171434a587420895feac8a9b1ad2342087197568
2014-11-12 16:38:12 -08:00
Yabin Cui
e5cabca516 Merge "implement missing seekdir and telldir" 2014-11-12 20:36:26 +00:00
Elliott Hughes
bbdfa51883 Merge "gethostname.c: change to report ENAMETOOLONG error when buflen is less" 2014-11-12 20:09:59 +00:00
Elliott Hughes
83204d5708 Merge "bionic tests: migrate gethostname test to unistd_test.cpp from system/extras" 2014-11-12 20:08:57 +00:00
Yongqin Liu
2f954bab2d gethostname.c: change to report ENAMETOOLONG error when buflen is less
change to behaviour the same as glibc for the check about buflen

Change-Id: I98265a8fe441df6fed2527686f89b087364ca53d
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-12 12:07:33 -08:00
Derek Xue
d94e7f0f1d bionic tests: migrate gethostname test to unistd_test.cpp from system/extras
The old tests are implemented in file
    system/extras/tests/bionic/libc/common/test_gethostname.c
Here migrate the test to the tests/unistd_test.cpp file and
add some more checks

Change-Id: Iab1e3da873bb333d1ddefc03108d536933792db2
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-11-12 10:47:39 -08:00
Christopher Ferris
1468765f8a Add align/overread tests for strlcpy/strlcat.
Change-Id: I2801c7ee1847cd68ec95eba5bdffde5e52edf1e5
2014-11-10 13:58:17 -08:00
Elliott Hughes
b86a4c7f65 Add sethostname(2).
Not very useful, but helps building stuff like toybox out of the box.

Change-Id: I110e39030452bd093a84278e019c5752d293718d
2014-11-07 16:48:27 -08:00
Yabin Cui
5ca4a9e2da implement missing seekdir and telldir
Bug: 18266863
Change-Id: I189ee949d4f7ccee099f3341e349cd969d25480f
2014-11-07 10:20:32 -08:00
Elliott Hughes
b20c24456e Implement all the POSIX _l functions.
Strictly speaking, this only implements the _l variants of the functions
we actually have. We're still missing nl_langinfo_l, for example, but we
don't have nl_langinfo either.

Change-Id: Ie711c7b04e7b9100932a13f5a5d5b28847eb4c12
2014-11-06 15:52:22 -08:00
Elliott Hughes
274afe8f0e Add POSIX lcong48.
Change-Id: I821046816661d77275cb02c8c99d526bb41afb9c
2014-11-06 14:14:37 -08:00
Elliott Hughes
39ba30354a Merge "Fix our <complex.h> support." 2014-11-06 19:43:17 +00:00
Elliott Hughes
b8ee16f1dc Fix our <complex.h> support.
We build libm with -fvisibility=hidden, so we weren't exporting any
of the <complex.h> functions.

We also weren't building many of the functions anyway.

We were also missing the complex inverse trigonometric functions.

And because we didn't even have perfunctory "call each function once"
tests, we didn't notice that we weren't exporting any symbols, so this
patch adds at least that level of testing.

Change-Id: Ibcf2843f507126c51d134cc5fc8d67747e033a0d
2014-11-06 11:16:55 -08:00
Yabin Cui
9df70403d9 make all bionic death tests not dumpable
Bug: 18067305

Change-Id: Ia1ecacf47eddecc9bc58aaac779e0c218f463179
2014-11-06 11:09:03 -08:00
Yabin Cui
2311383180 Merge "check invalid file offset when loading library" 2014-11-05 19:56:01 +00:00
Elliott Hughes
c13a2044e3 Merge "Fix newlocale with a NULL locale name." 2014-11-05 02:20:55 +00:00
Elliott Hughes
7e0d0f8572 Fix newlocale with a NULL locale name.
Bug: https://code.google.com/p/android/issues/detail?id=78567
Change-Id: I272dabc12ab186b44a525c7e8ac1846e62334e85
2014-11-04 18:03:44 -08:00
Elliott Hughes
1b37ba2178 Improve math tests to allow a specific ulp bound.
At the moment our libm is only good enough for a 1 ulp bound on these tests,
but that's better than the 4 ulp bound you get from gtest by default.

I'm not really happy with the multiple structures and corresponding functions,
but at least they mean there's no duplication in the tests themselves, and it
should be easy enough for us to make further improvements in future.

Change-Id: I004e12970332e1d9531721361d6c34f908cfcecc
2014-11-04 18:00:02 -08:00
Yabin Cui
16f7f8d250 check invalid file offset when loading library
Bug: 18178121
Bug: 18078224

Change-Id: I5254433d54645db68e9b83d5095dc2bf9d8531bc
2014-11-04 14:37:15 -08:00
Dmitriy Ivanov
9d3382d97a Revert "Fix dlsym() to take into account RTLD_GLOBAL/LOCAL"
This reverts commit c85e82dde5.

Bug: 18222321
Bug: 18211780
Change-Id: I32f4048bd5ea85dc8a3dfccce8cf141b241ab692
2014-11-03 22:15:29 -08:00
Dmitriy Ivanov
69c5d108a5 Revert "Add RTLD_NODELETE flag support"
This reverts commit c87f65d2cd.

Bug: 18222321
Bug: 18211780
Change-Id: I00252e26a28a41ab9f1e2dd3b32f0f80d86297f1
2014-11-03 22:15:26 -08:00
Dmitriy Ivanov
00dce52553 Revert "Fix relocation to look for symbols in local group"
This reverts commit fd2747bb58.

Bug: 18222321
Bug: 18211780
Change-Id: I2d4ebab1e73b7277161af76b99f8249825b22d65
2014-11-03 22:15:20 -08:00
Dmitriy Ivanov
f947be2889 Revert "Fix symbol lookup order during relocation"
This reverts commit 976402cca1.

Bug: 18222321
Bug: 18211780
Change-Id: Iafdd3d843db7b1cf288be9a0232022816622c944
2014-11-03 22:15:08 -08:00
Dmitriy Ivanov
494bee796a Revert "Fix arm64 and arm builds."
This reverts commit 445111a1c9.

Bug: 18222321
Bug: 18211780
Change-Id: I4fa9e1b63ec9b528f8bfed73c2ec15046c43a2fe
2014-11-03 22:14:19 -08:00
Elliott Hughes
d18f4b2578 Ensure we initialize stdin/stdout/stderr's recursive mutexes.
(cherry-pick of 6a03abcfd23f31d1df06eb0059830e22621282bb.)

Bug: 18208568
Change-Id: I9da16ce0f9375bc363d1d02be706d73fd3b1e150
2014-11-03 13:46:41 -08:00
Dan Albert
695781b6f0 Merge "Make host tests depend on /system/etc/hosts." 2014-11-03 21:38:50 +00:00
Dan Albert
62b7279789 Make host tests depend on /system/etc/hosts.
Change-Id: I3e5ab1325d5e250a1d14b53f3a5a465d9f5de30c
2014-11-03 13:26:16 -08:00
Elliott Hughes
6a03abcfd2 Ensure we initialize stdin/stdout/stderr's recursive mutexes.
Bug: 18208568
Change-Id: I9da16ce0f9375bc363d1d02be706d73fd3b1e150
2014-11-03 12:32:17 -08:00
Dmitriy Ivanov
445111a1c9 Fix arm64 and arm builds.
Bug: 18186310

(cherry picked from commit 4e446b19d8)

Change-Id: Ibc77a9ade36dc6b9bf5a316b5ab9ae5f0a70e826
2014-10-31 19:29:04 -07:00
Dmitriy Ivanov
4e446b19d8 Fix arm64 and arm builds.
Change-Id: I2c8c41626768e792f27a2616f2cd5ae66606319d
2014-10-31 17:27:02 -07:00
Dmitriy Ivanov
976402cca1 Fix symbol lookup order during relocation
Relocate symbol against DF_1_GLOBAL shared libraries
  loaded before this shared library. This includes
  main executable, ld_preloads and other libraries
  that have DF_1_GLOBAL flag set.

Bug: 2643900
Bug: 15432753
Bug: 18186310

(cherry picked from commit d225a5e652)

Change-Id: I4e889cdf2dfbf8230b0790053d311ee6b0d0ee2d
2014-10-31 17:10:30 -07:00
Dmitriy Ivanov
fd2747bb58 Fix relocation to look for symbols in local group
The local group is a sequence of libraries in default (breadth-first)
  order. It allows RTLD_LOCALLY loaded library to correctly relocate
  symbols within its group (see test-cases).

  Local group lookup is performed after main executable and ld_preloads.

Bug: 2643900
Bug: 15432753
Bug: 18186310

(cherry picked from commit cfa97f172d)

Change-Id: I5fa8c673f929e4652c738912c7ae078d7ec286d2
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
4d0c1f673f Correct way to specify additional dependencies
Previous one was not covering all the targets

Bug: 17548097
Bug: 18186310

(cherry picked from commit 4a9e1937c5)

Change-Id: I2cd9e58893555d16cbfe291b2d1279621489d5ad
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
382e06ce8e Add dlfcn_test to glibc test suite.
Bug: 18186310

(cherry picked from commit eb27bbae8f)

Change-Id: I1d608dfa12dbafbdcdb8bc6d818c5872404c19e0
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
c87f65d2cd Add RTLD_NODELETE flag support
Bug: 18186310
Bug: https://code.google.com/p/android/issues/detail?id=64069

(cherry picked from commit 1b20dafdbe)

Change-Id: Ic02eec22a7c322ece65eb40730a3404f611526b1
2014-10-31 17:04:00 -07:00
Dmitriy Ivanov
c85e82dde5 Fix dlsym() to take into account RTLD_GLOBAL/LOCAL
Symbols from libraries opened with RTLD_LOCAL (default)
  should not be visible via dlsym(RLTD_DEFAULT/RTLD_NEXT, .)

Bug: 17512583
Bug: 18186310

(cherry picked from commit e8ba50fe0d)

Change-Id: Idf6bbe2233fb2bfc0c88677e7d1fc518fb3f7a8b
2014-10-31 17:02:13 -07:00
Dmitriy Ivanov
d225a5e652 Fix symbol lookup order during relocation
Relocate symbol against DF_1_GLOBAL shared libraries
  loaded before this shared library. This includes
  main executable, ld_preloads and other libraries
  that have DF_1_GLOBAL flag set.

Bug: 2643900
Bug: 15432753
Change-Id: Ia788748be59b739d1c7e62b978e7e255f9e65c7b
2014-10-31 11:39:51 -07:00
Elliott Hughes
89aaaffbf8 Extra strtod/strtof tests.
Check that libc doesn't suffer from a couple of bugs that affected
Java in the past.

Bug: 2206701
Change-Id: I9eb64d7ff2fa0b79e93079b897a5fb78bef866be
2014-10-28 17:54:23 -07:00
Elliott Hughes
22e2c9d963 Fix mips signed/unsigned signal_test.cpp build breakage.
(cherry picked from commit aa13e839f0)

Bug: 17436734
Change-Id: I167fc5d74c49cca7031c5739bc53fdf3bde71887
2014-10-28 14:02:10 -07:00
Elliott Hughes
28ea229bb2 Don't mask out SA_RESTORER from sa_flags.
glibc doesn't do this, and we probably shouldn't either.

Bug: 16703540
Bug: 17436734

(cherry picked from commit afe58ad989)

Change-Id: Iada5d0ae814f438cb276f056b2b5e3675f0e3666
2014-10-28 07:55:53 -07:00
Pavel Chupin
8eb8c39299 [x86,x86_64] Fix libgcc unwinding through signal
This change provides __restore/__restore_rt on x86 and __restore_rt on
x86_64 with unwinding information to be able to unwind through signal
frame via libgcc provided unwinding interface. See comments inlined for
more details.

Also remove the test that had a dependency on
__attribute__((cleanup(foo_cleanup))). It doesn't provide us with any
better test coverage than we have from the newer tests, and it doesn't
work well across a variety architectures (presumably because no one uses
this attribute in the real world).

Tested this on host via bionic-unit-tests-run-on-host on both x86 and
x86-64.

Bug: 17436734
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>

(cherry picked from commit 50321e2e66)

Change-Id: Iba90e36958b00c7cc7db5eeebf888dc89ce4d619
2014-10-27 16:42:49 -07:00
Elliott Hughes
190dce9e56 Stack unwinding unit tests.
Bug: 17436734

(cherry picked from commit bee1993a14)

Change-Id: I7205a862ba2c3b474e287f5e9c8982cef4610af9
2014-10-27 16:42:37 -07:00
Pavel Chupin
50321e2e66 [x86,x86_64] Fix libgcc unwinding through signal
This change provides __restore/__restore_rt on x86 and __restore_rt on
x86_64 with unwinding information to be able to unwind through signal
frame via libgcc provided unwinding interface. See comments inlined for
more details.

Also remove the test that had a dependency on
__attribute__((cleanup(foo_cleanup))). It doesn't provide us with any
better test coverage than we have from the newer tests, and it doesn't
work well across a variety architectures (presumably because no one uses
this attribute in the real world).

Tested this on host via bionic-unit-tests-run-on-host on both x86 and
x86-64.

Bug: 17436734
Change-Id: I2f06814e82c8faa732cb4f5648868dc0fd2e5fe4
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-10-27 16:14:55 -07:00
Elliott Hughes
ed29e858d0 pthread_setname_np appears in glibc 2.12.
And our emulator kernels are now new enough to not require a workaround.

Change-Id: Id56c983dbfd8abc69f72a78411a5502391941dfc
2014-10-27 12:01:51 -07:00
Dmitriy Ivanov
095636e6ad Fix *tests-run-on-host target
Change-Id: Id0e5060977a2df91c47b5a916989eb7e2e3f8153
2014-10-25 21:41:32 -07:00
Derek Xue
4199695657 bionic tests: migrate test for mutex type from system/extras
Migrate the test about pthread mutex type in file
    system/extras/tests/bionic/libc/bionic/test_mutex.c
to the new place
    bionic/tests/pthread_test.cpp
in the gtest format.

Change-Id: I6aab10170ccad5b9a4892d52dba2403876c86659
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-10-24 18:54:42 -07:00
Chih-Hung Hsieh
57c5a5562b Merge "Disable clang compilation due to lack of ifunc." 2014-10-24 18:34:40 +00:00
Chih-Hung Hsieh
b086298629 Disable clang compilation due to lack of ifunc.
BUG: 18055309
Change-Id: I0f36011cf7872a20ddd36a6c3c607eb96f0a8ec2
2014-10-24 11:04:51 -07:00
Elliott Hughes
1e8ebdc375 Make the netdb unit tests work on the host.
Bug: 18111005
Change-Id: I79c6929c3827716e19b44d7469db69740f4b449c
2014-10-24 10:45:08 -07:00
Elliott Hughes
a4c0b75671 Merge "Add mkfifoat(3)." 2014-10-24 02:57:12 +00:00
Elliott Hughes
ca8e84c6ff Add mkfifoat(3).
Looks like I missed one of the *at functions when I added the rest.

Change-Id: If16de82dbf6f9a3ea7bfdcba406ca1c74a3f2279
2014-10-23 19:10:54 -07:00
Dmitriy Ivanov
566f2bc623 Merge "Fix relocation to look for symbols in local group" 2014-10-23 20:49:00 +00:00
Dmitriy Ivanov
cfa97f172d Fix relocation to look for symbols in local group
The local group is a sequence of libraries in default (breadth-first)
  order. It allows RTLD_LOCALLY loaded library to correctly relocate
  symbols within its group (see test-cases).

  Local group lookup is performed after main executable and ld_preloads.

Bug: 2643900
Bug: 15432753
Change-Id: I9bb013b46d17dbb5cbdfb8fef26f552748385541
2014-10-23 12:13:54 -07:00
Derek Xue
ba811120ae Migrate system/extra getaddrinfo test, and fix a bug in getservbyname(3).
This change is to migrate the getaddrinfo tests defined in the old file
system/extras/tests/bionic/libc/common/test_getaddrinfo.c
to the new place bionic/tests/netdb_test.cpp.

The test here is more thorough, and catches a bug in getservbyname(3)
that was breaking getaddrinfo(3)'s ability to look up services by name
without a hint that would cause it to ask for a specific protocol.

Change-Id: Ief5ebd0869496d1bc6a97861dfefa04bdf24bab1
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-10-22 22:23:10 -07:00
Derek Xue
4912fc7d15 bionic/tests: migrate gethostbyname bionic test from system/extra to bionic/tests
this change migrate the gethostbyname test defined in the old file
system/extras/tests/bionic/libc/common/test_gethostbyname.c
to the new place bionic/tests/netdb_test.cpp

Change-Id: I342171090f681581fb54d68ea4a09adf61f52081
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-10-22 14:30:01 -07:00
Christopher Ferris
62d84b1935 Fix race condition in timer disarm/delete.
When setting a repeat timer using the SIGEV_THREAD mechanism, it's possible
that the callback can be called after the timer is disarmed or deleted.
This happens because the kernel can generate signals that the timer thread
will continue to handle even after the timer is supposed to be off.

Add two new tests to verify that disarming/deleting doesn't continue to
call the callback.

Modify the repeat test to finish more quickly than before.

Refactor the Counter implementation a bit.

Bug: 18039727

(cherry pick from commit 0724132c32)

Change-Id: I135726ea4038a47920a6c511708813b1a9996c42
2014-10-22 13:20:39 -07:00
Christopher Ferris
9b7b0d82eb Merge "Fix race condition in timer disarm/delete." into lmp-mr1-dev 2014-10-22 19:43:44 +00:00
Dmitriy Ivanov
702ab5b37e Rename library_offset to library_fd_offset
replace lseek() and use pread() instead
 add test for library_fd_offset > file_size case

Bug: 17762003

(cherry picked from commit a6c1279098)

Change-Id: Ie117c745081ee33d07db5341115ff6c8e98b0dec
2014-10-22 16:35:04 +00:00
Ying Wang
3c5c720b0b Build dlext_testzip as custom module.
Use $(BUILD_SYSTEM)/base_rules to build it as custom module, so that
it's exposed to utilities like mm/mmma etc.

Bug: 17887283
Bug: 17762003

(cherry picked from commit 667853d477)

Change-Id: I405797d16f20dc09e5d84b93b6727b634db2fc2c
2014-10-22 08:30:43 +00:00
Christopher Ferris
0724132c32 Fix race condition in timer disarm/delete.
When setting a repeat timer using the SIGEV_THREAD mechanism, it's possible
that the callback can be called after the timer is disarmed or deleted.
This happens because the kernel can generate signals that the timer thread
will continue to handle even after the timer is supposed to be off.

Add two new tests to verify that disarming/deleting doesn't continue to
call the callback.

Modify the repeat test to finish more quickly than before.

Refactor the Counter implementation a bit.

Bug: 18039727
Change-Id: I73192c915cdacf608521b1792c54e5af14a34907
2014-10-21 18:31:02 -07:00
Dmitriy Ivanov
54d76360eb Merge "Rename library_offset to library_fd_offset" 2014-10-21 21:06:18 +00:00
Dmitriy Ivanov
de01780f46 Add file_offset parameter to android_extinfo
Bug: 17762003

(cherry picked from commit 07e5bc152d)

Change-Id: I72d527831384ff5dde013a4c8dfe639fbec165f5
2014-10-21 13:52:49 -07:00
Dmitriy Ivanov
a6c1279098 Rename library_offset to library_fd_offset
replace lseek() and use pread() instead
 add test for library_fd_offset > file_size case

Bug: 17762003
Change-Id: I4555f0be635124efe849c1f226985bcba72ffcbd
2014-10-21 13:51:08 -07:00
Dan Albert
5ba672ebcb Never use ASAN.
Unless we completely redo how we build bionic (so that the object
files for libc.so get built separately from libc.a), we can't enable
ASAN here, as libc.a gets linked into static executables.

Change-Id: I2ce4f51248bd51c4213a555ff481b6faabbf53f8
2014-10-21 11:22:26 -07:00
Dmitriy Ivanov
4a9e1937c5 Correct way to specify additional dependencies
Previous one was not covering all the targets

Bug: 17548097
Change-Id: I425e0f8d6e5a43feabd29dcb327049b82754d249
2014-10-17 11:47:18 -07:00
Haruki Hasegawa
1816025684 Add clock_settime and clock_nanosleep.
Add the missing prototypes, fix the existing prototypes to use clockid_t
rather than int, fix clock_nanosleep's failure behavior, and add simple
tests.

Bug: 17644443
Bug: https://code.google.com/p/android/issues/detail?id=77372
Change-Id: I03fba369939403918abcabae9551a7123953d780
Signed-off-by: Haruki Hasegawa <h6a.h4i.0@gmail.com>
2014-10-13 17:04:10 -07:00
Ying Wang
667853d477 Build dlext_testzip as custom module.
Use $(BUILD_SYSTEM)/base_rules to build it as custom module, so that
it's exposed to utilities like mm/mmma etc.

Bug: 17887283
Change-Id: Idd7b62d08e4d56331a3ff15da6aa46eae8c41898
2014-10-08 16:38:58 -07:00
Dmitriy Ivanov
ac3c94d031 Merge "Fix mma build: 'cd bionic && mma' case" 2014-10-08 22:39:21 +00:00
Dmitriy Ivanov
51166d3aa2 Fix mma build: 'cd bionic && mma' case
Bug: 17887283
Change-Id: If2015f2361348eac8c53aed3f8715077b79ce2f5
2014-10-08 15:36:56 -07:00
Elliott Hughes
3ea4d56ed4 Use ln(1) rather than cp(1) to set up host /system for testing.
The trouble with cp is that if you're running a command directly (because
you're using gdb, say), you need to make sure you've copied the linker
and shell again if you've done a rebuild that caused a change there.

Change-Id: I312da30c0f92b515967e854e0faba272c961ecc7
2014-10-08 14:56:27 -07:00
Elliott Hughes
b4b15c63a1 Fix compile-time tests for LP64.
Change-Id: Ib9bec5c6c77c55679d64c2bc15ab70979c40e66c
2014-10-08 13:21:29 -07:00
Dan Albert
2fbb1b653e Add basic compile time tests for sn?printf.
Bug: 17782583
Change-Id: I6443537c643d1cc6b4a8f2dab5c364f2fbc1faa3
2014-10-08 13:02:53 -07:00
Nick Kralevich
ce92b41a00 cdefs.h: add artificial attribute to FORTIFY_SOURCE functions
Otherwise the gcc compiler warning doesn't show up.

Add -Wno-error to fortify related tests. Fortify related tests
are expected to be examples of bad programs, and in many
cases shouldn't compile cleanly. Rewriting them to compile
cleanly isn't feasible nor desirable.

Bug: 17784968

(cherry picked from commit 1aaa17802c)

Change-Id: Ib6df1a3f44b55b1fff222e78395c10c51cd39817
2014-10-07 16:37:04 -07:00
Dmitriy Ivanov
75d66dd9a7 Fix 2nd arch prefix application
Bug: 17887283
Change-Id: I7b3b2332212fe416d6b5f5c2e5c1e07605ba09aa
2014-10-07 09:46:46 -07:00
Nick Kralevich
b5cba6081b Merge "cdefs.h: add artificial attribute to FORTIFY_SOURCE functions" 2014-10-06 23:21:04 +00:00
Nick Kralevich
1aaa17802c cdefs.h: add artificial attribute to FORTIFY_SOURCE functions
Otherwise the gcc compiler warning doesn't show up.

Add -Wno-error to fortify related tests. Fortify related tests
are expected to be examples of bad programs, and in many
cases shouldn't compile cleanly. Rewriting them to compile
cleanly isn't feasible nor desirable.

Bug: 17784968
Change-Id: I93bececa7444d965f18c7c27d46e7abce5c49a02
2014-10-06 15:11:52 -07:00
Dan Albert
9969fecad2 Merge "Add compile time test infrastructure for bionic." 2014-10-06 19:45:32 +00:00
Dan Albert
f04a8bc226 Add compile time test infrastructure for bionic.
Actual tests to follow...

Bug: 17782583
Change-Id: I22857f19899c3b39dbc2e5473ad3be1a8a291139
2014-10-06 11:38:01 -07:00
Dmitriy Ivanov
6d569b9201 Merge "Add file_offset parameter to android_extinfo" 2014-10-06 17:19:39 +00:00
Dmitriy Ivanov
07e5bc152d Add file_offset parameter to android_extinfo
Bug: 17762003
Change-Id: I8fb267a3155acef3dba534038cf5d1ef00d7154b
2014-10-06 10:02:34 -07:00
Nick Kralevich
884a3de60f Revert "cdefs.h: add artificial attribute to FORTIFY_SOURCE functions"
Broke the build.

In file included from frameworks/rs/cpu_ref/rsCpuCore.cpp:36:
system/core/include/cutils/properties.h:118:1: error: unknown attribute '__artificial__' ignored [-Werror,-Wunknown-attributes]
__BIONIC_FORTIFY_INLINE
^
bionic/libc/include/sys/cdefs.h:537:110: note: expanded from macro '__BIONIC_FORTIFY_INLINE'
#define __BIONIC_FORTIFY_INLINE extern __inline__ __always_inline __attribute__((gnu_inline)) __attribute__((__artificial__))
                                                                                                             ^
1 error generated.
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libRSCpuRef_intermediates/rsCpuCore.o] Error 1
This reverts commit 9b543ffeac.

Change-Id: I6a1198747505dcb402b722887c1bfbc3a628a8b8
2014-10-06 00:39:47 +00:00
Nick Kralevich
9b543ffeac cdefs.h: add artificial attribute to FORTIFY_SOURCE functions
Otherwise the gcc compiler warning doesn't show up.

Delete some unittests. These unittests no longer compile cleanly
using -Wall -Werror, and rewriting them to compile cleanly
isn't feasible.

Bug: 17784968
Change-Id: I9bbdc7b6a1c2ac75754f5d0f90782e0dfae66721
2014-10-04 22:01:41 -07:00
Alex Van Brunt
8d0b2dbf21 Reimplement clock(3) using clock_gettime(3)
Unlike times(), clock_gettime() is implemented as a vDSO on many architectures.
So, using clock_gettime() will return a more accurate time and do so with less
overhead because it does have the overhead of calling into the kernel.

It is also significantly more accurate because it measures the actual time in
nanoseconds rather than the number of ticks (typically 1 millisecond or more).

Bug: 17814435
Change-Id: Id4945d9f387330518f78669809639952e9227ed9
2014-10-03 18:54:28 -07:00
Dmitriy Ivanov
d5df4124bb Merge "Add RTLD_NODELETE flag support" 2014-10-02 21:47:29 +00:00
Dmitriy Ivanov
1cd0c6777f L-MR1 specific fixes
Reset soinfo version to 0.
 Disable ifunc test for arm64 because of old toolchain
 in lmp-mr1-dev branch

 Note: this commit should be reverted in -plus-aosp branch.

Change-Id: I2d6d996d43bc35d5d4975c745779f43a988b31e6
2014-10-01 16:26:49 -07:00
Dmitriy Ivanov
7d971ec14b Fix unload of recursively linked library
Expanded test for recursive libs. Fixed bug with unnecessary
  soinfo_free of already loaded library.

(cherry picked from commit a6ac54a215)

Change-Id: I6907c723d9fbdf6b2777f3f236b1e29b0843edd6
2014-10-01 16:04:58 -07:00
Dmitriy Ivanov
f4cb631364 Add IFUNC support for arm64 and IRELATIVE reloc
There are number of changes in the way IFUNC related relocations are done:
 1. IRELATIVE relocations are now supported for x86/x86_64 and arm64.
 2. IFUNC relocations are now relying on static linker to generate
    them in correct order - this removes necessety of additional
    relocation pass for ifuncs.
 3. Related to 2: rela?.dyn relocations are preformed before .plt ones.
 4. Ifunc are resolved on symbol lookup this approach allowed to avoid
    mprotect(PROT_WRITE) call on r-x program segments.

Bug: 17399706
Bug: 17177284

(cherry picked from commit 9aea164457)

Change-Id: Ie19d900fc203beb93faf8943b0d06d534a6de4ad
2014-10-01 16:04:31 -07:00
Dmitriy Ivanov
ef1306d777 Refactoring: C++11 style DISABLE_ bionic marcos
Enable the -std=gnu++11 flag for libstdc++ static and
  dynamic libs.

  ScopeGuard uses DISABLE_ macros instead of '= delete';

(cherry picked from commit d9ff722661)

Change-Id: If2573d080770e18b36b56106f2369f7bb682cd3c
2014-10-01 16:03:51 -07:00
Dmitriy Ivanov
61c4147fa8 Reset enviroment for math_tests
Bug: 17390824

(cherry picked from commit 7b956ede3f)

Change-Id: I5d804ceb5e69533584161bfed6787529cd8296fb
2014-10-01 16:03:40 -07:00
Dmitriy Ivanov
ae69a9584b Load libraries in breadth-first order
This patch fixes the problem with symbol search order
  for dlsym(RTLD_DEFAULT/RTLD_NEXT, .) by loading libraries
  and ld_preloads in correct order.

Bug: https://code.google.com/p/android/issues/detail?id=74255
Attempt: 2

(cherry picked from commit 14669a939d)

Change-Id: Id87540c96a2242220967b6fa5d84ddcd829e2b97
2014-10-01 16:01:28 -07:00
Dmitriy Ivanov
c0133a73b6 Revert "Load libraries in breadth-first order"
This reverts commit a3ad450a2e.

(cherry picked from commit 498eb18b82)

Change-Id: Iec7eab83d0c0ed1604e1e8ea3f9e9d0ce1d29680
2014-10-01 16:00:52 -07:00
Dmitriy Ivanov
8de1ddece0 Fix order of soinfo links (repairs libcxx tests).
(cherry picked from commit b2a30ee8d2)

Change-Id: I59c5333bc050cbbea14051cea9220be2f64ee383
2014-10-01 16:00:41 -07:00
Dmitriy Ivanov
59c12a6527 Load libraries in breadth-first order
This patch fixes the problem with symbol search order
  for dlsym(RTLD_DEFAULT/RTLD_NEXT, .) by loading libraries
  and ld_preloads in correct order.

Bug: https://code.google.com/p/android/issues/detail?id=74255

(cherry picked from commit a3ad450a2e)

Change-Id: I1125de10272c84e4f075cbc72859c1f6b3e89943
2014-10-01 16:00:29 -07:00
Dmitriy Ivanov
93c3f4203c Enable __cxa_atexit && __cxa_finalize for linker
This allows adding destructors to classes used
 for global variables.

(cherry picked from commit 14241402de)

Change-Id: I1d8776130d1e01a8c53d23a2949f5010f4c96b16
2014-10-01 15:52:38 -07:00
Dmitriy Ivanov
bd321c1106 Run constructors before resolving ifunc functions
Bug: 17177284

(cherry picked from commit 9598b8c415)

Change-Id: I2c9631ee1cd77f8cf95ec0216a35b605c8786454
2014-10-01 15:51:47 -07:00
Brigid Smith
31b88da843 Added test for ifunc support in dynamic linker.
ifuncs now work in i386 and x86_64 when called in the same library as
well as in a different library.

Bug:6657325
(cherry picked from commit c5a13efa9b)

Change-Id: I321d780bc2f9bd1baa749e1acacd2683aefe827b
2014-10-01 15:50:38 -07:00
Dmitriy Ivanov
1b20dafdbe Add RTLD_NODELETE flag support
Bug: https://code.google.com/p/android/issues/detail?id=64069
Change-Id: Ie5f90482feae86391172be4b32d6cb7d76f446fb
2014-10-01 11:09:37 -07:00
Elliott Hughes
252c1ac973 Merge "Update our FreeBSD realpath(3) to upstream head." 2014-09-30 23:55:57 +00:00
Elliott Hughes
31e072fc9b Update our FreeBSD realpath(3) to upstream head.
Change-Id: I8c89728184ecd2c1a28a05cefa84a5037d28b552
2014-09-30 16:40:41 -07:00
Dan Albert
c4bcc75f09 Clean up the pthread key tests.
The previous pthread_key_create_many test was really
pthread_key_create_all, which has proven very difficult to test
correctly (because it is affected by any other parts of the system using
pthread keys, and that can vary with test ordering). It also tested
expected values of PTHREAD_KEYS_MAX and the associated sysconf() value,
rather than those being in their own test.

Instead, split this test into a few distinct tests:

 * pthread.pthread_keys_max
 * pthread._SC_THREAD_KEYS_MAX_big_enough_for_POSIX
 * pthread.pthread_key_many_distinct
     * We actually didn't have a test to ensure that the keys we were
       creating were distinct.
 * pthread.pthread_key_EAGAIN
     * Make sure pthread_key_create() will _eventually_ fail with
       EAGAIN, not at a (sometimes incorrectly) predetermined maximum.

Change-Id: Iff1e4fdcc02404094bde0418122c64c227cf1702
2014-09-30 15:40:14 -07:00
Dan Albert
3a5aeba4bd Switch benchmarks and tests to libc++.
Change-Id: I3b9c8f8c14a1e227e67ae1977cc29b0e8fccef5d
2014-09-30 10:28:30 -07:00
Dan Albert
d9898c5b82 Ignore multiple symbol definition errors.
libc and libc++ both define std::nothrow. libc's is a private symbol,
but this still causes issues when linking libc.a and libc++.a, since
private isn't effective until it has been linked. To fix this, just
allow multiple symbol definitions for the static tests.

Change-Id: Idbf19fefda47298c39360e3f5b6242b0b1a52fcc
2014-09-30 10:28:30 -07:00
Christopher Ferris
528ad742c6 Fix sys_stat.mkfifo when not run as root.
It's not allowed for a shell user to create a fifo in /data/local/tmp.
Make the test do nothing if not run as root.

Bug: 17646702

(cherry picked from commit 6c69afdb6d)

Change-Id: Ia3a862ed4586413b7bb393557ab57e0a7141d888
2014-09-24 16:50:30 -07:00
Christopher Ferris
6c69afdb6d Fix sys_stat.mkfifo when not run as root.
It's not allowed for a shell user to create a fifo in /data/local/tmp.
Make the test do nothing if not run as root.

Bug: 17646702
Change-Id: I932262fa233eae8b5dd607a2398a47c50a208701
2014-09-24 16:01:18 -07:00
Elliott Hughes
31165edf57 CLOEXEC support in fdopen, freopen, and mkostemp/mkostemps.
Change-Id: I74ea88e0d4973d6ab3c57da7d8bb643c31592b14
2014-09-23 18:21:52 -07:00
Elliott Hughes
b05ec5ae93 Pull in upstream fixes to reject invalid bases.
Also add tests to make sure the full set works correctly.

Change-Id: I3e7f237f12c9c93e1185a97c9717803e7e55a73c
2014-09-23 14:53:10 -07:00
Elliott Hughes
34c987a6dd Test pthread_cleanup_push(3)/pthread_cleanup_pop(3).
Change-Id: I5a623fa1e1da55f11d51f3a9bdfa0627698c486f
2014-09-22 16:27:19 -07:00