Commit graph

17116 commits

Author SHA1 Message Date
Treehugger Robot
166f875eab Merge "dlerror returns char*, not const char*." 2016-08-11 23:16:59 +00:00
Elliott Hughes
5e071a18ce dlerror returns char*, not const char*.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlerror.html:

    char *dlerror(void);
    ...
    The application shall not modify the string returned.

Change-Id: I5e684bfd3930c39a2a30ea6fd005a5d5d3e5b181
2016-08-11 15:02:45 -07:00
Dimitry Ivanov
c623e7efc9 Merge "linker: use stat(2) to check file existence" 2016-08-11 19:53:02 +00:00
Dimitry Ivanov
4cf7024db7 linker: use stat(2) to check file existence
open(2) can be used to open directories; use stat to
check that the file exists and is a regular file.

Addresses review comments for 5aa67675f8

Bug: http://b/30320104
Change-Id: Ia944db2f2f779a87ea01dd41dcd171e59c9bef01
2016-08-11 11:11:52 -07:00
Treehugger Robot
cea35d77a2 Merge "linker_asan: Translate absolute dlopen paths to use asan-libraries." 2016-08-11 17:38:07 +00:00
Dimitry Ivanov
45d25ca728 linker_asan: Translate absolute dlopen paths to use asan-libraries.
This patch enables absolute path translation to instrumented library
when linker_asan is in use.

Test: adb shell cat /proc/<rlid pid>/maps | grep libril-qc-qmi-1.so
      check that it is mapped from /data/vendor/lib64 and not /vendor/lib64
Bug: http://b/30320104
Change-Id: I3bc24754b192afc0a72d6f3801f7b42141ce715b
(cherry picked from commit 5aa67675f8)
2016-08-10 21:37:50 -07:00
Treehugger Robot
4519a4d182 Merge "Add ndk_library for libdl." 2016-08-11 01:33:31 +00:00
Treehugger Robot
32a2e137a5 Merge "Add __attribute__((sentinel)) tags to execl and friends." 2016-08-11 01:19:23 +00:00
Treehugger Robot
3e35b26704 Merge "Check alignment along with range of mapped file fragments" 2016-08-11 00:46:33 +00:00
Treehugger Robot
299e501419 Merge "Move brillo closer to Android." 2016-08-10 23:59:19 +00:00
Treehugger Robot
18af5bfa5d Merge "Remove __static_cast macro from <sys/cdefs.h>." 2016-08-10 23:58:12 +00:00
Josh Gao
d80a52eb65 Add __attribute__((sentinel)) tags to execl and friends.
Give a compile time diagnostic when the nullptr sentinel is missing
from an execl family call, instead of just pulling arbitrary values.

Bug: http://b/30793878
Change-Id: I1c49005c58b7ad4a5b04f0435b722d4c744e8f0e
Test: Built bullhead
2016-08-10 15:26:41 -07:00
Elliott Hughes
d1dd7c58b4 Remove __static_cast macro from <sys/cdefs.h>.
We don't use it, and we added the more general __BIONIC_CAST anyway.

Change-Id: I2cb8a108b58bb2cb24ed2b1890d9efed671196dc
2016-08-10 14:18:01 -07:00
Elliott Hughes
af211ab23f Merge "Fortify vsnprintf in more cases." 2016-08-10 21:11:10 +00:00
Elliott Hughes
5ffed9b856 Move brillo closer to Android.
Hiding our legacy cruft seemed like a good idea, but in practice it will only
mean worse interoperability.

Plus we got it wrong, as the recent `putw` example showed.

Change-Id: I167c7168eff133889028089c22a7a0dfb8d6d0cf
2016-08-10 14:08:31 -07:00
Elliott Hughes
fb3873d4db Fortify vsnprintf in more cases.
Bug: http://b/30445072
Change-Id: I1893890f0e3b56533eef053eda1bd96a0b9a5119
2016-08-10 11:50:12 -07:00
Dimitry Ivanov
bd90675111 Check alignment along with range of mapped file fragments
Improve sanity-checks of elf-file by adding alignment check
of mapped sections and section headers.

