summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads/sysdeps
AgeCommit message (Collapse)Author
2022-07-20linuxthreads/arm: fix ldrex/strex loop when built with O0Vladimir Murzin
O0 build result in the following codegen 00000000 <ldrex>: 0: b480 push {r7} 2: b085 sub sp, #20 4: af00 add r7, sp, #0 6: 6078 str r0, [r7, #4] 8: 687b ldr r3, [r7, #4] a: e853 3f00 ldrex r3, [r3] e: 60fb str r3, [r7, #12] 10: 68fb ldr r3, [r7, #12] 12: 4618 mov r0, r3 14: 3714 adds r7, #20 16: 46bd mov sp, r7 18: f85d 7b04 ldr.w r7, [sp], #4 1c: 4770 bx lr 0000001e <strex>: 1e: b480 push {r7} 20: b085 sub sp, #20 22: af00 add r7, sp, #0 24: 6078 str r0, [r7, #4] 26: 6039 str r1, [r7, #0] 28: 687b ldr r3, [r7, #4] 2a: 683a ldr r2, [r7, #0] 2c: e842 3300 strex r3, r3, [r2] 30: 60fb str r3, [r7, #12] 32: 68fb ldr r3, [r7, #12] 34: 4618 mov r0, r3 36: 3714 adds r7, #20 38: 46bd mov sp, r7 3a: f85d 7b04 ldr.w r7, [sp], #4 3e: 4770 bx lr 00000040 <testandset>: 40: b590 push {r4, r7, lr} 42: b083 sub sp, #12 44: af00 add r7, sp, #0 46: 6078 str r0, [r7, #4] 48: 6878 ldr r0, [r7, #4] 4a: f7ff fffe bl 0 <ldrex> 4e: 4603 mov r3, r0 50: 461c mov r4, r3 52: 6879 ldr r1, [r7, #4] 54: 2001 movs r0, #1 56: f7ff fffe bl 1e <strex> 5a: 4603 mov r3, r0 5c: 2b00 cmp r3, #0 5e: d1f3 bne.n 48 <testandset+0x8> 60: 4623 mov r3, r4 62: 4618 mov r0, r3 64: 370c adds r7, #12 66: 46bd mov sp, r7 68: bd90 pop {r4, r7, pc} ARM ARM suggests that LoadExcl/StoreExcl loops are guaranteed to make forward progress only if, for any LoadExcl/StoreExcl loop within a single thread of execution, the software meets all of the following conditions: 1 Between the Load-Exclusive and the Store-Exclusive, there are no explicit memory accesses, preloads, direct or indirect System register writes, address translation instructions, cache or TLB maintenance instructions, exception generating instructions, exception returns, or indirect branches. ... Obviously condition is not met for O0 builds. O2 build (which is highly likely the most common setting) able to do the right thing resulting in 00000000 <ldrex>: 0: e850 0f00 ldrex r0, [r0] 4: 4770 bx lr 6: bf00 nop 00000008 <strex>: 8: e841 0000 strex r0, r0, [r1] c: 4770 bx lr e: bf00 nop 00000010 <testandset>: 10: 2101 movs r1, #1 12: 4603 mov r3, r0 14: e853 0f00 ldrex r0, [r3] 18: e843 1200 strex r2, r1, [r3] 1c: 2a00 cmp r2, #0 1e: d1f9 bne.n 14 <testandset+0x4> 20: 4770 bx lr 22: bf00 nop Rather than depending on level of optimisation implement whole ldrex/strex loop in inline assembly. Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
2020-08-11xtensa: add exclusive access supportMax Filippov
Add XCHAL definitions for S32C1I and EXCLUSIVE options to xtensa-config.h, include it in places that implement atomic operations and add implementations with exclusive access option opcodes. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2020-08-11xtensa: relax memory constraint in atomic assemblyMax Filippov
Replace "a" constraints with "+m" to avoid forcing atomic variable address into a register and let the compiler use non-zero offset in load/store opcodes. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-04-22linuxthreads: implement pthread_condattr_{s,g}etclock()Waldemar Brodkorb
More applications are using pthread_condattr_setclock()/ pthread_condattr_getclock() in their code. Port these two functions from NPTL over to be more compatible.
2017-04-16or1k: silence gcc warningsWaldemar Brodkorb
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2017-01-22nds32: add NPTL/TLS, *context function, libm changes and code cleanupVincent Ren-Wei Chen
This commit includes following features. 1. Support NPTL/TLS 2. Add libm function which is used to handle FP rounding and excpetions (ex: fclrexcpt,fedisblxcpti,feenablxcpt... ) 3. Add *context function for operating user context (ex: setcontext,getcontext,makecontext... ) 4. Change the return flow from signal handler 5. Cleanup of old code The testsuite only has 2 errors, tst-cpuclock1 and tst-cputimer1, which are related to timing accuracy. (math and locale tests are disabled) Signed-off-by: Vincent Ren-Wei Chen <vincentc@andestech.com>
2016-11-30NONTLS_INIT_TP is never defined, remove dead codeWaldemar Brodkorb
2016-11-17libpthread: remove pthread_atfork for noMMU targetRomain Naour
There is not possible to use use fork() on noMMU target, so exporting pthread_atfork() for such target is useless. A program using pthread_atfork() will likely fail at runtime due to the error code returned by this function. Signed-off-by: Romain Naour <romain.naour@gmail.com>
2016-10-24linuxthreads: add back signal.hWaldemar Brodkorb
Somehow this got removed with f1d7505e40654a185843bdc8f1cf1fd00ab55c04. Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-09-26use a single libc and deduplicate threading codeWaldemar Brodkorb
Similar to musl libc a single libc has many benefits and solves some open issues with uClibc-ng. - no pthread_mutex_* weak symbols exported anymore - applications no longer failing to link when either -lrt or -lpthread are missing for dynamic and static linking mode - smaller C library - slightly better runtime performance
2016-09-19linuxthreads: Fix up pthread.h for XPG7.Leonid Lisovskiy
[ glibc commit d3c7e68655 ] Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
2016-06-30nds32: add support for new architectureWaldemar Brodkorb
Add support for Andes Technology NDS32 architecture. See here http://www.andestech.com/en/index/index.htm for more informaton. Verification of the port from an older uClibc port was done on a sponsored AG101p board. The testsuite only has 5 errors, three are related to an existing bug in dlclose() with LT.old, also happening on cris32 and m68k. Failures to fallocate/posix_fallocate are unresolved. Thanks to Andes Technology sponsoring the hardware and being very helpful while doing the uClibc-ng porting. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-05-24microblaze: fix linuxthreads supportWaldemar Brodkorb
Got the working code from https://github.com/jdkoftinoff/mb-linux-msli/, otherwise SIGILL while using linuxthreads.
2016-05-18remove linuxthreads.new, rename linuxthreads.oldWaldemar Brodkorb
Linuxthreads.new isn't really useful with the existence of NPTL/TLS for well supported architectures. There is no reason to use LT.new for ARM/MIPS or other architectures supporting NPTL/TLS. It is not available for noMMU architectures like Blackfin or FR-V. To simplify the live of the few uClibc-ng developers, LT.new is removed and LT.old is renamed to LT. LINUXTHREADS_OLD -> UCLIBC_HAS_LINUXTHREADS
2016-04-15replace FSF addresses with URLsNikola Forró
License notices in most of the source files refer to an outdated FSF address. Replace it with URL, like in the rest of the source files.Signed-off-by: Nikola Forró <nforro@redhat.com>
2015-10-09add new architecture support for or1kWaldemar Brodkorb
Information about Openrisc: http://opencores.org/or1k/Main_Page Integrated from: https://github.com/openrisc/uClibc-or1k
2015-03-29merge uClibc git masterWaldemar Brodkorb
2015-03-13unistd.h: put getppid under XOPEN2K8Bernhard Reutner-Fischer
Add __LEAF to all __THROW, introduce non-leaf __THROWNL Adjust affected spots accordingly. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-14Revert "resolve merge"Waldemar Brodkorb
This reverts commit 6b6ede3d15f04fe825cfa9f697507457e3640344.
2015-02-14resolve mergeWaldemar Brodkorb
2014-10-03m68k: fix linuxthreads compile for coldfireWaldemar Brodkorb
The tas instruction is not available for most coldfire CPU's. Use bset instead in this case as already used in linuxthreads.old.
2014-09-20linuxthreads: remove unused s390 codeWaldemar Brodkorb
Cleanup linuxthreads by removing unused s390 code. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2014-09-04sparc: remove sparc64/sparcv9 codeWaldemar Brodkorb
The sparc64/sparcv9 code is incomplete. Furthermore there is no real embedded hardware for sparc64 available, so better remove it until someone comes up with a complete port. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-13LT{,.old}: include stddef.h for size_tVineet Gupta
A user application built with -D_POSIX_C_SOURCE=200112L and #include signal.h, yields following compilation error: ------------------->8----------------------------- arc-linux-uclibc-gcc -D_POSIX_C_SOURCE=200112L hello.c In file included from /opt/INSTALL/lib/gcc/arc-linux-uclibc/4.4.7/../../../../arc-linux-uclibc/sys-include/signal.h:429, from hello.c:1: /opt/INSTALL/lib/gcc/arc-linux-uclibc/4.4.7/../../../../arc-linux-uclibc/sys-include/bits/pthreadtypes.h:48: error: expected specifier-qualifier-list before 'size_t' ------------------->8----------------------------- The fix is to make sure size_t is explicitly provided to pthreadtype.h Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-07libpthread: Remove useless .cvsignore filesMarkos Chandras
Signed-off-by: Markos Chandras <hwoarang@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20not-cancel.h: Use openat if arch does not have the open syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-11-18drop support for pre ISO-C compilersMike Frysinger
This drops __signed, __volatile, and __const. Only the latter was used in the code base, and for uClibc, not consistently. Much of the code used plain "const" which meant "__const" was useless. Really, the point of this is to stay in sync with what glibc did. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18Replace FSF snail mail address with URLsMike Frysinger
This matches a similar change made to glibc. No functional changes here. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-06-15remove arm specific sysdep.h from linuxthreads newPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15linuxthreads: guard *tsd* related stuff correctlyPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15linuxthreads: use __UCLIBC_HAS_TLS__ consistentlyPeter S. Mazinger
replace USE_TLS, HAVE___THREAD and USE___THREAD with __UCLIBC_HAS_TLS__ Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15move __libc_pthread_init prototype to pthread-functions.hPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15jmp-unwind.c: add hidden _longjmp_unwindPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15allocrtsig.c,pthread.c: disable __libc_allocate_rtsig, unusedPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15signal.h: disable ssignal and gsignalPeter S. Mazinger
raise.c: only LT new provided gsignal, disable it Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15cleanup fork()Peter S. Mazinger
Keep only fork (and it's hidden variant) and __libc_fork. Common __libc_fork prototype in unistd.h. Get rid of __fork, by changing HIDDEN_JUMPTARGET(__fork) to use fork I can't see the reason to have fork() in libpthread, but kept it for now making __fork static in these files. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15move *longjmp related prototypes to setjmp.hPeter S. Mazinger
Provide common prototypes for __longjmp, __libc_longjmp, __libc_siglongjmp _longjmp_unwind, __libc_unwind_longjmp in setjmp.h in preparation for use in LT new Add __longjmp to h8300 and i960 Make common longjmp.c good for NPTL Guard _longjmp_unwind use in sh's longjmp.c for NPTL (I think sh could use the common one) Remove unneeded attribute_noreturn, prototype provides it already Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-06MIPS: Convert __syscall_error() callers to use $a0 for argumentKevin Cernekee
Some callers passed the first argument in $v0, while others used $a0. Change the callers to use $a0 consistently. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-10-27mips: fix errno setting after syscallAlexander Gordeev
If there was an error during syscall then after it's completion a3 register holds a non-zero value and v0 holds an actual error code which should be saved in errno. This can be achieved by calling __syscall_error with the value from v0 as a parameter. So this value should be stored in a0, but the appropriate assembly instructions are missing. Fixed this now by adding "move a0, v0". I think it was once fixed by 58c5f8ba4cdf62342d05a546d15404cbbb3c4e07 but then something went wrong. Again... Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-04-25enable building __fcntl_nocancel, as it used unconditionally nowAustin Foxley
also sync up not-cancel.h headers between all three thread libraries Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-12-16build: Get rids of PIC macro using compiler flag __PIC__ insteadCarmelo Amoroso
Based on Peter Mazinger's comments on a recent commit, I decided to get rids of all occurrences of PIC changing them to __PIC__ Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2009-09-19sigwait: remove __sigwait and __GI_sigwait symbols - they are unusedDenys Vlasenko
sigwait is not called from any uclibc function, so "hidden symbol" trick is not needed on it. __sigwait also is never used, and it's not clear why it even existed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-05CLOEXEC: use open(CLOEXEC) if exist; do not check fcntl(FD_CLOEXEC) failureDenys Vlasenko
text data bss dec hex filename - 370 0 0 370 172 libc/misc/dirent/opendir.o + 366 0 0 366 16e libc/misc/dirent/opendir.o - 375 4 0 379 17b libc/pwd_grp/lckpwdf.o + 356 4 0 360 168 libc/pwd_grp/lckpwdf.o - 248 0 0 248 f8 librt/shm.o + 209 0 0 209 d1 librt/shm.o Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-21fix compilation of linuxthreads for sparc64Austin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-03-18fix compilation of linuxthreads for sparcaustinf
add myself to MAINTAINERS for sparc
2009-03-12add linuxthreads support for arm. By Will Newton (will.newton AT gmail.com)Denis Vlasenko
2009-03-12linuxthreads fixes from Will Newton (will.newton AT gmail.com):Denis Vlasenko
* share Sys V semaphores in order to get appropriate SEM_UNDO semantics. * correct guardaddr in pthread_free() for TLS case * move spinlock unlocking before restart() * When exit was called from a signal handler, the restart from the manager processing the exit request instead restarted the thread in pthread_cond_timedwait. (see http://sources.redhat.com/ml/libc-ports/2006-05/msg00000.html)
2009-01-28Added sysdep.h and sysdep-cancel.h for linuxthreads ARMCarmelo Amoroso
Signed-off-by: Will Wagner <will_wagner@carallon.com>
2009-01-21- commentary typo fixBernhard Reutner-Fischer
2008-12-29- pthread_attr_{g,s}etstacksize would depend on SUSv3 legacy but are notBernhard Reutner-Fischer
implemented anyway.