[uclibc-ng-devel] [PATCH 32/32] [ARM] rtld: Avoid crash on R_ARM_NONE relocation

2018-07-04 Thread Christophe Lyon
R_ARM_NONE contains no data, so avoid dereferencing it. * ldso/ldso/arm/elfinterp.c (_dl_do_reloc): Handle R_ARM_NONE relocation (_dl_do_reloc_lazy): Likewise. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/ldso/ldso/arm/elfinterp.c

[uclibc-ng-devel] [PATCH 30/32] mbtowc: Fix non compliant behavior for end of string

2018-07-04 Thread Christophe Lyon
Match glibc behavior. * libc/stdlib/stdlib.c (mbtowc): Fix end of string behavior. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 075e6e5..f593663 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c

[uclibc-ng-devel] [PATCH 29/32] isnan: Add isnan weak alias to __isnan

2018-07-04 Thread Christophe Lyon
* libm/s_isnan.c: Add isnan weak alias. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/libm/s_isnan.c b/libm/s_isnan.c index 1bc49cb..1aabb74 100644 --- a/libm/s_isnan.c +++ b/libm/s_isnan.c @@ -26,4 +26,5 @@ int __isnan(double x) hx = 0x7ff0 - hx;

[uclibc-ng-devel] [PATCH 26/32] [FDPIC] nptl: Replace sbrk with mmap

2018-07-04 Thread Christophe Lyon
Replace sbrk with mmap since this commit disables sbrk area for FDPIC MMU-less platform: fs/binfmt_elf_fdpic.c: fix brk area overlap with stack on NOMMU https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/binfmt_elf_fdpic.c?id=4ac313111018cb44ecc250445de5ccb93026a980

[uclibc-ng-devel] [PATCH 27/32] nptl threads: Fix bug in using a weak variable.

2018-07-04 Thread Christophe Lyon
In case __nptl_nthreads is not defined in the final binary then avoid dereferencing the address since it's null. Anyway this means there is no other thread and so we must exit. * libc/misc/internals/__uClibc_main.c (__uClibc_main): Handle case where &__nptl_nthreads is null.

[uclibc-ng-devel] [PATCH 24/32] [FDPIC] nptl: Use vfork on MMU-less for system()

2018-07-04 Thread Christophe Lyon
* libc/stdlib/system.c (FORK): Map to vfork if __ARCH_USE_MMU__ is defined. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index 771c30e..4c010bb 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c

[uclibc-ng-devel] [PATCH 22/32] [FDPIC] nptl: Allow sem_open to work on MMU-less systems

2018-07-04 Thread Christophe Lyon
Allow both tmpfs and ramfs for shm devices. * libpthread/nptl/linux_fsinfo.h (SHMFS_SUPER_MAGIC_WITH_MMU): Define. (SHMFS_SUPER_MAGIC_WITHOUT_MMU): Define. * libpthread/nptl/sem_open.c (__where_is_shmfs): Add support for SHMFS_SUPER_MAGIC_WITHOUT_MMU.

[uclibc-ng-devel] [PATCH 23/32] [FDPIC] nptl: Add pthread_mutex_getprioceiling and pthread_mutex_setprioceiling support

2018-07-04 Thread Christophe Lyon
* libpthread/nptl/Makefile.in (libpthread-routines-): Remove pthread_mutex_getprioceiling.c and pthread_mutex_setprioceiling.c. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in index

[uclibc-ng-devel] [PATCH 20/32] [FDPIC] nptl: Do not use madvise

2018-07-04 Thread Christophe Lyon
start_thread() uses it, but it is not supported on MMU-less systems. * libpthread/nptl/pthread_create.c (start_thread): Call madvise only if __ARCH_USE_MMU__ is defined. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/libpthread/nptl/pthread_create.c

[uclibc-ng-devel] [PATCH 19/32] [FDPIC] nptl: Disable fork and atfork on MMU-less systems.

2018-07-04 Thread Christophe Lyon
They do not work on MMU-less systems. For atfork, implement a hidden function that always returns EPERM. * libpthread/nptl/sysdeps/unix/sysv/linux/fork.c: Disable if __ARCH_USE_MMU__ is not defined. * libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c

[uclibc-ng-devel] [PATCH 18/32] [FDPIC] nptl: disable mprotect usage in stack protection

2018-07-04 Thread Christophe Lyon
Since mprotect does not work on MMU-less systems, disable it if __ARCH_USE_MMU__ is not defined. * libpthread/nptl/allocatestack.c (change_stack_perm): Call mprotect only if __ARCH_USE_MMU__ is defined. (allocate_stack): Likewise. Signed-off-by: Mickaël Guêné

[uclibc-ng-devel] [PATCH 16/32] [ARM][FDPIC] rtld: Use ELF_RTYPE_CLASS_DLSYM