Bug: http://b/30687964
Change-Id: I7f06ddaa56a13989ce7be847b3a73c352e32c008
(cherry picked from commit 7e2d49ae3e)
2016-08-10 10:52:55 -07:00
Treehugger Robot
f5042cab10 Merge "Remove more stdio copy/paste." 2016-08-10 00:43:39 +00:00
Elliott Hughes
53cf348c82 Remove more stdio copy/paste.
Change-Id: Ia92629b75d2c153ecf1cec711e2f9575eef604ab
2016-08-09 16:27:23 -07:00
Treehugger Robot
ce11d26bd7 Merge "linker: fix mips build" 2016-08-09 15:20:38 +00:00
Dimitry Ivanov
576a375bc2 linker: fix mips build
Change-Id: I88c5ba7f33825ae9b36992b32d30579ec4a66915
Test: lunch aosp_mips-eng && mm
2016-08-09 06:58:55 -07:00
Treehugger Robot
dcc8feb696 Merge "Don't use the same declaration to declare multiple symbol names." 2016-08-09 00:57:32 +00:00
Treehugger Robot
8336b64442 Merge changes I868417f4,I57ac3667
* changes:
  Extract soinfo and globals to separate files.
  Move android_namespace_t to a separate file.
2016-08-09 00:31:46 +00:00
Josh Gao
8a03c83ef8 Don't use the same declaration to declare multiple symbol names.
This doesn't play well with preprocessing.

Bug: http://b/30170081
Change-Id: Id7fc648113336dcccdfa0a6b108f3d452aaf1ed2
2016-08-08 16:39:07 -07:00
Dimitry Ivanov
48ec288d40 Extract soinfo and globals to separate files.
Move soinfo and globals out of linker.cpp to
separate files.

Breaking up huge linker.cpp into smaller peaces
in order to make it easier to extract part of the
code that belongs to libdl.so and remove parts of
the code that do not belong to linker

(refactoring part 2 of many)

Change-Id: I868417f4b8d2b84d0e8265e354bc7977161497e2
2016-08-08 16:12:53 -07:00
Dimitry Ivanov
b943f303a2 Move android_namespace_t to a separate file.
Breaking up huge linker.cpp into smaller peaces
in order to make it easier to extract part of the
code that belongs to libdl.so and remove parts of
the code that do not belong to linker

(refactoring part 1 of many)

Change-Id: I57ac36677a815800dc127c8c45c3ea806c37e247
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
2016-08-08 16:12:52 -07:00
Elliott Hughes
6ba5f07e3f Merge "Update NOTICE files." 2016-08-08 23:04:02 +00:00
Elliott Hughes
77a3e28e2e Update NOTICE files.
Change-Id: I591dc91b54804aebc05ba6f9974ef9add660ecfe
2016-08-08 12:39:56 -07:00
Treehugger Robot
4b10751310 Merge "Guard fortify inlines with __ANDROID_API__." 2016-08-06 01:31:18 +00:00
Treehugger Robot
7e93d9c675 Merge "Reimplement remove(3) without the lstat(2)." 2016-08-06 00:11:15 +00:00
Dan Albert
dfa6bbb54b Guard fortify inlines with __ANDROID_API__.
Test: make checkbuild with libc ndk_library patches applied
Change-Id: Ic5e248994c4f2702b0f4d6dfeda787187ea86017
2016-08-05 16:33:32 -07:00
Elliott Hughes
d1f25a7eb1 Reimplement remove(3) without the lstat(2).
This assumes that it's more likely we're unlinking a file than a directory,
though even if that's not true, as long as a failed unlink(2) is cheaper
than a successful lstat(2) -- which seems likely since there's no data to
copy -- we still win.

Change-Id: I0210e9cd3d31b8cf1813c55c810262ef327382ed
2016-08-05 15:53:03 -07:00
Dan Albert
e8a9108b4b Add ndk_library for libdl.
Test: make checkbuild
Bug: http://b/30465923
Change-Id: I8acf82f319d3b22948868bc5c4c377f2348af266
2016-08-05 09:36:48 -07:00
Treehugger Robot
ed9e6a41c9 Merge changes I01c4d9a8,Ic34734b4
* changes:
  Run genversion-scripts.py.
  Annotate libdl.map.txt.
