diff options
25 files changed, 109 insertions, 51 deletions
@@ -276,7 +276,7 @@ cmd_compile.mi= $(cmd_compile.m:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS) cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@)) $(sort $(foreach d,$(^:$(top_srcdir)=),$(collect_multi_flags))) cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^ cmd_t_strip = $(STRIPTOOL) $(STRIP_FLAGS) $@ -cmd_ar = $(AR) $(ARFLAGS) $@ $(call objects_with_syms,,$^) +cmd_ar = $(AR) $(ARFLAGS) $@ @$@.list define do_ln @$(disp_ln) @@ -317,6 +317,7 @@ hcompile.u= @$(disp_hcompile.u); $(cmd_hcompile.u) hcompile.o= @$(disp_hcompile.o); $(cmd_hcompile.o) define do_ar + @$(file >$@.list,$(call objects_with_syms,,$^)) @$(disp_ar) ; $(cmd_ar) @$(do_t_strip) endef @@ -128,7 +128,7 @@ export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR # Now config hard core MAJOR_VERSION := 1 MINOR_VERSION := 0 -SUBLEVEL := 47 +SUBLEVEL := 48 EXTRAVERSION := VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL) ABI_VERSION := $(MAJOR_VERSION) @@ -604,6 +604,7 @@ CFLAGS := $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \ -nostdinc -I$(top_builddir)include \ -I$(top_srcdir)include -include libc-symbols.h \ -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \ + -I$(top_builddir)libc/sysdeps/linux/$(TARGET_ARCH) \ -I$(top_srcdir)libc/sysdeps/linux \ -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) \ -I$(top_srcdir)ldso/include -I. diff --git a/extra/Configs/Config.i386 b/extra/Configs/Config.i386 index c928ac1a2..c2a9a6e93 100644 --- a/extra/Configs/Config.i386 +++ b/extra/Configs/Config.i386 @@ -14,6 +14,7 @@ config FORCE_OPTIONS_FOR_ARCH select ARCH_HAS_MMU select ARCH_HAS_UCONTEXT select ARCH_HAS_DEPRECATED_SYSCALLS + select ARCH_VDSO_SUPPORT choice prompt "Target x86 Processor Family" diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index b814449b4..3a0136c99 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -1028,6 +1028,7 @@ config UCLIBC_USE_TIME64 bool "Use *time64 syscalls instead of 32bit ones (if possible)" depends on TARGET_arc || \ TARGET_arm || \ + TARGET_csky || \ TARGET_i386 || \ TARGET_m68k || \ TARGET_microblaze || \ diff --git a/include/features.h b/include/features.h index 11b34205f..b5d4e79f2 100644 --- a/include/features.h +++ b/include/features.h @@ -437,4 +437,8 @@ # include <libc-internal.h> #endif +#if defined(__UCLIBC_USE_TIME64__) || __TARGET_ARCH_BITS__ == 64 +#define __USE_TIME_BITS64 1 +#endif + #endif /* features.h */ diff --git a/include/net/ppp_defs.h b/include/net/ppp_defs.h index f8924c4f2..904d1933c 100644 --- a/include/net/ppp_defs.h +++ b/include/net/ppp_defs.h @@ -4,7 +4,7 @@ #define __need_time_t #include <time.h> -#include <asm/types.h> +#include <sys/types.h> #include <linux/ppp_defs.h> #endif /* net/ppp_defs.h */ diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c index 4c268356f..9c9a3e8ca 100644 --- a/ldso/ldso/arm/elfinterp.c +++ b/ldso/ldso/arm/elfinterp.c @@ -92,7 +92,7 @@ unsigned long _dl_linux_resolver (struct elf_resolve *tpnt, int reloc_offet) *got_entry = funcval; #endif - return got_entry; + return (unsigned long)got_entry; } #else unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) @@ -362,7 +362,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct r_scope_elem *scope, unsigned long reloc_value = *reloc_addr; if (symbol_addr) - reloc_value = (unsigned long) _dl_funcdesc_for(symbol_addr + reloc_value, sym_ref.tpnt->loadaddr.got_value); + reloc_value = (unsigned long) _dl_funcdesc_for((void *)(symbol_addr + reloc_value), sym_ref.tpnt->loadaddr.got_value); else /* Relocation against an undefined weak symbol: @@ -429,7 +429,7 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, { struct funcdesc_value *dst = (struct funcdesc_value *) reloc_addr; - dst->entry_point = DL_RELOC_ADDR(tpnt->loadaddr, dst->entry_point); + dst->entry_point = (void *)DL_RELOC_ADDR(tpnt->loadaddr, dst->entry_point); dst->got_value = tpnt->loadaddr.got_value; } break; diff --git a/ldso/ldso/fdpic/dl-inlines.h b/ldso/ldso/fdpic/dl-inlines.h index 89e7a9a68..6a31ef3e6 100644 --- a/ldso/ldso/fdpic/dl-inlines.h +++ b/ldso/ldso/fdpic/dl-inlines.h @@ -102,7 +102,7 @@ __dl_update_loadaddr_hdr(struct elf32_fdpic_loadaddr loadaddr, void *addr, #if defined (__SUPPORT_LD_DEBUG__) if (_dl_debug) - _dl_dprintf(_dl_debug_file, "%i: changed mapping %x at %x (old %x), size %x\n", + _dl_dprintf(_dl_debug_file, "%i: changed mapping %x at %x (old %p), size %x\n", loadaddr.map->nsegs - 1, segdata->p_vaddr, segdata->addr, oldaddr, segdata->p_memsz); #endif @@ -177,7 +177,7 @@ _dl_funcdesc_for (void *entry_point, void *got_value) tpnt->funcdesc_ht = ht; } - entry = htab_find_slot(ht, entry_point, 1, hash_pointer, eq_pointer); + entry = (struct funcdesc_value **)htab_find_slot(ht, entry_point, 1, hash_pointer, eq_pointer); if (entry == NULL) _dl_exit(1); diff --git a/ldso/ldso/fdpic/dl-sysdep.h b/ldso/ldso/fdpic/dl-sysdep.h index 6ab303b37..81694dc76 100644 --- a/ldso/ldso/fdpic/dl-sysdep.h +++ b/ldso/ldso/fdpic/dl-sysdep.h @@ -108,7 +108,7 @@ struct funcdesc_ht; && ELF32_ST_TYPE((SYM)->st_info) == STT_FUNC \ ? _dl_funcdesc_for ((void *)DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value), \ (TPNT)->loadaddr.got_value) \ - : DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value)) + : (void*)DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value)) #define DL_GET_READY_TO_RUN_EXTRA_PARMS \ , struct elf32_fdpic_loadmap *dl_boot_progmap, Elf32_Addr dl_boot_got_pointer diff --git a/ldso/ldso/i386/dl-syscalls.h b/ldso/ldso/i386/dl-syscalls.h index f40c4fd31..8f144ee28 100644 --- a/ldso/ldso/i386/dl-syscalls.h +++ b/ldso/ldso/i386/dl-syscalls.h @@ -1 +1,29 @@ +/* stub for arch-specific syscall issues/specific implementations */ + +#ifndef _DL_SYSCALLS_H +#define _DL_SYSCALLS_H + +#if defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) + +#include "../dl-vdso-calls.h" + +static int __attribute__ ((used)) __x86_vdso_clock_gettime(clockid_t clock_id, struct timespec *tp); +static int __attribute__ ((used)) __x86_vdso_clock_gettime(clockid_t clock_id, struct timespec *tp) +{ + return __generic_vdso_clock_gettime(clock_id, tp); +} + +static int __attribute__ ((used)) __x86_vdso_gettimeofday(struct timeval *tv, __timezone_ptr_t tz); +static int __attribute__ ((used)) __x86_vdso_gettimeofday(struct timeval *tv, __timezone_ptr_t tz) +{ + return __generic_vdso_gettimeofday(tv, tz); +} + +#define ARCH_VDSO_GETTIMEOFDAY(tv, tz) __x86_vdso_gettimeofday(tv, tz) +#define ARCH_VDSO_CLOCK_GETTIME(clock_id, tp) __x86_vdso_clock_gettime(clock_id, tp) + +#endif /* defined(__VDSO_SUPPORT__) && !defined(UCLIBC_LDSO) */ + +#endif /* _DL_SYSCALLS_H */ + /* stub for arch-specific syscall issues */ diff --git a/libc/misc/internals/reloc_static_pie.c b/libc/misc/internals/reloc_static_pie.c index 81af7d666..cb2c4df87 100644 --- a/libc/misc/internals/reloc_static_pie.c +++ b/libc/misc/internals/reloc_static_pie.c @@ -21,7 +21,7 @@ #include <dl-elf.h> #include <ldso.h> -#if defined(__mips__) || defined(__xtensa__) +#if defined(__m68k__) || defined(__mips__) || defined(__xtensa__) #include <dl-startup.h> #endif diff --git a/libc/stdlib/malloc/memalign.c b/libc/stdlib/malloc/memalign.c index 665f20cfb..54f6dbc6c 100644 --- a/libc/stdlib/malloc/memalign.c +++ b/libc/stdlib/malloc/memalign.c @@ -11,6 +11,7 @@ * Written by Miles Bader <miles@gnu.org> */ +#include <errno.h> #include <stdlib.h> #include <unistd.h> #include <sys/mman.h> @@ -38,6 +39,11 @@ memalign (size_t alignment, size_t size) unsigned long tot_addr, tot_end_addr, addr, end_addr; struct heap_free_area **heap = &__malloc_heap; + if (unlikely(size > PTRDIFF_MAX)) { + __set_errno(ENOMEM); + return NULL; + } + /* Make SIZE something we like. */ size = HEAP_ADJUST_SIZE (size); diff --git a/libc/sysdeps/linux/common-generic/bits/kernel_stat.h b/libc/sysdeps/linux/common-generic/bits/kernel_stat.h index 7a97bb4d7..e874a4a9f 100644 --- a/libc/sysdeps/linux/common-generic/bits/kernel_stat.h +++ b/libc/sysdeps/linux/common-generic/bits/kernel_stat.h @@ -18,7 +18,7 @@ * However that requires more #ifndef in relevant wrappers, * further uglifying them */ -#define kernel_stat64 stat +#define kernel_stat64 stat64 #endif /* _BITS_STAT_STRUCT_H */ diff --git a/libc/sysdeps/linux/common/futimesat.c b/libc/sysdeps/linux/common/futimesat.c index fd19fea7c..bf36550dd 100644 --- a/libc/sysdeps/linux/common/futimesat.c +++ b/libc/sysdeps/linux/common/futimesat.c @@ -7,6 +7,7 @@ */ #include <sys/syscall.h> +#include <sys/stat.h> #include <sys/time.h> #ifdef __NR_futimesat diff --git a/libc/sysdeps/linux/common/utimensat.c b/libc/sysdeps/linux/common/utimensat.c index fa6f90e55..5816c7890 100644 --- a/libc/sysdeps/linux/common/utimensat.c +++ b/libc/sysdeps/linux/common/utimensat.c @@ -8,6 +8,7 @@ #include <sys/syscall.h> #include <sys/stat.h> +#include <stdint.h> #if defined(__UCLIBC_USE_TIME64__) #include "internal/time64_helpers.h" @@ -28,7 +29,7 @@ int utimensat(int fd, const char *path, const struct timespec times[2], int flag } }; - return INLINE_SYSCALL(utimensat_time64, 4, fd, path, times ? &__times64 : 0, flags); + return INLINE_SYSCALL(utimensat_time64, 4, fd, path, times ? (uintptr_t) &__times64 : 0, flags); } #else _syscall4(int, utimensat, int, fd, const char *, path, const struct timespec *, times, int, flags) diff --git a/libc/sysdeps/linux/csky/bits/uClibc_arch_features.h b/libc/sysdeps/linux/csky/bits/uClibc_arch_features.h index 3f5dab80c..1b866cb90 100644 --- a/libc/sysdeps/linux/csky/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/csky/bits/uClibc_arch_features.h @@ -17,9 +17,6 @@ /* can your target use syscall6() for mmap ? */ #undef __UCLIBC_MMAP_HAS_6_ARGS__ -/* does your target use statx */ -#define __UCLIBC_HAVE_STATX__ - #ifdef __CSKYABIV2__ #undef __UCLIBC_SYSCALL_ALIGN_64BIT__ #else diff --git a/libc/sysdeps/linux/sparc/Makefile.arch b/libc/sysdeps/linux/sparc/Makefile.arch index d34624f36..c9529b344 100644 --- a/libc/sysdeps/linux/sparc/Makefile.arch +++ b/libc/sysdeps/linux/sparc/Makefile.arch @@ -6,7 +6,7 @@ # CSRC-y := brk.c __syscall_error.c sigaction.c -SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \ +SSRC-y := __longjmp.S setjmp.S sigreturn_stub.S bsd-setjmp.S bsd-_setjmp.S \ syscall.S urem.S udiv.S umul.S sdiv.S rem.S pipe.S fork.S vfork.S clone.S CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c diff --git a/libc/sysdeps/linux/sparc/sigaction.c b/libc/sysdeps/linux/sparc/sigaction.c index 7895e3acd..447943e3a 100644 --- a/libc/sysdeps/linux/sparc/sigaction.c +++ b/libc/sysdeps/linux/sparc/sigaction.c @@ -30,8 +30,8 @@ _syscall5(int, rt_sigaction, int, a, int, b, int, c, int, d, int, e) -static void __rt_sigreturn_stub(void); -static void __sigreturn_stub(void); +void __rt_sigreturn_stub(void); +void __sigreturn_stub(void); int __libc_sigaction(int sig, const struct sigaction *act, struct sigaction *oact) { @@ -75,24 +75,3 @@ libc_hidden_weak(sigaction) # endif #endif - -static void -__rt_sigreturn_stub(void) -{ - __asm__( - "mov %0, %%g1\n\t" - "ta 0x10\n\t" - : /* no outputs */ - : "i" (__NR_rt_sigreturn) - ); -} -static void -__sigreturn_stub(void) -{ - __asm__( - "mov %0, %%g1\n\t" - "ta 0x10\n\t" - : /* no outputs */ - : "i" (__NR_sigreturn) - ); -} diff --git a/libc/sysdeps/linux/sparc/sigreturn_stub.S b/libc/sysdeps/linux/sparc/sigreturn_stub.S new file mode 100644 index 000000000..33f51409b --- /dev/null +++ b/libc/sysdeps/linux/sparc/sigreturn_stub.S @@ -0,0 +1,14 @@ +#include <sysdep.h> + + nop + nop + +ENTRY_NOCFI (__rt_sigreturn_stub) + mov __NR_rt_sigreturn, %g1 + ta 0x10 +END_NOCFI (__rt_sigreturn_stub) + +ENTRY_NOCFI (__sigreturn_stub) + mov __NR_sigreturn, %g1 + ta 0x10 +END_NOCFI (__sigreturn_stub) diff --git a/libc/sysdeps/linux/sparc/sysdep.h b/libc/sysdeps/linux/sparc/sysdep.h index c3897ec08..761d21454 100644 --- a/libc/sysdeps/linux/sparc/sysdep.h +++ b/libc/sysdeps/linux/sparc/sysdep.h @@ -17,6 +17,15 @@ C_LABEL(name) \ cfi_startproc; +#define ENTRY_NOCFI(name) \ + .align 4; \ + .global C_SYMBOL_NAME(name); \ + .type name, @function; \ +C_LABEL(name) + +#define END_NOCFI(name) \ + .size name, . - name + #define END(name) \ cfi_endproc; \ .size name, . - name diff --git a/libc/sysdeps/linux/sparc64/Makefile.arch b/libc/sysdeps/linux/sparc64/Makefile.arch index 37b539b3b..cc4000b78 100644 --- a/libc/sysdeps/linux/sparc64/Makefile.arch +++ b/libc/sysdeps/linux/sparc64/Makefile.arch @@ -5,7 +5,7 @@ CSRC-y := __syscall_error.c sigaction.c SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S fork.S \ - syscall.S pipe.S vfork.S clone.S + syscall.S pipe.S vfork.S clone.S sigreturn_stub.S CSRC-y += $(addprefix soft-fp/, \ qp_add.c qp_cmp.c qp_cmpe.c qp_div.c qp_dtoq.c qp_feq.c qp_fge.c \ diff --git a/libc/sysdeps/linux/sparc64/sigaction.c b/libc/sysdeps/linux/sparc64/sigaction.c index d8aaad0fb..b28fa659a 100644 --- a/libc/sysdeps/linux/sparc64/sigaction.c +++ b/libc/sysdeps/linux/sparc64/sigaction.c @@ -26,7 +26,7 @@ /* SPARC 64bit userland requires a kernel that has rt signals anyway. */ -static void __rt_sigreturn_stub (void); +void __rt_sigreturn_stub (void); int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { @@ -67,11 +67,3 @@ libc_hidden_weak(sigaction) # endif #endif -static void -__rt_sigreturn_stub (void) -{ - __asm__ ("mov %0, %%g1\n\t" - "ta 0x6d\n\t" - : /* no outputs */ - : "i" (__NR_rt_sigreturn)); -} diff --git a/libc/sysdeps/linux/sparc64/sigreturn_stub.S b/libc/sysdeps/linux/sparc64/sigreturn_stub.S new file mode 100644 index 000000000..a5c9bb47f --- /dev/null +++ b/libc/sysdeps/linux/sparc64/sigreturn_stub.S @@ -0,0 +1,10 @@ +#include <sysdep.h> + + nop + nop + +ENTRY_NOCFI (__rt_sigreturn_stub) + mov __NR_rt_sigreturn, %g1 + ta 0x6d +END_NOCFI (__rt_sigreturn_stub) + diff --git a/libc/sysdeps/linux/sparc64/sysdep.h b/libc/sysdeps/linux/sparc64/sysdep.h index 31008c34b..5a4c36348 100644 --- a/libc/sysdeps/linux/sparc64/sysdep.h +++ b/libc/sysdeps/linux/sparc64/sysdep.h @@ -83,6 +83,15 @@ C_LABEL(name) \ cfi_endproc; \ .size name, . - name +#define ENTRY_NOCFI(name) \ + .align 4; \ + .global C_SYMBOL_NAME(name); \ + .type name, @function; \ +C_LABEL(name) + +#define END_NOCFI(name) \ + .size name, . - name + #define LOC(name) .L##name #undef PSEUDO diff --git a/libiconv/iconv.c b/libiconv/iconv.c index ec01f381d..0462f6e10 100644 --- a/libiconv/iconv.c +++ b/libiconv/iconv.c @@ -142,7 +142,7 @@ struct stateful_cd { static iconv_t combine_to_from(size_t t, size_t f) { - return (void *)(f<<16 | t<<1 | 1); + return (iconv_t)(f<<16 | t<<1 | 1); } static size_t extract_from(iconv_t cd) @@ -382,7 +382,11 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri switch (type) { case UTF_8: if (c < 128) break; - l = utf8dec_wchar(&c, *in, *inb); + else { + wchar_t wc; + l = utf8dec_wchar(&wc, *in, *inb); + c = wc; + } if (!l) l++; else if (l == (size_t)-1) goto ilseq; else if (l == (size_t)-2) goto starved; |