Commit graph

126 commits

Author SHA1 Message Date
Dan Albert
4caa1f0977 Implement malloc_info(3).
Expose jemalloc stats through the malloc_info(3) interface.

Bug: 16874689
Change-Id: I4358ac283002e60ff161107028d1a3fb1e9afb0a
2014-08-22 10:23:12 -07:00
Elliott Hughes
2b021e1066 Add <stdio_ext.h> for elfutils.
Bug: 17139679
Change-Id: I1605ac382dbb6f23b2d874dbb9769f3cde4a6a99
2014-08-20 10:23:52 -07:00
Elliott Hughes
3e424d0a24 Implement twalk(3), add unit tests.
I've also added insque(3) and remque(3) (from NetBSD because the OpenBSD
ones are currently broken for non-circular lists).

I've not added the three hash table functions that should be in this header
because they operate on a single global hash table and thus aren't likely
to be useful.

Bug: https://code.google.com/p/android/issues/detail?id=73719
Change-Id: I97397a7b921e2e860fd9c8032cafd9097380498a
2014-07-24 14:55:29 -07:00
Christopher Ferris
8e32b7b354 Make jemalloc the default choice.
Change-Id: I5ff0cf0c396b7ae6278e6fcd5a0d50f8b966fb54
2014-07-11 11:01:30 -07:00
Elliott Hughes
d06ee1d6db Build all bionic test files -Werror and fix our one warning.
Change-Id: I62bb0528fd1bcb9aa4c61e44c78158a592690fc7
2014-07-01 17:17:46 -07:00
Dmitriy Ivanov
fcac81ef04 Native tests are now multilib=both by default
Change-Id: I788ac0b871703c137727a65e017c4466127c0190
2014-07-01 15:38:22 -07:00
Dmitriy Ivanov
1f5e1a3cbc Move libraries for unit-tests to separate folder
Change-Id: I1653f3f2fd63ba25525369bc725c8f7438ecf021
2014-06-17 15:08:53 -07:00
Dan Albert
e5fdaa4f9d Revert "Backing this one out since the counterpart needs to be sent upstream."
This reverts commit a04d2bc28e.

Change-Id: I1b49165ca5d4bafdba7948818256a6167a363aca
2014-06-14 01:04:31 +00:00
Dan Albert
a04d2bc28e Backing this one out since the counterpart needs to be sent upstream.
This reverts commit 5ee320dd35.

Change-Id: I1a9c6b06c3aca595f01c629f7649be743dc48e77
2014-06-14 00:51:14 +00:00
Dan Albert
5ee320dd35 Hides valloc(3)/pvalloc(3) on LP64.
These were removed from POSIX 2004. Hides the header declarations for all
targets, and hides the symbols for LP64.

Bug: 13935372
Change-Id: Id592f67e9b7051517a05f536e1373b30162e669c
2014-06-13 15:35:05 -07:00
Christopher Ferris
e9f7a9c340 Allow bionic-unit-tests-glibc to be built again.
When we switched to 64 bit host build be default, we no longer build
the glibc unit tests. Fix that, and also set all host targets to build
multilib.

This change also changes the name of bionic-unit-tests-glibc to add
the suffix of 32 or 64 depending on the host type built.

Change-Id: Ife13f9d80f351750ff02825b086d44bb0c2df828
2014-06-10 19:46:07 -07:00
Ying Wang
7f722b366a Use PRIVATE_POST_INSTALL_CMD to create symlink.
Bug: 15520908
Change-Id: Ib3349f7adb6def81abf07bfb9d37093e4a599d09
2014-06-09 16:32:51 -07:00
Dan Albert
452e091300 Merge "Adds functionality specified by uchar.h" 2014-06-04 16:10:50 +00:00
Dan Albert
7a7f9952c1 Adds functionality specified by uchar.h
mbrtoc32 and c32rtomb get their implementations from mbrtowc and wcrtomb. The
wc functions now simply call the c32 functions.