2016-08-04 23:56:55 +00:00
Dan Albert
c8a95a3b15 Run genversion-scripts.py.
Change-Id: I01c4d9a85d3397b02b00b4d33fafe6d9ae692ed7
2016-08-04 15:39:21 -07:00
Dan Albert
1bcaf53d20 Annotate libdl.map.txt.
Test: readelf diff between soong generated stubs and prebuilts/ndk
Bug: http://b/30465923
Change-Id: Ic34734b40870c8b628449458798c0343648e4e97
2016-08-04 13:43:20 -07:00
Pirama Arumuga Nainar
e8921ec92c Merge "Guard include of uchar.h in stdatomic.h" 2016-08-04 18:23:21 +00:00
Pirama Arumuga Nainar
ed3c78771f Guard include of uchar.h in stdatomic.h
Bionic stdatomic.h is also used for the host (via a copy in
prebuilts/clang).  Revert to guarding the include of uchar.h based on
__STDC_VERSION__, so it is included only when needed.

Change-Id: I5b45c7f5d16da223478512104702a3e4e5a975ae
Test: bionic tests on host and Angler.  Confirmed failures I am 
      seeing are KIs.
2016-08-04 18:22:12 +00:00
Treehugger Robot
f0b53115ae Merge changes Iecc1b127,Ib67f07db,I7672d34c
* changes:
  Run genversion-scripts.py.
  Only check arch tag if we have *any* arch tags.
  Add pylintrc.
2016-08-03 17:50:38 +00:00
Treehugger Robot
d7d4937bdc Merge changes Ib5962ea3,I8c1a7464,I06ce7c31
* changes:
  Add version information for legacy inlines.
  versioner: remove unnecessary kernel/common symlink.
  versioner: add symlink for kernel/android/uapi.
2016-08-03 00:22:12 +00:00
Dan Albert
37ba9052b0 Run genversion-scripts.py.
Change-Id: Iecc1b127c67a96aecc4e86582c1cc3291a4acf00
2016-08-02 15:33:53 -07:00
Dan Albert
ea701b3790 Only check arch tag if we have *any* arch tags.
With the introduction of new tags for ndk_library, we'll have a lot
of tags that aren't architecture tags. If we have something tagged
`introduced=21`, it should be in all architectures.

Change-Id: Ib67f07db14625f6903919c181050316eb183bed5
2016-08-02 15:33:53 -07:00
Dan Albert
10085bfdc0 Add pylintrc.
Disable all the style differences present in genversion-scripts.py.

Change-Id: I7672d34c4f7698ba445968dd5d9f5ef1fdc60056
2016-08-02 15:15:09 -07:00
Treehugger Robot
0fb3b0aec4 Merge changes Iedab3259,I333fe8ae
* changes:
  Put bsd_signal back.
  Unversion some symbols for the NDK.
2016-08-02 21:44:20 +00:00
Josh Gao
b6a4a4c0cc Add version information for legacy inlines.
Bug: http://b/30170081
Change-Id: Ib5962ea3037dd692a98b6691d263871549aac8af
2016-08-02 14:32:42 -07:00
Josh Gao
f9128bc7d4 versioner: remove unnecessary kernel/common symlink.
The target was moved by commit 5956b4e, but none of the headers
contained were actually necessary to compile any bionic headers.

Bug: http://b/30170081
Change-Id: I8c1a7464de0992c20af194340c0e36d131a836e7
2016-08-02 14:32:42 -07:00
Josh Gao
180c883f09 versioner: add symlink for kernel/android/uapi.
The android-only kernel headers were moved to their own directory by
commit d6e8b8c. Add a new symlink to match.

Change-Id: I06ce7c3167fbb1e058e4a137fae9375bb5792a46
2016-08-02 14:32:42 -07:00
Dimitry Ivanov
bbf593f0f0 Merge "Correct libstdc++ version" 2016-08-02 18:17:08 +00:00
Dan Albert
00c8e9556f Put bsd_signal back.
With this change (and all the others below it in the stack), the only
difference between the arm android-9 libc.so in r13-beta1 and the one
we are now generating is the addition of LIBC_N and LIBC_O versions.

Test: make ndk, readelf stub libc.so to check symbol exists
Bug: https://github.com/android-ndk/ndk/issues/160
Change-Id: Iedab32592b2d979f3cc922ffd4ed406427de3dda
2016-08-02 10:58:52 -07:00
Dan Albert
674d93db37 Unversion some symbols for the NDK.
These functions were erroneously released in LIBC_PRIVATE for M, but
in fact need to be public. Since we need to be able to load them on M
even if they were built for a lower platform (and M needs to load on
newer platforms), we need to unversion them.

Change-Id: I333fe8ae7380cc2a5dbd699414399ec52f602383
2016-08-02 10:43:35 -07:00