summaryrefslogtreecommitdiff
path: root/libc/sysdeps
AgeCommit message (Collapse)Author
2014-02-02mips: silence 'set but not used' warningsSteve Ellcey
This patch uses 'attribute_unused' to clean up a number of warnings messages that are generated when doing a MIPS build. All of the changes are in MIPS specific files and there are no code changes other then adding the unused attribute where needed. Signed-off-by: Steve Ellcey <sellcey@mips.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-02-02libc: mips: Fix non-LFS buildSteve Ellcey
The MIPS build is failing when UCLIBC_HAS_LFS is set to "n" because posix_fadvise64.c is included in the build when it should not be. Signed-off-by: Steve Ellcey <sellcey@mips.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-24mips: silence _ABI* undef warningsBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-22powerpc: syscall support up to 6 argumentsBernhard Reutner-Fischer
As reported by Kristof Provost. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-22vfork: fix clone based versionStefan Kristiansson
The clone based version was introduced by commit 58570fc8e1fd601f15be5758ab95013d56771804 vfork: Use clone if arch does not have the vfork syscall but the code was made unreachable by the previous commit 0a043c30ee71245dfe7c9d82d654312c5e1f6127 vfork: make all archs consistent that adds a guard which require either __NR_vfork or __NR_fork to be set. Neither will be set on an arch that would need to use the clone based version. The double declaration of vfork was also introduced by the merge of the two above mentioned patches. The missing ; was present in the original patch. CC: Markos Chandras <markos.chandras@imgtec.com> CC: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> CC: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-22libc: fix MIPS N64 forkWaldemar Brodkorb
fork() is broken for MIPS64 N64 ABI. You can check it with a simple C program statically linked with qemu-mips64 user emulation. Internally fork() is using the clone system call (at least with NPTL) with 5 arguments. See ./libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c. The calling conventions for MIPS N32 and N64 allow to use up to 8 registers for that. See http://en.wikipedia.org/wiki/Calling_convention#MIPS This is correctly implemented in libc/sysdeps/linux/mips/bits/syscalls.h, but not in libc/sysdeps/linux/mips/sysdep.h. fork.c uses the later one. It seems that fork() works fine for MIPS64 N32 with just using the stack like with the O32 case. There is a user of INLINE_SYSCALL with 7 arguments in libc/sysdeps/linux/common/sync_file_range.c for MIPS64 N32, so I decided to only use the macros for the MIPS64 N64 case. With this patch my uClibc based Linux system boots up fine in qemu-system-mips64. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-15libc: add guard for arm thumb2 asmBernhard Reutner-Fischer
Fixes gen_lowlevelrobustlock on thumb2 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08ARC: opencode ENTRY/END macros in crt1Vineet Gupta
crt1.S -> include sysdep.h -> include sysnum.h In multistage gcc build, Buildroot happens to build crt1.S before sysnum.h is generated. So break the above include chain and opencode the ENTRY/END macros. Reported-by: Anton Kolesov <akolesov@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08xtensa: use common ptrace.hBaruch Siach
Adds support for architecture independent actions. Cc: Chris Zankel <chris@zankel.net> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08libc: posix_fadvise: restore implementation for xtensaBaruch Siach
Commit ee84b8b400 (linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT) removed posix_fadvise implementation for xtensa, since xtensa does not define __NR_fadvise64. Reuse the ARM support code to restore xtensa support. This commit is based Mike Frysinger's suggested patch. Cc: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08siginfo.h: __SIGEV_PAD_SIZE takes __WORDSIZE into accountVicente Olivert Riera
Make __SIGEV_PAD_SIZE to take __WORDSIZE into account for alpha, mips and ia64 arches. Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-01-08siginfo.h: add a missing function member on ia64, mips and sparc archesVicente Olivert Riera
Add "__pid_t _tid" member which is used for some packages, like rt-test for instance, which fails with an error like this one: src/cyclictest/cyclictest.c:638:9: error: 'union <anonymous>' has no member named '_tid' Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20libc/sysdeps: commonize ret_ERRVALBaruch Siach
* Add a common ret_ERRVAL definition * Remove ret_ERRVAL from architectures using the common 'ret' * Add 'undef' to architectures that need a different return instruction * Add '#include <common/sysdep.h>' to cris and ia64 that were missing it Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20ARC port to uClibcVineet Gupta
For this port, I would like to give due credit to: - Folks from Codito technologies (Sameer, Amit, Kanika, Ramana,...) who did the very first port - ARC UK from 2007-2009 (Joern, Irfan, Khurram, Phil... - Late Brendan Kehoe (may he RIP) Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06prctl: fix system call wrapperBaruch Siach
The argument names used in the prctl wrapper collide with the internal variable names in syscall wrapper macros on some architecture. This currently breaks xtensa. grep for '\b_a[0-9]' indicates that metag and microblaze might also be affected. Prefix argument names with '_prctl' to avoid collision. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06add posix_fadvise() for armKhem Raj
arm call to posix_fadvise simply calls posix_fadvise64 Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06libc/metag: add __kernel_long_t and __kernel_ulong_tMarkos Chandras
Add __kernel_long_t and __kernel_ulong_t types for Meta. The rest of the architectures have been fixed in: 6a76edddaa62ff06f178143b582167734cb55c18 "libc/sysdeps: add __kernel_long and __kernel_ulong" Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06Fix weak/strong attribute of __errno_location and it's __GI aliasVineet Gupta
A simple statically linked hello world program was segfaulting for ARC in linuxthreads.old configuration (although the root casue applies cross-arch for NPTL as well as linuxthreads.old as described) The crash was due to branch to NULL in _stdio_init 0001026c <_stdio_init>: 1026c: push_s blink 1026e: st.a r13,[sp,-8] 10272: bl.d 0 --> supposed call to __errno_location The call was NOT getting patched to libc internal only alias __GI___errno_location, because it was weak while it's exported cousin, __errno_location was strong/normal. arc-linux-uclibc-nm libc/misc/internals/__errno_location.os 00000000 W __GI___errno_location 00000000 T __errno_location This is exactly opposite to what is expected. Quoting Peter S. Mazinger, commit 87936cd013041 "errno and *_init cleanup" | The rule adopted: | for enabled threads we make in libc the __GI_x() variants strong, x() weak | and (should) provide another strong x() in libpthread. | If threads are disabled, even the __GI_x() variants are weak. With the fix, we see the right settings as below 00000000 T __GI___errno_location 00000000 W __errno_location Note that problem won't show up in a static busybox build as it references errno and that seems to elide the issue. I can confirm the same/more issues with latest ARM buildroot builds w/o my fix. (1). linuxthreads.old (broken just like ARC) arm-linux-nm uclibc-snapshot/libc/misc/internals/__errno_location.os 00000000 W __GI___errno_location 00000000 T __errno_location But presumably the issue there is NOT catestrophic because ARM linker is likely smarter and patches a NOP instead of NULL branch. 00008388 <_stdio_init>: 8388: e92d4038 push {r3, r4, r5, lr} 838c: e320f000 nop {0} (2) NPTL build (exported version is not weak) 00000000 T __GI___errno_location 00000000 T __errno_location This causes a static link with libpthread and test program referencing errno to fail to link. #include <errno.h> int main(void) { printf("%d\n", errno); } arm-linux-gcc -static -pthread -o tst tst.o arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__errno_location.os): In function `__errno_location': __errno_location.c:(.text+0x0): multiple definition of `__errno_location' arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpthread.a (errno_location.os):errno_location.c:(.text+0x0): first defined here Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-04xtensa: fix atomic_decrement_if_positive() return valueBaruch Siach
atomic_decrement_if_positive() returns the old value of &mem, not the (sometimes undefined) value of __tmp. Fixes the uClibc nptl/tst-sem3 test. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Chris Zankel <chris@zankel.net>
2013-11-04xtensa: fix layout of struct sigcontext to match the kernelBaruch Siach
Current code breaks libgcc unwind. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Chris Zankel <chris@zankel.net>
2013-07-26libc/sysdeps: Fix common-generic stat.h for BE part 2Mischa Jonker
Previous patch only fixed the build. This patch fixes the behavior at run-time as well. It fixes "Value too large for defined data type" messages caused by fstat syscall wrapper returning -EOVERFLOW. Signed-off-by: Mischa Jonker <Mischa.Jonker@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-18bits/waitstatus.h: correctly interpret status 0x007f on MIPSDenys Vlasenko
On other architectures exit status of 0x007f is not possible, they don't have signal 127. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-04C6X: Remove DSBT in favour of FDPICLuis Machado
Sync up with the changes from C6X entering the kernel. Signed-off-by: Luis Machado <lgustavo@codesourcery.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-04libc/sysdeps/linux/common/sendfile.c: fix sendfile64 visibilityAnthony G. Basile
Commit a83ea57a50 introduces code for falling back on sendfile64 when the sendfile syscall is not available. However, as written, that code leads to sendfile64 being globally hidden in situations where __NR_sendfile and __USE_LARGEFILE64 are defined. In this case, the flow executes strong_alias_untyped(sendfile,sendfile64) in libc/sysdeps/linux/common/sendfile.c and libc_hidden_proto(sendfile64) in include/sys/sendfile.h, but nowhere does it do libc_hidden_def(sendfile64). This patch adds the needed libc_hidden_def(sendfile64). This breaks, for example, xfsprogs on x86_64. Reported by mardok4 in IRC. Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-29i386/sysdep.h: Remove STABS_* macrosKhem Raj
uclibc is compiled with elf/dwarf and secondly HAVE_CPP_ASM_DEBUGINFO is not defined so we generate bogus .stab sections needlessly Some of post processing tools get confused when they see both dwarf and stab sections Signed-off-by: Khem Raj <raj.khem@gmail.com>
2013-06-28MIPS: set _NSIG to 128, not 129. This matches glibc.Denys Vlasenko
Prompted by lkml discussion of a MIPS bug where sending signal 128 was found to be able to crash the machine :/ Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-07eventfd.h: Use new "bits/" scheme for arch-specific flagsHiroaki KAWAI
As in timerfd.h, eventfd.h needs arch-specific definition files. alpha, mips and sparc needs separate file, all the other arch will use common definition. This problem is already fixed in glibc. Also sanitize and provide bits for hppa. Make sure not to install the new bits/eventfd unless eventfd support is enabled. Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-07linux: pread/write: fix 64bit handlingMike Frysinger
The syscall on 64bit ports takes 4 args as there is no need to split up the value into two args. Add support for that to the common code. Once we fix that, the mips code can now leverage it for its 64bit and 32bit needs. However, we can't just drop it entirely yet because its n32 ABI needs special handling to treat it like a 64bit port. This does change the existing behavior which treats the n32 like a 32bit port, but we want to do this. In the future, we'll probably have to introduce a define for this as it currently affects x86_64/x32 and mips/n32. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01linux: pread/write: convert to SYSCALL_ALIGN_64BITMike Frysinger
The pread64/write64 syscalls have the 64bit register align issue for all arches. Use this new define so we can merge the powerc/xtensa versions back into the common code. SuperH is funky and also allows us to do this. We should be able to merge the mips version too, but that'll require someone to take a closer look as the current stuff doesn't look quite right. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01linux: readahead: convert to SYSCALL_ALIGN_64BITMike Frysinger
The readahead syscall has the 64bit register align issue for all arches. Only mips was handling this though. Clean up the common readahead.c to use the SYSCALL_ALIGN_64BIT define so that we can throw away the mips version and make this work correctly on arm/ppc/xtensa. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01linux: posix_fadvise: use new SYSCALL_ALIGN_64BITMike Frysinger
Now that we have a new SYSCALL_ALIGN_64BIT define for tracking the 64bit register shift behavior, use it. This allows us to delete duplicated arm/xtensa files, as well as drop a few arch ifdefs from common code. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01linux: use OFF64_HI_LO rather than __LONG_LONG_PAIRMike Frysinger
This macro takes care of the shift/mask split for us, so no need to open code this ourselves and then use __LONG_LONG_PAIR. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01mips: only define SYSCALL_ALIGN_64BIT for O32 ABIsMike Frysinger
The 64bit register alignment issue only affects the O32 ABI, so wrap the define accordingly. We don't want this being used for N32 ABIs. This doesn't directly affect the N64 ABI since these files wouldn't even be compiled for those targets (no need for the 32bit/64bit shim). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-01libc: rename TRUNCATE64_HAS_4_ARGS to SYSCALL_ALIGN_64BITMike Frysinger
The reason truncate64 takes 4 args on some arches is that their ABI requires 64bit values to be aligned on register pair boundaries. Since this alignment affects more than just truncate64, rename the define to properly document its purpose. This also allows us to expand it to the other impacted syscalls (which will be done in a follow up commit). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-03-22libc: Fix common-generic stat.h for BEMischa Jonker
Signed-off-by: Mischa Jonker <mjonker@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14libc: switch several users to unlikely()Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14metag: Add NPTL supportMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14libm: Add support for the Meta architectureMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14Add support for the Meta architectureMarkos Chandras
Meta cores are 32-bit, hardware multithreaded, general purpose, embedded processors which also feature a DSP instruction set, and can be found in many digital radios. They are capable of running different operating systems on different hardware threads, for example a digital radio might run RTOSes for DAB decoding and audio decoding on 3 hardware threads, and run Linux on the 4th hardware thread to manage the user interface, networking etc. HTPs are also capable of running SMP Linux on multiple hardware threads. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14fstat64: Fix Build warnings with common-generic ABI buildVineet Gupta
CC libc/sysdeps/linux/common/fstat64.os In file included from libc/sysdeps/linux/common/fstat64.c:16: libc/sysdeps/linux/common/xstatconv.h:28: warning: 'struct kernel_stat' declared inside parameter list libc/sysdeps/linux/common/xstatconv.h:28: warning: its scope is only this definition or declaration, which is probably not what you want libc/sysdeps/linux/common/fstat64.c: In function 'fstat64': libc/sysdeps/linux/common/fstat64.c:33: warning: passing argument 2 of '__syscall_fstat64' from incompatible pointer type libc/sysdeps/linux/common/fstat64.c:18: note: expected 'struct stat *' but argument is of type 'struct stat64 *' ------------------------------------------------------------------- Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14leek: if lseek syscall is not available, use lseek64 even for !LFSVineet Gupta
With Busybox and uClibc - both built w/o LFS, this caused ash to be completely broken, as lseek was simply returning error. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14utimes: Export utimensat based utimesVineet Gupta
sys/time.h has libc_hidden_proto(utimes) which generates the hidden "__GI_utimes" symbol reference, and common/utimes.c has a libc_hidden_def(utimes) which generates the exported "utimes" alias. As part of no-legacy-syscall kernel ABI, Commit 80dc2ed05 "utimes: Use utimensat if arch does not have the utimes syscall" introduced a new wrapper, but missed the corresponding libc_hidden_def, causing Busybox (1.20.0) link to fail (for ARC). Also don't generate a STUB, in that case. ---------------->8------------------- .... touch.c:(.text.touch_main+0xdc): undefined reference to `utimes' touch.c:(.text.touch_main+0x114): undefined reference to `utimes' libbb/lib.a(copy_file.o): In function `copy_file': copy_file.c:(.text.copy_file+0x446): undefined reference to `utimes' collect2: ld returned 1 exit status ---------------->8------------------- Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-27libc/pause: Enable pause_nocancel for arches without __NR_pauseMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20nice: fix overflow checking in int_add_no_wrap()Xi Wang
In C, signed integer overflow is undefined behavior. Many compilers optimize away checks like `a + b < a'. Use safe precondition testing instead. Signed-off-by: Xi Wang <xi@mit.edu> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20open: 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>
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>
2013-02-20open64: 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>
2013-02-20fcntl: Use fcntl64 is arch does not have the fcntl syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20fstatfs: Add __libc_fstatfs wrapperMarkos Chandras
New architectures don't have fstatfs anymore, so we use a wrapper for __libc_fstatfs which will use fstatfs64 internally. The interface however needs to remain the same (i.e accepting a struct statfs as a second argument) for backwards compatibility Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20stat: Use fstatat64 if arch does not have the stat syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>