Bug: 14646575
Change-Id: I49d4b95fed0f9d790260c996c4d0f8bfd1686324
2014-06-04 08:39:24 -07:00
Elliott Hughes
d286796fce Turn on -Wunused and fix the mistakes it uncovers.
Change-Id: I023d2d8b547fbc21d4124bb7510d42b06a0dc501
2014-06-03 15:22:34 -07:00
Dmitriy Ivanov
214e64135e Make atexit.dlclose work for glibc
* build libtest_atexit.so
 * remove atexit(NULL) - glibc segfaults on it

Bug: 15350494
Change-Id: I27d79130c32c5691b0e8790a57d92f9710f5bf4a
2014-05-30 18:16:09 -07:00
Christopher Ferris
d178c83d45 Fix unwinding_through_signal_frame test.
I accidentally removed the compilcation of the test implementation file
with special flags needed for the test to work. This change creates the
impl as a library with those flags back.

Bug: 14819262
Change-Id: Ib84fd26a7f4d40a0267d3ed686185b0abc5a3706
2014-05-29 20:00:12 -07:00
Elliott Hughes
e6c57fcb05 Add C11 <stdatomic.h>.
Bug: 14903517
Change-Id: I631dbfdaa698cf7fea8e3b5e18a32586383e62a5
2014-05-23 20:06:03 -07:00
Christopher Ferris
72bbd42357 Support for jemalloc to replace dlmalloc.
To use jemalloc, add MALLOC_IMPL = jemalloc in a board config file
and you get the new version automatically.

Update the pthread_create_key tests since jemalloc uses a few keys.
Add a new test to verify memalign works as expected.

Bug: 981363

Change-Id: I16eb152b291a95bd2499e90492fc6b4bd7053836
2014-05-20 14:47:33 -07:00
Dmitriy Ivanov
b648a8a57e Add RTLD_NOLOAD support and some related changes.
* Aligned RTLD_ values with glibc for lp64
 * dlopen supports RTLD_NOLOAD flag
 * soinfo_unload calls find_library(.., RTLD_NOLOAD)
   instead of naive find_loaded_library_by_name()
 * dlopen changed to add child to caller soinfo instead
   of somain.

Bug: https://code.google.com/p/android/issues/detail?id=64069
Change-Id: I1a65f2c34f3e0edc6d2c41a2e408b58195feb640
2014-05-20 12:02:24 -07:00
Dan Albert
7a39094465 Revert "Removes bionic's dependence on stlport"
This reverts commit 4d35da1df8.

Change-Id: Ie9a2620441edb55dbc5949e13a4b913ea4e66797
2014-05-19 23:46:51 +00:00
Dan Albert
4d35da1df8 Removes bionic's dependence on stlport
Only affects tests/benchmarks. Confirmed passing on arm.

Change-Id: If158e23e8cd06e7597ef6f3c9376f6799b467e62
2014-05-19 11:33:14 -07:00
Jingwei Zhang
568d64dc62 Accuracy tests for libm
This patch adds tests for 14 math functions to address coverage
issue of math functions discussed in:
https://android-review.googlesource.com/#/c/49653/

Change-Id: Ia7200b93d4f5c7928a3fb827ca6932226384a116
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Yong Yao <yong.yao@intel.com>
2014-05-16 15:31:55 -07:00
Dmitriy Ivanov
d59e50063a Improve detection of already loaded libraries
Linker is now able to resolve symlinked libraries correctly.

soinfo is extended to save the graph of dependencies during
load/unload. Dependencies are used only in CallConstructor.

Bug: 9741592
Change-Id: Id9c48a74c46aa89bcdf3d54ec2f8ba3d398130b1
2014-05-14 15:16:35 -07:00
Elliott Hughes
6a41b0fb0e Flesh out <arpa/inet.h>.
Use the upstream OpenBSD implementations of these functions.

Also ensure we have symbols for htonl, htons, ntohl, and ntohs.
gtest doesn't like us using the macro versions in ASSERT_EQ.

Bug: 14840760
Change-Id: I68720e9aca14838df457d2bb27b999d5818ac2b5
2014-05-13 18:08:29 -07:00
Elliott Hughes
eb664e24c0 Add getmntent_r to our collection of <mntent.h> compatibility stubs.
This helps build 'external/flo' out of the box.

