summaryrefslogtreecommitdiffstats
path: root/libc/arch-x86
Commit message (Collapse)AuthorAgeFilesLines
* Clean up the architecture-specific makefiles.Elliott Hughes2014-10-281-13/+23
| | | | | | | | | | Group things appropriately and name each group. Bug: 18160821 (cherry picked from commit 7c02d9428ca18ac600f7ba7d51bb24ca71e733f6) Change-Id: I863242515af44058154d03e2d8c34678e682d66a
* [x86,x86_64] Fix libgcc unwinding through signalPavel Chupin2014-10-273-40/+101
| | | | | | | | | | | | | | | | | | | | | | | 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 50321e2e66f19998970e59d666bc9af387345b3a) Change-Id: Iba90e36958b00c7cc7db5eeebf888dc89ce4d619
* Fix signal trampolines.Elliott Hughes2014-10-273-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | * LP32 should use sa_restorer too. gdb expects this, and future (>= 3.15) x86 kernels will apparently stop supporting the case where SA_RESTORER isn't set. * gdb and libunwind care about the exact instruction sequences, so we need to modify the code slightly in a few cases to match what they're looking for. * gdb also cares about the exact function names (for some architectures), so we need to use __restore and __restore_rt rather than __sigreturn and __rt_sigreturn. * It's possible that we don't have a VDSO; dl_iterate_phdr shouldn't assume that getauxval(AT_SYSINFO_EHDR) will return a non-null pointer. This fixes unwinding through a signal handler in gdb for all architectures. It doesn't fix libunwind for arm and arm64. I'll keep investigating that... (cherry picked from commit 36f451a6d93b6807944d99fa23396e039c47e845) Bug: 17436734 Change-Id: Ic1ea1184db6655c5d96180dc07bcc09628e647cb
* am d11eac34: Force export symbols on all x86 variants in libc.Christopher Ferris2014-10-072-0/+16
|\ | | | | | | | | * commit 'd11eac3455a059a092ceee92eda9905e1d661e94': Force export symbols on all x86 variants in libc.
| * Force export symbols on all x86 variants in libc.Christopher Ferris2014-10-062-0/+16
| | | | | | | | | | | | | | | | | | | | For silvermont, the __popcountsi2 symbol does not get exported by libc. But for atom, this symbol is exported. Since we already exported this symbol for previous releases, it's better to just follow through and force the export, but only for 32 bit. x86 64 bit will not export this symbol. Bug: 17681440 Change-Id: I6c62245f0960910f64baaaf6d9d090bf3ea5f435
* | Add IFUNC support for arm64 and IRELATIVE relocDmitriy Ivanov2014-10-011-0/+1
|/ | | | | | | | | | | | | | | | | | 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 9aea164457c269c475592da36b4655d45f55c7bc) Change-Id: Ie19d900fc203beb93faf8943b0d06d534a6de4ad
* Add posix_fadvise(3).Elliott Hughes2014-09-101-0/+46
| | | | | Bug: 12449798 Change-Id: I07cbf3f670a0d1304b68148325a774f266b5c433
* Ensure __set_errno is still visible on LP32.Elliott Hughes2014-09-08198-588/+198
| | | | | | | | | | | | | | | | The use of the .hidden directive to avoid going via the PLT for __set_errno had the side-effect of actually making __set_errno hidden (which is odd because assembler directives don't usually affect symbols defined in a different file --- you can't even create a weak reference to a symbol that's defined in a different file). This change switches the system call stubs over to a new always-hidden __set_errno_internal and has a visible __set_errno on LP32 just for binary compatibility with old NDK apps. Bug: 17423135 Change-Id: I6b6d7a05dda85f923d22e5ffd169a91e23499b7b
* Fix pthread_getattr_np for the main thread.Elliott Hughes2014-08-262-35/+0
| | | | | | | | | | | | | | | | | | | | | | | On most architectures the kernel subtracts a random offset to the stack pointer in create_elf_tables by calling arch_align_stack before writing the auxval table and so on. On all but x86 this doesn't cause a problem because the random offset is less than a page, but on x86 it's up to two pages. This means that our old technique of rounding the stack pointer doesn't work. (Our old implementation of that technique was wrong too.) It's also incorrect to assume that the main thread's stack base and size are constant. Likewise to assume that the main thread has a guard page. The main thread is not like other threads. This patch switches to reading /proc/self/maps (and checking RLIMIT_STACK) whenever we're asked. Bug: 17111575 Signed-off-by: Fengwei Yin <fengwei.yin@intel.com> (cherry picked from commit 57b7a6110e7e8b446fc23cce4765ff625ee0a105) Change-Id: I87e679ee1c0db8092f2d1221c8e7c1461545c5a4
* Fix our x86 PIC_PROLOGUE.Elliott Hughes2014-08-091-3/+3
| | | | | | | | | | | | | The old definition only worked for functions that didn't use numbered local labels. Upstream uses '666' not only as some kind of BSD in-joke, but also because there's little likelihood of any function having labels that high. There's a wider question about whether we actually want to go via the PLT at all in this code, but that's a question for another day. Bug: 16906712 Change-Id: I3cd8ecc448b33f942bb6e783931808ef39091489
* Make __set_errno hidden in asm.Dan Albert2014-08-08195-0/+390
| | | | | | | | This fixes the build after the -Bsymbolic change. Bug: 16853291 Change-Id: I989c9fec3c32e0289ea257a3bd2b7fd2709b6ce2 (cherry picked from commit bc9f9f25bf1247a6a638a2a2df8441bdd9fabad7)
* Android is all-PIC/PIE.Elliott Hughes2014-08-074-29/+2
| | | | | | | | | | | Clean up the x86/x86_64 assembler. The motivator (other than reducing confusion) was that asm.h incorrectly checked PIC rather than __PIC__. Bug: 16823325 (cherry picked from commit 6b6364a7fc7c3ba37ee907776a29bdc8c9793db9) Change-Id: I89ca57fa0eb34a36de6cb11ea85f71054fce709d
* Revert "Replaces vfork() implementation with fork()"Dan Albert2014-08-062-0/+45
| | | | | | | | | We're getting cold feet on this one... let's put it back. This reverts commit 210331d9762037afb9b5ed8413079c6f65872df9. Change-Id: I6b0d3c2b1dbf7f1dc9566979a91b7504c2189269 (cherry picked from commit 6a918870bab1a55a5f57dd7954abd9a8a27c1bc2)
* Implement <sys/fsuid.h>.Elliott Hughes2014-07-302-0/+42
| | | | | | (cherry picked from commit 79310994d2b3826a10598f7e7795acb5edb42a20) Change-Id: I47688273691e5c95e5e9302eba254ccaaaad40ca
* Remove the unused swab.S.Elliott Hughes2014-07-221-68/+0
| | | | | | (cherry picked from commit ca70453e84a88405d30f64d603f9a9b5f53f1243) Change-Id: I4dc13de0bdeb7abb3bd47b0397546ad7d1f11d49
* Regenerate the bionic NOTICE files.Elliott Hughes2014-07-071-1/+2
| | | | | | | Also fix a few formatting issues in copyright headers that were confusing the script (though obviously it would be better if the script were smarter). Change-Id: I7f561bef4f84fdcbd84f375ee226bd65db0e507b
* Add splice, tee, and vmsplice.Elliott Hughes2014-06-243-0/+118
| | | | Change-Id: I5f43380b88d776a8bb607b47dbbc5db5a2fe6163
* Merge "Remove SHA1 from LP64 in favor of libcrypto."Dan Albert2014-06-201-0/+3
|\
| * Remove SHA1 from LP64 in favor of libcrypto.Dan Albert2014-06-161-0/+3
| | | | | | | | | | | | | | Keep the symbols around on LP32 for binary compatibility. Bug: 11156955 Change-Id: I379a7e0fa3092e9a70daeafcbcb2aacfc314031a
* | Cache getpid.Elliott Hughes2014-06-201-2/+2
|/ | | | | | | | | | | | | | | | | In practice, with this implementation we never need to make a system call. We get the main thread's tid (which is the same as our pid) back from the set_tid_address system call we have to make during initialization. A new pthread will have the same pid as its parent, and a fork child's main (and only) thread will have a pid equal to its tid, which we get for free from the kernel before clone returns. The only time we'd actually have to make a getpid system call now is if we take a signal during fork and the signal handler calls getpid. (That, or we call getpid in the dynamic linker while it's still dealing with its own relocations and hasn't even set up the main thread yet.) Bug: 15387103 Change-Id: I6d4718ed0a5c912fc75b5f738c49a023dbed5189
* libc: Fix 'index' symbol export.David 'Digit' Turner2014-06-164-35/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The C library didn't export the 'index' symbol, but its C++ name-mangling instead, which broke the ABI and prevented some applications from loading properly. The main reason was that the implementation under bionic/index.cpp relied on the declaration to specify that the function has C linkage. However, the declaration for index() was removed from both <string.h> and <strings.h> in a recent patch, which made the compiler think it was ok to compile the function with C++ linkage instead! This patch does the following: - Move index() definition to bionic/ndk_cruft.cpp and ensure it uses C linkage. Note that this removes index() from the 64-bit library entirely, this is intentional and will break source compatibility. Simply replacing an index() call with the equivalent strchr() should be enough to fix this in third-party code. - Remove bionic/index.cpp from the tree and build files. - Remove x86 assembly implementation from arch-x86/ to avoid conflict with the one in ndk_cruft.cpp BUG=15606653 Change-Id: I816b589f69c8f8a6511f6be6195d20cf1c4e8123
* Merge "Remove ioprio_get(2) and ioprio_set(2) from LP64."Dan Albert2014-06-122-57/+0
|\
| * Remove ioprio_get(2) and ioprio_set(2) from LP64.Dan Albert2014-06-122-57/+0
| | | | | | | | | | Bug: 11156955 Change-Id: I07b596d85e4bd6347d488d1a92c8d0a00b5ef3b3
* | Remove __memcmp16 from bionic.Elliott Hughes2014-06-124-41/+0
|/ | | | Change-Id: I2486d667d96c8900dd368d855f37c1327161efb7
* Remove declaration for putw(3)/getw(3).Dan Albert2014-06-111-0/+1
| | | | | | | | | These were both removed from POSIX 2004, and we don't define an implementation for getw(3). Keep the definition of put(3) on LP32 for binary compatibility. Bug: 13935372 Change-Id: Iba384b45093ac6d2d7c2d81f7980cd7701dd6f56
* Merge "Replaces vfork() implementation with fork()"Dan Albert2014-06-102-45/+0
|\
| * Replaces vfork() implementation with fork()Dan Albert2014-06-102-45/+0
| | | | | | | | | | | | | | | | vfork() was removed from POSIX 2008, so this replaces its implementation with a call to fork(). Bug: 13935372 Change-Id: I6d99ac9e52a2efc5ee9bda1cab908774b830cedc
* | Merge "Rename __bionic_clone_entry to __start_thread."Elliott Hughes2014-06-061-1/+1
|\ \
| * | Rename __bionic_clone_entry to __start_thread.Elliott Hughes2014-06-061-1/+1
| |/ | | | | | | | | | | This seems a bit less obscure. Change-Id: I7dc528c253b73c861694f67556ad8f919bf92136
* | Remove getdents from bionic.Elliott Hughes2014-06-061-2/+2
|/ | | | | Bug: 11156955 Change-Id: I6c306989801be552d85fba8a50dcdc79282fb9d2
* Remove unnecessary instructions from x86/x86_64 syscalls.Elliott Hughes2014-06-05195-196/+1
| | | | | | | | __set_errno returns -1 exactly so that callers don't need to bother. The other architectures were already taking advantage of this, but no one had ever fixed x86 and x86_64. Change-Id: Ie131494be664f6c4a1bbf8c61bbbed58eac56122
* Merge "Fix unwinding through x86-64 __bionic_clone."Elliott Hughes2014-06-051-3/+3
|\
| * Fix unwinding through x86-64 __bionic_clone.Elliott Hughes2014-06-051-3/+3
| | | | | | | | | | | | | | | | | | x86-64 needs these CFI directives to stop unwinding here. I've also cleaned up the assembler a little, and made x86 and x86-64 a little more alike. Bug: 15195760 Change-Id: I40f92c007843c29c933bb6876fe2b4611e1b946b
* | Fix for slm-tuned memmove (both 32- and 64-bit).Varvara Rainchik2014-06-051-233/+102
|/ | | | | | | | Introduce a test for memmove that catches a fault. Fix both 32- and 64-bit versions of slm-tuned memmove. Change-Id: Ib416def2610a0972e32c3b9b6055b54967643dc3 Signed-off-by: Varvara Rainchik <varvara.rainchik@intel.com>
* Avoid a system call in 'gettid'.Elliott Hughes2014-06-021-17/+0
| | | | | | | | | | | | | System calls can be pretty slow. This is mako, which has one of our lowest latencies: iterations ns/op BM_unistd_getpid 10000000 209 BM_unistd_gettid 200000000 8 Bug: 15297299 (kernel panic from too many gettid calls) Bug: 15315766 (excessive gettid overhead in liblogd) Change-Id: I49656c0fc5b5d092390264a59e4f2c0d8a8b1aeb
* x86: stop unwinding past __bionic_clone.Elliott Hughes2014-05-301-0/+2
| | | | | | | | The apparent "previous" frame is on another thread's stack. Bug: 14270816 Bug: 15195760 Change-Id: I884f370e116203c5fa3b05a75fb8f356537261c4
* Fix x86 cfi directives for syscalls.Christopher Ferris2014-05-29184-567/+865
| | | | | | | | The syscall generation always used 4 bytes for each push cfi directive. However, the first push should always use an offset of 8 bytes, each subsequent push after that is only 4 bytes though. Change-Id: Ibaabd107f399ef67010b9a08213783957c2f74a9
* Merge "Revert "Revert "Lose the hand-written futex assembler."""Elliott Hughes2014-05-293-59/+0
|\
| * Revert "Revert "Lose the hand-written futex assembler.""Elliott Hughes2014-05-283-59/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem with the original patch was that using syscall(3) means that errno can be set, but pthread_create(3) was abusing the TLS errno slot as a pthread_mutex_t for the thread startup handshake. There was also a mistake in the check for syscall failures --- it should have checked against -1 instead of 0 (not just because that's the default idiom, but also here because futex(2) can legitimately return values > 0). This patch stops abusing the TLS errno slot and adds a pthread_mutex_t to pthread_internal_t instead. (Note that for LP64 sizeof(pthread_mutex_t) > sizeof(uintptr_t), so we could potentially clobber other TLS slots too.) I've also rewritten the LP32 compatibility stubs to directly reuse the code from the .h file. This reverts commit 75c55ff84ebfa686c7ae2cc8ee431c6a33bd46b4. Bug: 15195455 Change-Id: I6ffb13e5cf6a35d8f59f692d94192aae9ab4593d
* | Merge "Add optimized AArch64 versions of bcopy and wmemmove based on memmove"Christopher Ferris2014-05-281-0/+1
|\ \ | |/ |/|
| * Add optimized AArch64 versions of bcopy and wmemmove based on memmoveBernhard Rosenkraenzer2014-05-231-0/+1
| | | | | | | | | | | | | | | | Add optimized versions of bcopy and wmemmove for AArch64 based on the memmove implementation Change-Id: I82fbe8a7221ce224c567ffcfed7a94a53640fca8 Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
| * Revert "Add optimized AArch64 versions of bcopy and wmemmove based on memmove"Christopher Ferris2014-05-241-1/+0
| | | | | | | | | | | | | | | | This reverts commit 8167dd7cb98e87ffe9b40e4993c330b244ca2234. For some reason I thought the bcopy change was bzero. The bcopy code doesn't pass our tests, so reverting until I can figure out what's wrong. Change-Id: Id89fe959ea5105cd58dff6bba8d91a30cc4bcb07
| * Add optimized AArch64 versions of bcopy and wmemmove based on memmoveBernhard Rosenkraenzer2014-05-231-0/+1
| | | | | | | | | | | | | | | | Add optimized versions of bcopy and wmemmove for AArch64 based on the memmove implementation Change-Id: Ie43d0ff4f8ec4edba5b4fb5ccacd941f81ac6557 Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
* | Revert "Lose the hand-written futex assembler."Narayan Kamath2014-05-283-0/+59
|/ | | | | | | | | | This reverts commit ced906c849704f379d7191822f6d74993d4fa296. Causes issues on art / dalvik due to a broken return value check and other undiagnosed issues. bug: 15195455 Change-Id: I5d6bbb389ecefb0e33a5237421a9d56d32a9317c
* Lose the hand-written futex assembler.Elliott Hughes2014-05-223-59/+0
| | | | | | | Also stop exporting 'futex'. Bug: 12250341 Change-Id: Icc4fa4296cd04dfe0d1061822c69e2eb40c3433a
* Remove the tkill(2) stub.Elliott Hughes2014-05-221-26/+0
| | | | | | | | | glibc doesn't have tkill or tgkill and says "use syscall(3) instead". I've left tgkill since it's quite widely used, but there's no reason to have tkill as well. Bug: 11156955 Change-Id: Ifc0af750320086f829bc9914551c172b501f3b60
* Hide most of the private futex functions.Elliott Hughes2014-05-211-43/+1
| | | | | | | | | | Also hide part of the system properties compatibility code, since we needed to touch that to keep it building. I'll remove __futex_syscall4 and futex in a later patch. Bug: 11156955 Change-Id: Ibbf42414c5bb07fb9f1c4a169922844778e4eeae
* Merge "Remove __syslog; we have the public klogctl API."Elliott Hughes2014-05-211-30/+0
|\
| * Remove __syslog; we have the public klogctl API.Elliott Hughes2014-05-201-30/+0
| | | | | | | | | | Bug: 11156955 Change-Id: I5c2cc02f39f76dd32984135f5c12c10bf2853796
* | Merge "Hide __get_sp."Elliott Hughes2014-05-211-1/+1
|\ \