2018-07-04 Thread Christophe Lyon
rtld must call _dl_find_hash() with ELF_RTYPE_CLASS_DLSYM since we want a function descriptor. * ldso/ldso/ldso.c (_dl_get_ready_to_run): Support __FDPIC__. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index

[uclibc-ng-devel] [PATCH 14/32] [ARM][FDPIC] arm/clone.S: Fix threading support

2018-07-04 Thread Christophe Lyon
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é Signed-off-by: Christophe Lyon diff --git a/libc/sysdeps/linux/arm/clone.S

[uclibc-ng-devel] [PATCH 13/32] [ARM][FDPIC] rtld: Compile with -fno-unwind-tables -fno-asynchronous-unwind-tables

2018-07-04 Thread Christophe Lyon
Otherwise we have link errors because of unresolved refs in libgcc.a: ld: /lib/gcc/arm-none-uclinuxfdpiceabi/9.0.0/libgcc.a(pr-support.o): in function `_Unwind_GetDataRelBase': /libgcc/config/arm/pr-support.c:378: undefined reference to `abort' ld:

[uclibc-ng-devel] [PATCH 12/32] [ARM][FDPIC] TLS: fix relocation computation

2018-07-04 Thread Christophe Lyon
* ldso/ldso/dl-elf.c (_dl_load_elf_shared_library): Fix l_tls_initimage computation. * ldso/ldso/ldso.c (_dl_get_ready_to_run): Likewise. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index

[uclibc-ng-devel] [PATCH 10/32] [ARM][FDPIC] Allow to generate PIE 'static' binary

2018-07-04 Thread Christophe Lyon
* libc/misc/internals/__uClibc_main.c (funcdesc_value): New. (fdpic_init_array_jump): New. (__uClibc_fini): Support __FDPIC__. (__uClibc_main): Likewise. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/libc/misc/internals/__uClibc_main.c

[uclibc-ng-devel] [PATCH 11/32] [ARM][FDPIC] rtld: Add lazy binding support

2018-07-04 Thread Christophe Lyon
Add support for R_ARM_FUNCDESC_VALUE and implement _dl_linux_resolver for FDPIC on ARM. * ldso/ldso/arm/elfinterp.c (_dl_linux_resolver): Support __FDPIC__. (_dl_do_lazy_reloc): Likewise. * ldso/ldso/arm/resolve.S (_dl_linux_resolve): Likewise. Signed-off-by: Mickaël

[uclibc-ng-devel] [PATCH 09/32] [ARM][FDPIC] Add runtime support needed for C++ exceptions

2018-07-04 Thread Christophe Lyon
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é Signed-off-by: Christophe Lyon diff --git

[uclibc-ng-devel] [PATCH 07/32] [ARM] Fix bug in _dl_pread when using pread64 syscall

2018-07-04 Thread Christophe Lyon
In ARM_EABI mode, the pread64 syscall parameters are aligned on 64-bits. This syscall is used in rtld when processing FDPIC relocations. * ldso/include/dl-syscall.h (__syscall_pread): Fix definition. (__dl_pread): Fix syscall invocation. * ldso/ldso/fdpic/dl-sysdep.h

[uclibc-ng-devel] [PATCH 03/32] [ARM][FDPIC] rtld: Add #if defined (__FDPIC__)

2018-07-04 Thread Christophe Lyon
Like for other FDPIC targets, add defined(__FDPIC__) where needed. * include/link.h: Include bits/elf-fdpic.h if __FDPIC__ is defined. (link_map): Use elf32_fdpic_loadaddr if __FDPIC__ is defined. (dl_phdr_info): Likewise. * ldso/include/dl-elf.h

[uclibc-ng-devel] [PATCH 01/32] [ARM][FDPIC] Allow to select FDPIC ELF for arm architecture

2018-07-04 Thread Christophe Lyon
* extra/Configs/Config.in.arch: Add TARGET_arm to the target list for UCLIBC_FORMAT_FDPIC_ELF. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch index b51ed81..91b6394 100644 ---

[uclibc-ng-devel] [PATCH 02/32] [FDPIC] rtld: Do not protect RELRO segments when we don't use an MMU.

2018-07-04 Thread Christophe Lyon
Without MMU, we cannot mark memory regions as read-only. * ldso/ldso/dl-elf.c (_dl_protect_relro): Do nothing if __ARCH_USE_MMU__ is defined. Signed-off-by: Christophe Lyon diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index d264e6a..1768b5b 100644 ---

[uclibc-ng-devel] [PATCH 00/32] FDPIC ABI for ARM

2018-07-04 Thread Christophe Lyon
Hello, This patch series implements the uClibc-ng contribution of the FDPIC ABI for ARM targets. This ABI enables to run Linux on ARM MMU-less cores and supports shared libraries to reduce the memory footprint. Without MMU, text and data segments relative distances are different from one