Bug: 14841211
Change-Id: I30dde77239cceaf1f5743163744eb3604d27a266
2014-05-13 10:44:07 -07:00
Dmitriy Ivanov
7db180919c Test dlopen with symlinked .so files
Bug: 9741592
Change-Id: I68c59d6f4e690136395c3dc3de13f99ce38de528
2014-05-08 14:28:34 -07:00
Dmitriy Ivanov
f837cbdc27 Merge "Add missing test for atexit test suite." 2014-05-07 20:49:00 +00:00
Dmitriy Ivanov
6396da98cb Add missing test for atexit test suite.
Change-Id: I3d14d7df1da53ccef534c106633593551ab6a7cb
2014-05-07 12:29:54 -07:00
Calin Juravle
837abf0466 Merge "Fix bionic-unit-tests-glibc-run target" 2014-05-07 18:31:11 +00:00
Calin Juravle
0e9d7fccb9 Fix bionic-unit-tests-glibc-run target
Configure multilib for bionic-unit-tests-glibc-run target (the path to
the host executable was already patched to support multilib build but
the multilib itself wasn't configured).

Change-Id: If533fbdb19bc737e543cf85a0787505458f24579
2014-05-07 19:06:30 +01:00
Torne (Richard Coles)
2605261691 Test that relro sharing actually saves memory.
Spawn 20 child processes, have them all load the library, and compare
the total PSS used in the case where we use dlopen() and the case where
we use android_dlopen_ext() with relro sharing. We assume we will save
at least 10% of the memory; in practise this example saves 40% or more
so this should be a reasonable threshold.

Bug: 14299541
Change-Id: Idccf6b8b0eb137abae2200f1ce68fb76b3cbdd75
2014-05-06 11:38:53 +01:00
Torne (Richard Coles)
9b5ee4aa85 Merge "Handle empty relro segment or incorrectly sized file." 2014-05-06 10:16:18 +00:00
Dmitriy Ivanov
6b56691a67 Fixes for __cxa_finalize
* Ability to register atexit handler from atexit handler
  * Correct way to handle both forms of atexit handler

Bug: https://code.google.com/p/android/issues/detail?id=66595
Bug: 4998315
Change-Id: I39529afaef97b6e1469c21389d54c0d7d175da28
2014-05-05 11:36:57 -07:00
Torne (Richard Coles)
26ec9679ff Handle empty relro segment or incorrectly sized file.
If the file has no relro segment, the generated relro file will have
length 0, which caused mmap to fail. If the relro file has nonzero size,
but is too short (e.g. because it's for the wrong version of the
library), the linker would segfault while comparing the data. Fix both
these issues: don't try to map a zero length file, and don't try to
compare data that would be beyond the end of the file.

Improve test to explicitly generate two versions of the library: one
with -z relro, and one with -z norelro, so we can test both cases; also
explicitly test the case where the relro file has length 0.

Bug: 14299541
Change-Id: Id8b95585edda90e8bb5de452a35b70ed2d224934
2014-05-02 14:25:45 +01:00
Dan Albert
b8425c549a Adds quick_exit(3) and at_quick_exit(3) from freebsd
Change-Id: I4fe88abd8f7b8aa45e58aeb2529d59a8d555d338
2014-04-29 19:17:00 -07:00
Elliott Hughes
55cd82762f Merge "Switch to the OpenBSD wcsto* functions." 2014-04-29 22:33:15 +00:00
Elliott Hughes
3d7a0d9b08 Switch to the OpenBSD wcsto* functions.
This replaces a partial set of non-functional functions with a complete
set of functions, all of which actually work.

This requires us to implement mbsnrtowcs and wcsnrtombs which completes
the set of what we need for libc++.

The mbsnrtowcs is basically a copy & paste of wcsnrtombs, but I'm going
to go straight to looking at using the OpenBSD UTF-8 implementation rather
than keep polishing our home-grown turd.

(This patch also opportunistically switches us over to upstream btowc,
mbrlen, and wctob, since they're all trivially expressed in terms of
other functions.)

Change-Id: I0f81443840de0f1aa73b96f0b51988976793a323
2014-04-29 14:53:11 -07:00
Christopher Ferris
5090964da0 Fix potential makefile bug.
Since multilib is not set every time, it needs to be per module or
there is a change that another target will use the multilib value set
previously.

Change-Id: I5c30e18d5111705cb3f6e3d4cd9ef8a28c9b746c
2014-04-28 21:10:37 -07:00
Elliott Hughes
0c567f1e6c Fix the glibc tests again.
The glibc tests are just a regular host binary; they don't require
that you're targeting x86 or x86_64. They do seem to pick up the
suffix of the target though, even though they're always 32-bit.

Change-Id: I689ca2a4f8d7b397afa4df722b95b0d7ec904bf6
2014-04-22 19:21:32 -07:00
Dmitriy Ivanov
156c3afcf1 Follow up on building tests for both platforms
this makes run-on-host work properly

Change-Id: Iaed93ca9d96359b64bbeff995280ecd70fc9cc60
2014-04-22 15:22:25 -07:00
Christopher Ferris
345b49a7c0 Build 32/64 bit versions of tests/benchmarks.
Change-Id: I4d146377aac6573a214dfaa5cab5cce8b10538b4
2014-04-22 10:42:12 -07:00
Torne (Richard Coles)
c363e5dd0a Merge "Support loading libraries to a reserved address." 2014-04-22 10:33:34 +00:00
Elliott Hughes
f3c73901cb Upgrade our <ctype.h> implementation to OpenBSD head.
Adding the perfunctory <ctype.h> tests showed that we'd accidentally
dropped several symbols. This puts everything back in its proper place
and switches us to upstream head at the same time.

Change-Id: Ib527ad280c9baded81e667fa598698526d93e66f
2014-04-18 10:29:16 -07:00
Torne (Richard Coles)
12bbb91645 Support loading libraries to a reserved address.
Add flags and parameters to android_dlopen_ext() to allow loading a
library at an already-reserved fixed address. If the library to be
loaded will not fit within the space reserved, then the linker will
either fail, or allocate its own address space as usual, according to
which flag has been specified. This behaviour only applies to the
specific library requested; any other libraries loaded as dependencies
will be loaded in the normal fashion.

There is a new gtest included to cover the functionality added.

Bug: 13005501
Change-Id: I5d1810375b20fc51ba6a9b3191a25f9792c687f1
2014-04-17 14:22:17 +01:00
Elliott Hughes
8c42606ae1 Add a test for external/stlport a6df82320fcb8f26af0d067c7768fedbaeb9ad88.
Change-Id: If4df9f5df41ae5453a3dff6bb032b419819f8703
2014-04-10 11:34:14 -07:00
Elliott Hughes
77e944fd46 Implement wctomb(3) for ltrace.
This is an implementation in the style of the rest: char == byte.

We might want to come back and implement UTF-8, but this is enough for ltrace.

Bug: 13747066
Change-Id: Ib2b63609c9014fdef9a8491e067467c4fc5ae3cc
2014-04-07 14:29:28 -07:00
Christopher Ferris
108f6dc316 Move accept4 tests into sys_socket_test.cpp.
In addition, create basic recvmmsg, sendmmsg tests.

Change-Id: Ie9f4954446d98b5eb5e553d3c616c1ee67c3cb66
2014-03-31 22:43:38 -07:00
Christopher Ferris
9cea377505 Small accept4 fixes.
Put the accept4 test in the sorted order, and put the accept4 define in
sorted order.

Also add the missing SYS_RECVMMSG and SYS_SENDMMSG defines.

Change-Id: Iba55354975e0d5027dbee53f6de752c2df719493
2014-03-31 11:23:39 -07:00
Pavel Chupin
50282f72bb Add lconv declaration and localeconv(3)
lconv is taken from ndk/sources/android/support/include/locale.h and
matches
bsd/glibc upstream.
Keep old declaration for 32-bits for compatibility.
localeconv.c and deps are taken from openbsd upstream.
Changed strtod.c accordingly.

Change-Id: I9fcc4d15f5674d192950d80edf26f36006cd31b4
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-03-28 11:15:03 +00:00