Age | Commit message (Collapse) | Author |
|
The return type of syscall() is long so __syscall_error, which is jumped
to by syscall handlers to stash an error number into errno, must return
long too otherwhise it returs 4294967295L instead of -1L. For example,
syscall for x86_64 is defined in libc/sysdeps/linux/x86_64/syscall.S as
syscall:
movq %rdi, %rax /* Syscall number -> rax. */
movq %rsi, %rdi /* shift arg1 - arg5. */
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %r10
movq %r9, %r8
movq 8(%rsp),%r9 /* arg6 is on the stack. */
syscall /* Do the system call. */
cmpq $-4095, %rax /* Check %rax for error. */
jae __syscall_error /* Branch forward if it failed. */
ret /* Return to caller. */
In libc/sysdeps/linux/x86_64/__syscall_error.c, __syscall_error is
defined as
int __syscall_error(void) attribute_hidden;
int __syscall_error(void)
{
register int err_no __asm__ ("%rcx");
__asm__ ("mov %rax, %rcx\n\t"
"neg %rcx");
__set_errno(err_no);
return -1;
}
So __syscall_error returns -1 as a 32-bit int in a 64-bit register, %rax
(0x00000000ffffffff, whose decimal value is decimal 4294967295) and a
test like this always returns false:
if (syscall(number, ...) == -1)
foo();
Fix the error by making __syscall_error return a long, like syscall().
The problem can be circumvented by the caller by coercing the returned
value to int before comparing it to -1:
if ((int) syscall(number, ...) == -1)
foo();
The same problem probably occurs on other 64-bit systems but so far only
x86_64 was tested, so this change must be considered experimental.
Signed-off-by: Carlos Santos <unixmania@gmail.com>
|
|
* ldso/ldso/arm/aeabi_read_tp.S: Add Thumb version.
* ldso/ldso/arm/dl-startup.h: Do not force ARM encoding, adjust
for Thumb.
* ldso/ldso/arm/resolve.S: Force Thumb encoding on Thumb-only
processors.
* libc/sysdeps/linux/arm/crt1.S: Do not force ARM encoding, adjust
for Thumb.
Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
|
|
Change clone.S so that in FDPIC case we take into account the fact
that we are given a function descriptor.
* libc/sysdeps/linux/arm/clone.S (__clone): Support __FDPIC__.
Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
|
|
Implements __gnu_Unwind_Find_got(), which is called from libgcc while
unwinding.
* libc/sysdeps/linux/arm/Makefile.arch (CSRC): Add find._got.c.
* libc/sysdeps/linux/arm/find_got.c: New file.
Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
|
|
* libc/sysdeps/linux/arm/crt1.S: Define _start for __FDPIC__.
Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
|
|
Add FDPIC dynamic relocations support, similar to what other FDPIC
targets do.
Lazy binding is implemented in a folllow-up patch.
Disable the SEND* macros because they involve relocations to
access constant strings that are unsupported by the existing
arm version.
Define DL_START, START, ARCH_NEEDS_BOOTSTRAP_RELOCS,
DL_CHECK_LIB_TYPE similarly to what other FDPIC targets do.
Define raise() because _dl_find_hash references __aeabi_uidivmod,
which uses __aeabi_idiv0 which in turn references raise.
* include/elf.h (R_ARM_FUNCDESC): Define.
(R_ARM_FUNCDESC_VALUE): Define.
* ldso/include/dl-string.h (SEND_STDERR, SEND_ADDRESS_STDERR)
(SEND_NUMBER_STDERR): Define empty for __FDPIC__.
* ldso/ldso/arm/dl-inlines.h: New file.
* ldso/ldso/arm/dl-startup.h (PERFORM_BOOTSTRAP_RELOC): Fix type
of load_addr. Fix handling of R_ARM_RELATIVE, add support for
R_ARM_FUNCDESC_VALUE.
(DL_START, START): Define for __FDPIC__.
(raise): Define.
* ldso/ldso/arm/dl-sysdep.h (ARCH_NEEDS_BOOTSTRAP_RELOCS): Define.
(DL_CHECK_LIB_TYPE): Define.
(elf_machine_type_class): Take into account FDPIC related
relocations.
(elf_machine_load_address): Support __FDPIC__.
(elf_machine_relative): Likewise.
* ldso/ldso/arm/elfinterp.c (_dl_linux_resolver): Dummy support
for __FDPIC__, implemented in a later patch.
(_dl_do_reloc): Fix reloc_adr computation for __FDPIC__, fix
handling of local symbols. Fix handling of R_ARM_RELATIVE, add
support for R_ARM_FUNCDESC_VALUE, R_ARM_FUNCDESC.
* ldso/ldso/arm/resolve.S: Make _dl_linux_resolve hidden.
* ldso/ldso/fdpic/dl-inlines.h (htab_delete): Declare.
* libc/sysdeps/linux/arm/bits/elf-fdpic.h: New file, similar to bfin's.
* libc/sysdeps/linux/arm/crtreloc.c: Likewise.
* libc/sysdeps/linux/arm/find_exidx.c (__dl_addr_in_loadaddr) Define.
(find_exidx_callback): Support __FDPIC__.
Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
|
|
Sync with GNU C library and consolidate duplicate non
architecture specific defines.
MAP_UNINITIALIZED is only defined to 0x4000000 and used by
the Linux kernel when CONFIG_MMAP_ALLOW_UNINITIALIZED is enabled.
CONFIG_MMAP_ALLOW_UNINITIALIZED is only available for nommu.
See Documentation/nommu-mmap.txt.
|
|
|
|
|
|
Sync with GNU C library. Found while trying to compile
linux-rdma to uClibc-ng.
Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
|
|
If you enable these wrappers, be sure you don't need long double
precision on your embedded device, as these only enables
long double warpper functions to the existing double math
functions. Required to build some software as lvm2.
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e
and remove the PID caching. These simplifies the architecture specific
assembly code.
The run of the test suite found no regressions, it even solves
some of the test failures for x86/x86_64/sparc.
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Acked-by: Matthew Fortune <Matthew.Fortune@imgtec.com>
Acked-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
|
|
|
|
Fixes mq_send return value and errno issue.
Reported-by: Frank Liu <fliu@universalbiosensors.com>
Tested-by: Frank Liu <fliu@universalbiosensors.com>
|
|
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
|
|
Fix a regression introduced by commit
0550ecce0e6580c5ad34e9a9a39ff18ccf8774f9
Reported by Buildroot developers.
Embedded test must be extented to ARMv7 thumb2 builds to
find such regressions next time. It wasn't triggered by a
cortex-m4 ARM noMMU build.
|
|
|
|
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
As this is only implemented for a few architecture and not well
tested, just remove it.
|
|
As this is only implemented for a few architecture and not well
tested, just remove it.
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
In uClibc-ng the syscall macros are in bits/syscalls.h.
|
|
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
|
|
Currently, the Thumb support on ARM has three related Config.in
options, which are not trivial for users to understand, and are in
fact not needed:
- The USE_BX option is not needed: knowing whether BX is available or
not is easy. If you have an ARM > v4 or ARMv4T, then BX is
available, otherwise it's not. This is the logic used in glibc.
- The USE_LDREXSTREX option is not needed: whenever Thumb2 is
available, ldrex/strex are available, so we can simply rely on
__thumb2__ to determine whether ldrex/strex should be used, without
requiring a Config.in option.
- Once USE_BX and USE_LDREXSTREX are removed, the only thing left
that COMPILE_IN_THUMB does is to set -mthumb. This makes the option
unnecessary, as on ARM at least, the user is already supposed to
pass -march=<foo> or other compiler options tuning the library for
a specific ARM variant. There is no reason to do otherwise for
Thumb, which allows to get rid of the COMPILE_IN_THUMB option.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
__JMP_BUF_SP is the index of a stack pointer slot in the __jmp_buf.
According to ARM __sigsetjmp code it does not depend on configuration
parameter __UCLIBC_HAS_FPU__. Make its definition unconditional.
__JMP_BUF_SP is used in the unwind_stop through the
_JMPBUF_CFA_UNWINDS_ADJ macro, this change fixes cleanup routines call
on thread cancellation in configurations with hard FP.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
Only alpha, hppa and sparc need non-default value.
|
|
.globl can be used for every architecture so remove the define.
Sync with GNU C library.
|
|
It's even no longer required for non-ported ppc64
architecture. Sync with GNU C library.
This simplify the macros in include/libc-symbols.h.
|
|
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
It seems the condition was reversed which lead to e.g. arm-920t being
confused
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
|
|
In file included from ./include/sys/syscall.h:33:0,
from libc/sysdeps/linux/common/sync_file_range.c:10:
libc/sysdeps/linux/common/sync_file_range.c: In function '__sync_file_range_nocancel':
./include/bits/syscalls.h:144:16: error: conflicting types for '_v3'
register int _v3 __asm__ ("v3") = _v3tmp;
^
./libc/sysdeps/linux/arm/sysdep.h:281:7: note: in expansion of macro 'LOAD_ARGS_7'
LOAD_ARGS_##nr (args) \
^
./libc/sysdeps/linux/arm/sysdep.h:324:2: note: in expansion of macro 'INTERNAL_SYSCALL_RAW'
INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args)
^
./libc/sysdeps/linux/arm/sysdep.h:256:40: note: in expansion of macro 'INTERNAL_SYSCALL'
({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \
^
libc/sysdeps/linux/common/sync_file_range.c:32:9: note: in expansion of macro 'INLINE_SYSCALL'
return INLINE_SYSCALL(sync_file_range, 7, fd, 0,
^
In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h:18:0,
from ./include/cancel.h:58,
from libc/sysdeps/linux/common/sync_file_range.c:15:
./libc/sysdeps/linux/arm/sysdep.h:280:21: note: previous definition of '_v3' was here
register int *_v3 __asm__ ("v3") = _sys_buf; \
...
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
|
|
Otherwise it creates wrong references from shared libs
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Sync with GNU libc, see here why r7 is not usable for
thumb mode:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/arm/sysdep.h;h=37eac192b1e2e7f53f112b16450b9ce57054e27f;hb=HEAD
Remove old OABI support.
Fixes build breakage for ARM noMMU builds.
Still no runtime testing.
|
|
As suggested on the uCLibc mailing list:
http://lists.uclibc.org/pipermail/uclibc/2014-November/048702.html
http://lists.uclibc.org/pipermail/uclibc/2014-November/048703.html
http://lists.uclibc.org/pipermail/uclibc/2014-November/048704.html
|
|
Called getpid() When creating a new process with clone(), getpid() returns
the father_process's value. It should be child_process's value.
The reason is missing a RESET_PID in the arm clone impl.
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
As Will noticed, the header this check is currently done in
is asm-only, and is not meant to be included from C code.
This breaks compilation when compiled for a Thumb2-aware CPU.
Move the BX check to its own header, and revert 7a246fd.
Reported-by: Will Newton <will.newton@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Will Newton <will.newton@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The conditional load needs to be made part of an IT block on Thumb2
cores.
Signed-off-by: Will Newton <will.newton@linaro.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Fixes gen_lowlevelrobustlock on thumb2
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
* 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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Fixes the following compilation error:
_lfs_64.h: # error Do not include this header in files not built when LFS is disabled
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Add the obsolescent SUSv3 family of user context manipulating functions
for arm, i386, mips, x86_64.
Signed-off-by: Timon ter Braak <timonterbraak@gmail.com>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
If the syscall returns with an error the stack pointer and r4 register
are not restored because the instruction 'ldmnefd sp!, {r4}' is executed
after branching to '__error' label.
This bug has been spotted out by running './utstest clone 5' from LTP
built with -fstack-protector-all compiler flag as log below:
root@cortex-a9:/usr/tests/ltp/testcases/bin# ./utstest clone 5
stack smashing detected: ./utstest terminated()
Regression introduced by commit e58798e107d652644629a1daaa95d76430808d53
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Giuseppe Di Giore <giuseppe.di-giore@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
|
|
This matches a similar change made to glibc.
No functional changes here.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|