mirror of
https://github.com/openharmony/third_party_musl2.git
synced 2026-07-01 10:25:07 -04:00
chore: isolate modifications into the porting folder
isolate changes, keep orignal musl sources clean. Signed-off-by: Caoruihong <crh.cao@huawei.com> Change-Id: Id7f3a5109771f93d397e30febba36e09ddaf4f36
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
# Do not make changes here.
|
||||
#
|
||||
|
||||
HIDE := @
|
||||
|
||||
srcdir = .
|
||||
exec_prefix = /usr/local
|
||||
bindir = $(exec_prefix)/bin
|
||||
@@ -48,7 +46,7 @@ CFLAGS_AUTO = -Os -pipe
|
||||
CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc
|
||||
|
||||
CFLAGS_ALL = $(CFLAGS_C99FSE)
|
||||
CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include -I$(SYSROOT)/usr/include
|
||||
CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
|
||||
CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
|
||||
|
||||
LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
|
||||
@@ -94,17 +92,17 @@ OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(G
|
||||
$(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(ALL_OBJS:%.o=%.lo) $(GENH) $(GENH_INT): | $(OBJ_DIRS)
|
||||
|
||||
$(OBJ_DIRS):
|
||||
$(HIDE)mkdir -p $@
|
||||
mkdir -p $@
|
||||
|
||||
obj/include/bits/alltypes.h: $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in $(srcdir)/tools/mkalltypes.sed
|
||||
$(HIDE)sed -f $(srcdir)/tools/mkalltypes.sed $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in > $@
|
||||
sed -f $(srcdir)/tools/mkalltypes.sed $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in > $@
|
||||
|
||||
obj/include/bits/syscall.h: $(srcdir)/arch/$(ARCH)/bits/syscall.h.in
|
||||
$(HIDE)cp $< $@
|
||||
$(HIDE)sed -n -e s/__NR_/SYS_/p < $< >> $@
|
||||
cp $< $@
|
||||
sed -n -e s/__NR_/SYS_/p < $< >> $@
|
||||
|
||||
obj/src/internal/version.h: $(wildcard $(srcdir)/VERSION $(srcdir)/.git)
|
||||
$(HIDE)printf '#define VERSION "%s"\n' "$$(cd $(srcdir); sh tools/version.sh)" > $@
|
||||
printf '#define VERSION "%s"\n' "$$(cd $(srcdir); sh tools/version.sh)" > $@
|
||||
|
||||
obj/src/internal/version.o obj/src/internal/version.lo: obj/src/internal/version.h
|
||||
|
||||
@@ -142,76 +140,76 @@ else
|
||||
endif
|
||||
|
||||
obj/%.o: $(srcdir)/%.s
|
||||
$(HIDE)$(AS_CMD)
|
||||
$(AS_CMD)
|
||||
|
||||
obj/%.o: $(srcdir)/%.S
|
||||
$(HIDE)$(CC_CMD)
|
||||
$(CC_CMD)
|
||||
|
||||
obj/%.o: $(srcdir)/%.c $(GENH) $(IMPH)
|
||||
$(HIDE)$(CC_CMD)
|
||||
$(CC_CMD)
|
||||
|
||||
obj/%.lo: $(srcdir)/%.s
|
||||
$(HIDE)$(AS_CMD)
|
||||
$(AS_CMD)
|
||||
|
||||
obj/%.lo: $(srcdir)/%.S
|
||||
$(HIDE)$(CC_CMD)
|
||||
$(CC_CMD)
|
||||
|
||||
obj/%.lo: $(srcdir)/%.c $(GENH) $(IMPH)
|
||||
$(HIDE)$(CC_CMD)
|
||||
$(CC_CMD)
|
||||
|
||||
lib/libc.so: $(LOBJS) $(LDSO_OBJS)
|
||||
$(HIDE)$(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -nostdlib -shared \
|
||||
$(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -nostdlib -shared \
|
||||
-Wl,-e,_dlstart -o $@ $(LOBJS) $(LDSO_OBJS) $(LIBCC)
|
||||
|
||||
lib/libc.a: $(AOBJS)
|
||||
$(HIDE)rm -f $@
|
||||
$(HIDE)$(AR) rc $@ $(AOBJS)
|
||||
$(HIDE)$(RANLIB) $@
|
||||
rm -f $@
|
||||
$(AR) rc $@ $(AOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(EMPTY_LIBS):
|
||||
$(HIDE)rm -f $@
|
||||
$(HIDE)$(AR) rc $@
|
||||
rm -f $@
|
||||
$(AR) rc $@
|
||||
|
||||
lib/%.o: obj/crt/$(ARCH)/%.o
|
||||
$(HIDE)cp $< $@
|
||||
cp $< $@
|
||||
|
||||
lib/%.o: obj/crt/%.o
|
||||
$(HIDE)cp $< $@
|
||||
cp $< $@
|
||||
|
||||
lib/musl-gcc.specs: $(srcdir)/tools/musl-gcc.specs.sh config.mak
|
||||
$(HIDE)sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@
|
||||
sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@
|
||||
|
||||
obj/musl-gcc: config.mak
|
||||
$(HIDE)printf '#!/bin/sh\nexec "$${REALGCC:-$(WRAPCC_GCC)}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
|
||||
$(HIDE)chmod +x $@
|
||||
printf '#!/bin/sh\nexec "$${REALGCC:-$(WRAPCC_GCC)}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
|
||||
chmod +x $@
|
||||
|
||||
obj/%-clang: $(srcdir)/tools/%-clang.in config.mak
|
||||
$(HIDE)sed -e 's!@CC@!$(WRAPCC_CLANG)!g' -e 's!@PREFIX@!$(prefix)!g' -e 's!@INCDIR@!$(includedir)!g' -e 's!@LIBDIR@!$(libdir)!g' -e 's!@LDSO@!$(LDSO_PATHNAME)!g' $< > $@
|
||||
$(HIDE)chmod +x $@
|
||||
sed -e 's!@CC@!$(WRAPCC_CLANG)!g' -e 's!@PREFIX@!$(prefix)!g' -e 's!@INCDIR@!$(includedir)!g' -e 's!@LIBDIR@!$(libdir)!g' -e 's!@LDSO@!$(LDSO_PATHNAME)!g' $< > $@
|
||||
chmod +x $@
|
||||
|
||||
$(DESTDIR)$(bindir)/%: obj/%
|
||||
$(HIDE)$(INSTALL) -D $< $@
|
||||
$(INSTALL) -D $< $@
|
||||
|
||||
$(DESTDIR)$(libdir)/%.so: lib/%.so
|
||||
$(HIDE)$(INSTALL) -D -m 755 $< $@
|
||||
$(INSTALL) -D -m 755 $< $@
|
||||
|
||||
$(DESTDIR)$(libdir)/%: lib/%
|
||||
$(HIDE)$(INSTALL) -D -m 644 $< $@
|
||||
$(INSTALL) -D -m 644 $< $@
|
||||
|
||||
$(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/$(ARCH)/bits/%
|
||||
$(HIDE)$(INSTALL) -D -m 644 $< $@
|
||||
$(INSTALL) -D -m 644 $< $@
|
||||
|
||||
$(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/generic/bits/%
|
||||
$(HIDE)$(INSTALL) -D -m 644 $< $@
|
||||
$(INSTALL) -D -m 644 $< $@
|
||||
|
||||
$(DESTDIR)$(includedir)/bits/%: obj/include/bits/%
|
||||
$(HIDE)$(INSTALL) -D -m 644 $< $@
|
||||
$(INSTALL) -D -m 644 $< $@
|
||||
|
||||
$(DESTDIR)$(includedir)/%: $(srcdir)/include/%
|
||||
$(HIDE)$(INSTALL) -D -m 644 $< $@
|
||||
$(INSTALL) -D -m 644 $< $@
|
||||
|
||||
$(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
|
||||
$(HIDE)$(INSTALL) -D -l $(libdir)/libc.so $@ || true
|
||||
$(INSTALL) -D -l $(libdir)/libc.so $@ || true
|
||||
|
||||
install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
|
||||
|
||||
@@ -222,17 +220,17 @@ install-tools: $(ALL_TOOLS:obj/%=$(DESTDIR)$(bindir)/%)
|
||||
install: install-libs install-headers install-tools
|
||||
|
||||
musl-git-%.tar.gz: .git
|
||||
$(HIDE)git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ $(patsubst musl-git-%.tar.gz,%,$@)
|
||||
git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ $(patsubst musl-git-%.tar.gz,%,$@)
|
||||
|
||||
musl-%.tar.gz: .git
|
||||
$(HIDE)git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ v$(patsubst musl-%.tar.gz,%,$@)
|
||||
git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ v$(patsubst musl-%.tar.gz,%,$@)
|
||||
|
||||
endif
|
||||
|
||||
clean:
|
||||
$(HIDE)rm -rf obj lib
|
||||
rm -rf obj lib
|
||||
|
||||
distclean: clean
|
||||
$(HIDE)rm -f config.mak
|
||||
rm -f config.mak
|
||||
|
||||
.PHONY: all clean install install-libs install-headers install-tools
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#ifndef __ICCARM__
|
||||
typedef int32_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef uint32_t uint_fast16_t;
|
||||
@@ -19,4 +18,3 @@ typedef uint32_t uint_fast32_t;
|
||||
#define PTRDIFF_MIN INT32_MIN
|
||||
#define PTRDIFF_MAX INT32_MAX
|
||||
#define SIZE_MAX UINT32_MAX
|
||||
#endif
|
||||
Executable → Regular
+21
-22
@@ -16,7 +16,6 @@
|
||||
#define __NR_lseek 19
|
||||
#define __NR_getpid 20
|
||||
#define __NR_mount 21
|
||||
#define __NR_umount 22
|
||||
#define __NR_setuid 23
|
||||
#define __NR_getuid 24
|
||||
#define __NR_ptrace 26
|
||||
@@ -210,8 +209,6 @@
|
||||
#define __NR_epoll_ctl 251
|
||||
#define __NR_epoll_wait 252
|
||||
#define __NR_remap_file_pages 253
|
||||
#define __NR_set_thread_area 254
|
||||
#define __NR_get_thread_area 255
|
||||
#define __NR_set_tid_address 256
|
||||
#define __NR_timer_create 257
|
||||
#define __NR_timer_settime32 258
|
||||
@@ -360,6 +357,26 @@
|
||||
#define __NR_io_pgetevents 399
|
||||
#define __NR_migrate_pages 400
|
||||
#define __NR_kexec_file_load 401
|
||||
#define __NR_clock_gettime64 403
|
||||
#define __NR_clock_settime64 404
|
||||
#define __NR_clock_adjtime64 405
|
||||
#define __NR_clock_getres_time64 406
|
||||
#define __NR_clock_nanosleep_time64 407
|
||||
#define __NR_timer_gettime64 408
|
||||
#define __NR_timer_settime64 409
|
||||
#define __NR_timerfd_gettime64 410
|
||||
#define __NR_timerfd_settime64 411
|
||||
#define __NR_utimensat_time64 412
|
||||
#define __NR_pselect6_time64 413
|
||||
#define __NR_ppoll_time64 414
|
||||
#define __NR_io_pgetevents_time64 416
|
||||
#define __NR_recvmmsg_time64 417
|
||||
#define __NR_mq_timedsend_time64 418
|
||||
#define __NR_mq_timedreceive_time64 419
|
||||
#define __NR_semtimedop_time64 420
|
||||
#define __NR_rt_sigtimedwait_time64 421
|
||||
#define __NR_futex_time64 422
|
||||
#define __NR_sched_rr_get_interval_time64 423
|
||||
#define __NR_pidfd_send_signal 424
|
||||
#define __NR_io_uring_setup 425
|
||||
#define __NR_io_uring_enter 426
|
||||
@@ -373,28 +390,10 @@
|
||||
#define __NR_pidfd_open 434
|
||||
#define __NR_clone3 435
|
||||
|
||||
/* OHOS customized syscalls, not compatible with ARM EABI */
|
||||
#define __NR_OHOS_BEGIN 500
|
||||
#define __NR_pthread_set_detach (__NR_OHOS_BEGIN + 0)
|
||||
#define __NR_pthread_join (__NR_OHOS_BEGIN + 1)
|
||||
#define __NR_pthread_deatch (__NR_OHOS_BEGIN + 2)
|
||||
#define __NR_creat_user_thread (__NR_OHOS_BEGIN + 3)
|
||||
#define __NR_processcreat (__NR_OHOS_BEGIN + 4)
|
||||
#define __NR_processtart (__NR_OHOS_BEGIN + 5)
|
||||
#define __NR_printf (__NR_OHOS_BEGIN + 6)
|
||||
#define __NR_dumpmemory (__NR_OHOS_BEGIN + 13)
|
||||
#define __NR_mkfifo (__NR_OHOS_BEGIN + 14)
|
||||
#define __NR_mqclose (__NR_OHOS_BEGIN + 15)
|
||||
#define __NR_realpath (__NR_OHOS_BEGIN + 16)
|
||||
#define __NR_format (__NR_OHOS_BEGIN + 17)
|
||||
#define __NR_shellexec (__NR_OHOS_BEGIN + 18)
|
||||
#define __NR_ohoscapget (__NR_OHOS_BEGIN + 19)
|
||||
#define __NR_ohoscapset (__NR_OHOS_BEGIN + 20)
|
||||
#define __NR_syscallend (__NR_OHOS_BEGIN + 21)
|
||||
|
||||
#define __ARM_NR_breakpoint 0x0f0001
|
||||
#define __ARM_NR_cacheflush 0x0f0002
|
||||
#define __ARM_NR_usr26 0x0f0003
|
||||
#define __ARM_NR_usr32 0x0f0004
|
||||
#define __ARM_NR_set_tls 0x0f0005
|
||||
#define __ARM_NR_get_tls 0x0f0006
|
||||
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ START ": \n"
|
||||
" mov lr, #0 \n"
|
||||
" ldr a2, 1f \n"
|
||||
" add a2, pc, a2 \n"
|
||||
" mov a3, sp \n"
|
||||
"2: and ip, a3, #-16 \n"
|
||||
" mov a1, sp \n"
|
||||
"2: and ip, a1, #-16 \n"
|
||||
" mov sp, ip \n"
|
||||
" bl " START "_c \n"
|
||||
".weak _DYNAMIC \n"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#if 0
|
||||
#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|
||||
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
|
||||
|
||||
@@ -25,9 +24,6 @@ static inline pthread_t __pthread_self()
|
||||
return (void *)(p-sizeof(struct pthread));
|
||||
}
|
||||
|
||||
#endif
|
||||
#else
|
||||
extern pthread_t __pthread_self();
|
||||
#endif
|
||||
|
||||
#define TLS_ABOVE_TP
|
||||
|
||||
+1
-1
@@ -29,4 +29,4 @@
|
||||
#define TLSDESC_BACKWARDS
|
||||
|
||||
#define CRTJMP(pc,sp) __asm__ __volatile__( \
|
||||
"mov r0,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory", "r0" )
|
||||
"mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
|
||||
|
||||
@@ -99,10 +99,10 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
|
||||
}
|
||||
|
||||
#define VDSO_USEFUL
|
||||
#define VDSO_CGT32_SYM "VdsoClockGettime"
|
||||
#define VDSO_CGT32_VER "OHOS"
|
||||
#define VDSO_CGT_SYM "VdsoClockGettime"
|
||||
#define VDSO_CGT_VER "OHOS"
|
||||
#define VDSO_CGT32_SYM "__vdso_clock_gettime"
|
||||
#define VDSO_CGT32_VER "LINUX_2.6"
|
||||
#define VDSO_CGT_SYM "__vdso_clock_gettime64"
|
||||
#define VDSO_CGT_VER "LINUX_2.6"
|
||||
|
||||
#define SYSCALL_FADVISE_6_ARG
|
||||
|
||||
|
||||
Executable → Regular
-5
@@ -1,6 +1,3 @@
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <assert.h>
|
||||
#else
|
||||
#include <features.h>
|
||||
|
||||
#undef assert
|
||||
@@ -23,6 +20,4 @@ _Noreturn void __assert_fail (const char *, const char *, int, const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-6
@@ -1,10 +1,6 @@
|
||||
#ifndef _COMPLEX_H
|
||||
#define _COMPLEX_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <complex.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -134,6 +130,4 @@ long double creall(long double complex);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _CTYPE_H
|
||||
#define _CTYPE_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <ctype.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -76,5 +72,4 @@ int toascii(int);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-49
@@ -1,54 +1,6 @@
|
||||
#ifndef _ERRNO_H
|
||||
#define _ERRNO_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
|
||||
#include_next <errno.h>
|
||||
|
||||
#ifdef errno
|
||||
#undef errno
|
||||
#endif
|
||||
|
||||
#ifdef EDOM
|
||||
#undef EDOM
|
||||
#endif
|
||||
|
||||
#ifdef ERANGE
|
||||
#undef ERANGE
|
||||
#endif
|
||||
|
||||
#ifdef EFPOS
|
||||
#undef EFPOS
|
||||
#endif
|
||||
|
||||
#ifdef EILSEQ
|
||||
#undef EILSEQ
|
||||
#endif
|
||||
|
||||
#ifdef _NERR
|
||||
#undef _NERR
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <bits/errno.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
__attribute__((const))
|
||||
#endif
|
||||
int *__errno_location(void);
|
||||
#define errno (*__errno_location())
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -71,6 +23,5 @@ extern char *program_invocation_short_name, *program_invocation_name;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
|
||||
Executable → Regular
+2
-8
@@ -16,7 +16,7 @@
|
||||
#define _XOPEN_SOURCE 700
|
||||
#endif
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L && !defined(__cplusplus)
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
#define __restrict restrict
|
||||
#elif !defined(__GNUC__)
|
||||
#define __restrict
|
||||
@@ -28,13 +28,7 @@
|
||||
#define __inline
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#if __cplusplus >= 201103L
|
||||
#define _Noreturn [[ noreturn ]]
|
||||
#else
|
||||
#define _Noreturn
|
||||
#endif
|
||||
#elif __STDC_VERSION__ >= 201112L
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
#elif defined(__GNUC__)
|
||||
#define _Noreturn __attribute__((__noreturn__))
|
||||
#else
|
||||
|
||||
Executable → Regular
-6
@@ -1,10 +1,6 @@
|
||||
#ifndef _FENV_H
|
||||
#define _FENV_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <fenv.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -28,7 +24,5 @@ int feupdateenv(const fenv_t *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _FLOAT_H
|
||||
#define _FLOAT_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <float.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -53,5 +49,4 @@ int __flt_rounds(void);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _INTTYPES_H
|
||||
#define _INTTYPES_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <inttypes.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -229,6 +225,5 @@ uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _ISO646_H
|
||||
#define _ISO646_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <iso646.h>
|
||||
#else
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#define and &&
|
||||
@@ -21,5 +17,4 @@
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
+3
-8
@@ -1,10 +1,6 @@
|
||||
#ifndef _LIMITS_H
|
||||
#define _LIMITS_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <limits.h>
|
||||
#else
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <bits/alltypes.h> /* __LONG_MAX */
|
||||
@@ -48,9 +44,9 @@
|
||||
#ifndef NAME_MAX
|
||||
#define NAME_MAX 255
|
||||
#endif
|
||||
#define PATH_MAX 256
|
||||
#define PATH_MAX 4096
|
||||
#define NGROUPS_MAX 32
|
||||
#define ARG_MAX 4096
|
||||
#define ARG_MAX 131072
|
||||
#define IOV_MAX 1024
|
||||
#define SYMLOOP_MAX 40
|
||||
#define WORD_BIT 32
|
||||
@@ -73,7 +69,7 @@
|
||||
#define SEM_VALUE_MAX 0x7fffffff
|
||||
#define SEM_NSEMS_MAX 256
|
||||
#define DELAYTIMER_MAX 0x7fffffff
|
||||
#define MQ_PRIO_MAX 1
|
||||
#define MQ_PRIO_MAX 32768
|
||||
#define LOGIN_NAME_MAX 256
|
||||
|
||||
/* Arbitrary numbers... */
|
||||
@@ -167,5 +163,4 @@
|
||||
#define _XOPEN_NAME_MAX 255
|
||||
#define _XOPEN_PATH_MAX 1024
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _LOCALE_H
|
||||
#define _LOCALE_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <locale.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -87,5 +83,4 @@ locale_t uselocale(locale_t);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _MATH_H
|
||||
#define _MATH_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <math.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -443,5 +439,4 @@ long double pow10l(long double);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _SETJMP_H
|
||||
#define _SETJMP_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <setjmp.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -42,5 +38,4 @@ _Noreturn void longjmp (jmp_buf, int);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-37
@@ -1,42 +1,6 @@
|
||||
#ifndef _SIGNAL_H
|
||||
#define _SIGNAL_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
|
||||
#include_next <signal.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __NEED_pthread_attr_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
union sigval {
|
||||
int sival_int;
|
||||
void *sival_ptr;
|
||||
};
|
||||
|
||||
struct sigevent {
|
||||
union sigval sigev_value;
|
||||
int sigev_signo;
|
||||
int sigev_notify;
|
||||
void (*sigev_notify_function)(union sigval);
|
||||
pthread_attr_t *sigev_notify_attributes;
|
||||
char __pad[56-3*sizeof(long)];
|
||||
};
|
||||
|
||||
#define SIGEV_SIGNAL 0
|
||||
#define SIGEV_NONE 1
|
||||
#define SIGEV_THREAD 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -319,5 +283,4 @@ __REDIR(sigtimedwait, __sigtimedwait_time64);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _STDALIGN_H
|
||||
#define _STDALIGN_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <stdalign.h>
|
||||
#else
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
/* this whole header only works in C11 or with compiler extensions */
|
||||
@@ -21,5 +17,4 @@
|
||||
#define __alignas_is_defined 1
|
||||
#define __alignof_is_defined 1
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _STDARG_H
|
||||
#define _STDARG_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <stdarg.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -22,5 +18,4 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _STDBOOL_H
|
||||
#define _STDBOOL_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <stdbool.h>
|
||||
#else
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#define true 1
|
||||
@@ -15,5 +11,4 @@
|
||||
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _STDDEF_H
|
||||
#define _STDDEF_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <stddef.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0L
|
||||
#else
|
||||
@@ -26,5 +22,4 @@
|
||||
#define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 ))
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _STDINT_H
|
||||
#define _STDINT_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <stdint.h>
|
||||
#else
|
||||
|
||||
#define __NEED_int8_t
|
||||
#define __NEED_int16_t
|
||||
#define __NEED_int32_t
|
||||
@@ -118,5 +114,4 @@ typedef uint64_t uint_least64_t;
|
||||
#define UINTMAX_C(c) c ## ULL
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-6
@@ -1,11 +1,6 @@
|
||||
#ifndef _STDIO_H
|
||||
#define _STDIO_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <stdio.h>
|
||||
int rename(const char *, const char *);
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -224,5 +219,4 @@ FILE *fopencookie(void *, const char *, cookie_io_functions_t);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _STDLIB_H
|
||||
#define _STDLIB_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <stdlib.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -176,5 +172,4 @@ long double strtold_l(const char *__restrict, char **__restrict, struct __locale
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-7
@@ -1,14 +1,7 @@
|
||||
#ifndef _STDNORETURN_H
|
||||
#define _STDNORETURN_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <stdnoreturn.h>
|
||||
#else
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <features.h>
|
||||
#define noreturn _Noreturn
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
+1
-6
@@ -1,10 +1,6 @@
|
||||
#ifndef _STRING_H
|
||||
#define _STRING_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <string.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -106,5 +102,4 @@ char *basename();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _TGMATH_H
|
||||
#define _TGMATH_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <tgmath.h>
|
||||
#else
|
||||
|
||||
/*
|
||||
the return types are only correct with gcc (__GNUC__)
|
||||
otherwise they are long double or long double complex
|
||||
@@ -271,5 +267,4 @@ so they can be in null pointer constants
|
||||
#define tgamma(x) __tg_real(tgamma, (x))
|
||||
#define trunc(x) __tg_real(trunc, (x))
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _THREADS_H
|
||||
#define _THREADS_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <threads.h>
|
||||
#else
|
||||
|
||||
#include <features.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -94,5 +90,4 @@ __REDIR(cnd_timedwait, __cnd_timedwait_time64);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
+1
-73
@@ -1,78 +1,6 @@
|
||||
#ifndef _TIME_H
|
||||
#define _TIME_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
|
||||
#ifndef tm_isdst
|
||||
#define tm_isdst tm_isdst; \
|
||||
long __tm_gmtoff; \
|
||||
const char *__tm_zone
|
||||
|
||||
#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
|
||||
#define __tm_gmtoff tm_gmtoff
|
||||
#define __tm_zone tm_zone
|
||||
#endif
|
||||
|
||||
#include_next <time.h>
|
||||
#undef tm_isdst
|
||||
|
||||
#else /* tm_isdst */
|
||||
|
||||
#include_next <time.h>
|
||||
|
||||
#endif /* tm_isdst */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __NEED_timer_t
|
||||
#define __NEED_clockid_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
struct itimerspec {
|
||||
struct timespec it_interval;
|
||||
struct timespec it_value;
|
||||
};
|
||||
|
||||
#define CLOCK_REALTIME 0
|
||||
#define CLOCK_MONOTONIC 1
|
||||
#define CLOCK_PROCESS_CPUTIME_ID 2
|
||||
#define CLOCK_THREAD_CPUTIME_ID 3
|
||||
#define CLOCK_MONOTONIC_RAW 4
|
||||
#define CLOCK_REALTIME_COARSE 5
|
||||
#define CLOCK_MONOTONIC_COARSE 6
|
||||
#define CLOCK_BOOTTIME 7
|
||||
#define CLOCK_REALTIME_ALARM 8
|
||||
#define CLOCK_BOOTTIME_ALARM 9
|
||||
#define CLOCK_SGI_CYCLE 10
|
||||
#define CLOCK_TAI 11
|
||||
|
||||
#define TIMER_ABSTIME 1
|
||||
|
||||
struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict);
|
||||
struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict);
|
||||
|
||||
int nanosleep (const struct timespec *, struct timespec *);
|
||||
int clock_getres (clockid_t, struct timespec *);
|
||||
int clock_gettime (clockid_t, struct timespec *);
|
||||
int clock_settime (clockid_t, const struct timespec *);
|
||||
int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *);
|
||||
|
||||
struct sigevent;
|
||||
int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict);
|
||||
int timer_delete (timer_t);
|
||||
int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict);
|
||||
int timer_gettime (timer_t, struct itimerspec *);
|
||||
int timer_getoverrun (timer_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -234,5 +162,5 @@ __REDIR(timegm, __timegm_time64);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _UCHAR_H
|
||||
#define _UCHAR_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <uchar.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -30,5 +26,4 @@ size_t mbrtoc32(char32_t *__restrict, const char *__restrict, size_t, mbstate_t
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
@@ -73,30 +73,6 @@ int ftruncate(int, off_t);
|
||||
int access(const char *, int);
|
||||
int faccessat(int, const char *, int, int);
|
||||
|
||||
|
||||
/* Format options */
|
||||
#define FMT_FAT 0x01
|
||||
#define FMT_FAT32 0x02
|
||||
#define FMT_ANY 0x07
|
||||
#define FMT_ERASE 0x08
|
||||
|
||||
/**
|
||||
* @brief format FAT device (SD card, U disk, and MMC card), this function is OHOS-specific
|
||||
* @param dev device name.
|
||||
* @param sectors sectors per cluster, can be 0 OR power of 2. The sector size for standard FAT volumes is 512 bytes.
|
||||
* -- sector number is 0 OR >128: automatically choose the appropriate cluster size.
|
||||
* -- sector number is 1 ~ 128: cluster size = sectors per cluster * 512B.
|
||||
* @param option file system type.
|
||||
* -- FMT_FAT
|
||||
* -- FMT_FAT32
|
||||
* -- FMT_ANY
|
||||
* -- FMT_ERASE (USB not supported)
|
||||
* @return format result
|
||||
* @retval -1 format error
|
||||
* @retval 0 format successful
|
||||
*/
|
||||
int format(const char *dev, int sectors, int option);
|
||||
|
||||
int chdir(const char *);
|
||||
int fchdir(int);
|
||||
char *getcwd(char *, size_t);
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _WCHAR_H
|
||||
#define _WCHAR_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <wchar.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -206,5 +202,4 @@ wctype_t wctype(const char *);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
Executable → Regular
-5
@@ -1,10 +1,6 @@
|
||||
#ifndef _WCTYPE_H
|
||||
#define _WCTYPE_H
|
||||
|
||||
#ifdef __ICCARM__ /* for iar */
|
||||
#include_next <wctype.h>
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -80,5 +76,4 @@ wctype_t wctype_l(const char *, locale_t);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ICCARM__ */
|
||||
#endif
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../poll.h
|
||||
@@ -1,9 +0,0 @@
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
all : $(LOCAL_COBJS_INTERNAL)
|
||||
|
||||
$(LOCAL_COBJS_INTERNAL): $(OBJOUT)/musl/src/internal/%.o: %.c
|
||||
$(HIDE)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi
|
||||
$(HIDE)$(CC) $(LITEOS_CFLAGS) $(LOCAL_FLAGS) -c $< -o $@
|
||||
|
||||
.PHONY: all
|
||||
@@ -1,9 +0,0 @@
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
all : $(LOCAL_COBJS_MATH)
|
||||
|
||||
$(LOCAL_COBJS_MATH): $(OBJOUT)/musl/src/math/%.o: %.c
|
||||
$(HIDE)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi
|
||||
$(HIDE)$(CC) $(LITEOS_CFLAGS) $(LOCAL_FLAGS) -c $< -o $@
|
||||
|
||||
.PHONY: all
|
||||
@@ -1,9 +0,0 @@
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
all : $(LOCAL_COBJS_STDIO)
|
||||
|
||||
$(LOCAL_COBJS_STDIO): $(OBJOUT)/musl/src/stdio/%.o: %.c
|
||||
$(HIDE)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi
|
||||
$(HIDE)$(CC) $(LITEOS_CFLAGS) $(LOCAL_FLAGS) -c $< -o $@
|
||||
|
||||
.PHONY: all
|
||||
@@ -1,9 +0,0 @@
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
all : $(LOCAL_COBJS_STRING)
|
||||
|
||||
$(LOCAL_COBJS_STRING): $(OBJOUT)/musl/src/string/%.o: %.c
|
||||
$(HIDE)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi
|
||||
$(HIDE)$(CC) $(LITEOS_CFLAGS) $(LOCAL_FLAGS) -c $< -o $@
|
||||
|
||||
.PHONY: all
|
||||
@@ -1,9 +0,0 @@
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
all : $(LOCAL_COBJS_TIME)
|
||||
|
||||
$(LOCAL_COBJS_TIME): $(OBJOUT)/musl/src/time/%.o: %.c
|
||||
$(HIDE)if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi
|
||||
$(HIDE)$(CC) $(LITEOS_CFLAGS) $(LOCAL_FLAGS) -c $< -o $@
|
||||
|
||||
.PHONY: all
|
||||
@@ -1,46 +0,0 @@
|
||||
/* The time64 has not been used yet in liteos_m */
|
||||
#define _REDIR_TIME64 0
|
||||
#define _Addr int
|
||||
#define _Int64 long long
|
||||
#define _Reg int
|
||||
|
||||
#if __ARMEB__
|
||||
#define __BYTE_ORDER 4321
|
||||
#else
|
||||
#define __BYTE_ORDER 1234
|
||||
#endif
|
||||
|
||||
#define __LONG_MAX 0x7fffffffL
|
||||
|
||||
#ifdef __ICCARM__
|
||||
#ifndef __cplusplus
|
||||
#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
|
||||
#include <stddef.h>
|
||||
#define __DEFINED_wchar_t
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
|
||||
#include <math.h>
|
||||
#define __DEFINED_float_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
|
||||
#include <math.h>
|
||||
#define __DEFINED_double_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
|
||||
#include <stddef.h>
|
||||
#define __DEFINED_max_align_t
|
||||
#endif
|
||||
#endif /* __ICCARM__ */
|
||||
|
||||
#ifndef __cplusplus
|
||||
TYPEDEF unsigned wchar_t;
|
||||
#endif
|
||||
|
||||
TYPEDEF float float_t;
|
||||
TYPEDEF double double_t;
|
||||
|
||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||
@@ -1,200 +0,0 @@
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#define __BIG_ENDIAN 4321
|
||||
#define __USE_TIME_BITS64 1
|
||||
|
||||
#ifdef __ICCARM__
|
||||
#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
|
||||
#include <stddef.h>
|
||||
#define __DEFINED_size_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_uintptr_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
|
||||
#include <stddef.h>
|
||||
#define __DEFINED_ptrdiff_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_intptr_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
|
||||
#include <time.h>
|
||||
#define __DEFINED_time_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
|
||||
#include <time.h>
|
||||
#define __DEFINED_clock_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
|
||||
#include <time.h>
|
||||
#define __DEFINED_struct_timespec
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
|
||||
#include <wchar.h>
|
||||
#define __DEFINED_wint_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t)
|
||||
#include <wchar.h>
|
||||
#define __DEFINED_wctype_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
|
||||
#include <stdarg.h>
|
||||
#define __DEFINED_va_list
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t)
|
||||
#include <wchar.h>
|
||||
#define __DEFINED_mbstate_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t) && defined(__INT8_T_TYPE__)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_int8_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t) && defined(__INT16_T_TYPE__)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_int16_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t) && defined(__INT32_T_TYPE__)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_int32_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t) && defined(__INT64_T_TYPE__)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_int64_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t) && defined(__UINT8_T_TYPE__)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_uint8_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t) && defined(__UINT16_T_TYPE__)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_uint16_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t) && defined(__UINT32_T_TYPE__)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_uint32_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t) && defined(__UINT64_T_TYPE__)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_uint64_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_intmax_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
|
||||
#include <stdint.h>
|
||||
#define __DEFINED_uintmax_t
|
||||
#endif
|
||||
#endif /* __ICCARM__ */
|
||||
|
||||
TYPEDEF unsigned _Addr size_t;
|
||||
TYPEDEF unsigned _Addr uintptr_t;
|
||||
TYPEDEF _Addr ptrdiff_t;
|
||||
TYPEDEF _Addr ssize_t;
|
||||
TYPEDEF _Addr intptr_t;
|
||||
TYPEDEF _Addr regoff_t;
|
||||
TYPEDEF _Reg register_t;
|
||||
TYPEDEF _Int64 time_t;
|
||||
TYPEDEF _Int64 suseconds_t;
|
||||
|
||||
TYPEDEF signed char int8_t;
|
||||
TYPEDEF signed short int16_t;
|
||||
TYPEDEF signed int int32_t;
|
||||
TYPEDEF signed _Int64 int64_t;
|
||||
TYPEDEF signed _Int64 intmax_t;
|
||||
TYPEDEF unsigned char uint8_t;
|
||||
TYPEDEF unsigned short uint16_t;
|
||||
TYPEDEF unsigned int uint32_t;
|
||||
TYPEDEF unsigned _Int64 uint64_t;
|
||||
TYPEDEF unsigned _Int64 u_int64_t;
|
||||
TYPEDEF unsigned _Int64 uintmax_t;
|
||||
|
||||
TYPEDEF unsigned mode_t;
|
||||
TYPEDEF unsigned _Reg nlink_t;
|
||||
TYPEDEF _Int64 off_t;
|
||||
TYPEDEF unsigned _Int64 ino_t;
|
||||
TYPEDEF unsigned _Int64 dev_t;
|
||||
TYPEDEF long blksize_t;
|
||||
TYPEDEF _Int64 blkcnt_t;
|
||||
TYPEDEF unsigned _Int64 fsblkcnt_t;
|
||||
TYPEDEF unsigned _Int64 fsfilcnt_t;
|
||||
|
||||
TYPEDEF unsigned wint_t;
|
||||
TYPEDEF unsigned long wctype_t;
|
||||
|
||||
TYPEDEF void * timer_t;
|
||||
TYPEDEF int clockid_t;
|
||||
TYPEDEF long clock_t;
|
||||
STRUCT timeval { time_t tv_sec; suseconds_t tv_usec; };
|
||||
STRUCT timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
|
||||
|
||||
TYPEDEF int pid_t;
|
||||
TYPEDEF unsigned id_t;
|
||||
TYPEDEF unsigned uid_t;
|
||||
TYPEDEF unsigned gid_t;
|
||||
TYPEDEF int key_t;
|
||||
TYPEDEF unsigned useconds_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
TYPEDEF unsigned long pthread_t;
|
||||
#else
|
||||
TYPEDEF struct __pthread * pthread_t;
|
||||
#endif
|
||||
TYPEDEF int pthread_once_t;
|
||||
TYPEDEF unsigned pthread_key_t;
|
||||
TYPEDEF int pthread_spinlock_t;
|
||||
TYPEDEF struct { unsigned __attr; } pthread_mutexattr_t;
|
||||
TYPEDEF struct { unsigned __attr; } pthread_condattr_t;
|
||||
TYPEDEF struct { unsigned __attr; } pthread_barrierattr_t;
|
||||
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
|
||||
|
||||
STRUCT _IO_FILE { char __x; };
|
||||
TYPEDEF struct _IO_FILE FILE;
|
||||
|
||||
TYPEDEF __builtin_va_list va_list;
|
||||
TYPEDEF __builtin_va_list __isoc_va_list;
|
||||
|
||||
TYPEDEF struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
|
||||
|
||||
TYPEDEF struct __locale_struct * locale_t;
|
||||
|
||||
TYPEDEF struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
|
||||
|
||||
STRUCT iovec { void *iov_base; size_t iov_len; };
|
||||
|
||||
TYPEDEF unsigned socklen_t;
|
||||
TYPEDEF unsigned short sa_family_t;
|
||||
|
||||
TYPEDEF struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;
|
||||
TYPEDEF struct { unsigned int magic; unsigned int handle; } pthread_mutex_t;
|
||||
TYPEDEF struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t;
|
||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
|
||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t;
|
||||
TYPEDEF struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t;
|
||||
TYPEDEF struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t;
|
||||
|
||||
#undef _Addr
|
||||
#undef _Int64
|
||||
#undef _Reg
|
||||
Executable → Regular
+14
-45
@@ -68,6 +68,8 @@ struct dso {
|
||||
size_t *lazy, lazy_cnt;
|
||||
unsigned char *map;
|
||||
size_t map_len;
|
||||
dev_t dev;
|
||||
ino_t ino;
|
||||
char relocated;
|
||||
char constructed;
|
||||
char kernel_mapped;
|
||||
@@ -754,20 +756,6 @@ static void *map_library(int fd, struct dso *dso)
|
||||
prot = (((ph->p_flags&PF_R) ? PROT_READ : 0) |
|
||||
((ph->p_flags&PF_W) ? PROT_WRITE: 0) |
|
||||
((ph->p_flags&PF_X) ? PROT_EXEC : 0));
|
||||
if ((ph->p_flags & PF_R) && (ph->p_flags & PF_X) && (!(ph->p_flags & PF_W))) {
|
||||
Phdr *next_ph = ph;
|
||||
for (int j = i - 1; j > 0; j--) {
|
||||
next_ph = (void *)((char *)next_ph+eh->e_phentsize);
|
||||
if (next_ph->p_type != PT_LOAD) {
|
||||
continue;
|
||||
}
|
||||
size_t p_vaddr = (next_ph->p_vaddr & -(PAGE_SIZE));
|
||||
if (p_vaddr > this_max) {
|
||||
mprotect(base + this_max, p_vaddr - this_max , PROT_READ);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Reuse the existing mapping for the lowest-address LOAD */
|
||||
if ((ph->p_vaddr & -PAGE_SIZE) != addr_min || DL_NOMMU_SUPPORT)
|
||||
if (mmap_fixed(base+this_min, this_max-this_min, prot, MAP_PRIVATE|MAP_FIXED, fd, off_start) == MAP_FAILED)
|
||||
@@ -810,7 +798,7 @@ static int path_open(const char *name, const char *s, char *buf, size_t buf_size
|
||||
l = strcspn(s, ":\n");
|
||||
if (l-1 >= INT_MAX) return -1;
|
||||
if (snprintf(buf, buf_size, "%.*s/%s", (int)l, s, name) < buf_size) {
|
||||
if ((fd = open(buf, O_RDONLY))>=0) return fd; // open(buf, O_RDONLY|O_CLOEXEC)
|
||||
if ((fd = open(buf, O_RDONLY|O_CLOEXEC))>=0) return fd;
|
||||
switch (errno) {
|
||||
case ENOENT:
|
||||
case ENOTDIR:
|
||||
@@ -986,7 +974,6 @@ static void makefuncdescs(struct dso *p)
|
||||
static struct dso *load_library(const char *name, struct dso *needed_by)
|
||||
{
|
||||
char buf[2*NAME_MAX+2];
|
||||
char fullpath[2*NAME_MAX+2];
|
||||
const char *pathname;
|
||||
unsigned char *map;
|
||||
struct dso *p, temp_dso = {0};
|
||||
@@ -1038,7 +1025,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
|
||||
}
|
||||
if (strchr(name, '/')) {
|
||||
pathname = name;
|
||||
fd = open(name, O_RDONLY); // open(name, O_RDONLY|O_CLOEXEC);
|
||||
fd = open(name, O_RDONLY|O_CLOEXEC);
|
||||
} else {
|
||||
/* Search for the name to see if it's already loaded */
|
||||
for (p=head->next; p; p=p->next) {
|
||||
@@ -1087,23 +1074,18 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
|
||||
sys_path = "";
|
||||
}
|
||||
}
|
||||
if (!sys_path || sys_path[0] == 0) sys_path = "/usr/lib:/lib:/usr/local/lib";
|
||||
if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib";
|
||||
fd = path_open(name, sys_path, buf, sizeof buf);
|
||||
}
|
||||
pathname = buf;
|
||||
}
|
||||
if (fd < 0) return 0;
|
||||
|
||||
if (pathname[0] != '/') {
|
||||
if (!realpath(pathname, fullpath)) {
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
pathname = fullpath;
|
||||
if (fstat(fd, &st) < 0) {
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (p=head->next; p; p=p->next) {
|
||||
if (!strcmp(p->name, pathname)) {
|
||||
if (p->dev == st.st_dev && p->ino == st.st_ino) {
|
||||
/* If this library was previously loaded with a
|
||||
* pathname but a search found the same inode,
|
||||
* setup its shortname so it can be found by name. */
|
||||
@@ -1114,6 +1096,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
|
||||
}
|
||||
}
|
||||
map = noload ? 0 : map_library(fd, &temp_dso);
|
||||
close(fd);
|
||||
if (!map) return 0;
|
||||
|
||||
/* Avoid the danger of getting two versions of libc mapped into the
|
||||
@@ -1150,6 +1133,8 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
|
||||
return 0;
|
||||
}
|
||||
memcpy(p, &temp_dso, sizeof temp_dso);
|
||||
p->dev = st.st_dev;
|
||||
p->ino = st.st_ino;
|
||||
p->needed_by = needed_by;
|
||||
p->name = p->buf;
|
||||
p->runtime_loaded = runtime;
|
||||
@@ -1757,18 +1742,11 @@ void __dls3(size_t *sp, size_t *auxv)
|
||||
if (DL_FDPIC) app.loadmap = app_loadmap;
|
||||
if (app.tls.size) app.tls.image = laddr(&app, tls_image);
|
||||
if (interp_off) ldso.name = laddr(&app, interp_off);
|
||||
#if 0
|
||||
if ((aux[0] & (1UL<<AT_EXECFN))
|
||||
&& strncmp((char *)aux[AT_EXECFN], "/proc/", 6))
|
||||
app.name = (char *)aux[AT_EXECFN];
|
||||
else
|
||||
app.name = argv[0];
|
||||
#else
|
||||
if (argv[0])
|
||||
app.name = argv[0];
|
||||
else
|
||||
app.name = "none";
|
||||
#endif
|
||||
kernel_mapped_dso(&app);
|
||||
} else {
|
||||
int fd;
|
||||
@@ -1819,6 +1797,7 @@ void __dls3(size_t *sp, size_t *auxv)
|
||||
dprintf(2, "%s: %s: Not a valid dynamic program\n", ldname, argv[0]);
|
||||
_exit(1);
|
||||
}
|
||||
close(fd);
|
||||
ldso.name = ldname;
|
||||
app.name = argv[0];
|
||||
aux[AT_ENTRY] = (size_t)laddr(&app, ehdr->e_entry);
|
||||
@@ -1889,7 +1868,7 @@ void __dls3(size_t *sp, size_t *auxv)
|
||||
vdso.base = (void *)(vdso_base - phdr->p_vaddr + phdr->p_offset);
|
||||
}
|
||||
vdso.name = "";
|
||||
vdso.shortname = "OHOS-vdso.so";
|
||||
vdso.shortname = "linux-gate.so.1";
|
||||
vdso.relocated = 1;
|
||||
vdso.deps = (struct dso **)no_deps;
|
||||
decode_dyn(&vdso);
|
||||
@@ -2012,16 +1991,6 @@ void *dlopen(const char *file, int mode)
|
||||
jmp_buf jb;
|
||||
struct dso **volatile ctor_queue = 0;
|
||||
|
||||
if (mode & ~(RTLD_LAZY | RTLD_NOW | RTLD_NOLOAD | RTLD_GLOBAL | RTLD_LOCAL | RTLD_NODELETE)) {
|
||||
error("invalid mode parameter for dlopen().");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((mode & (RTLD_LAZY | RTLD_NOW)) == 0) {
|
||||
error("invalid mode, one of RTLD_LAZY and RTLD_NOW must be set.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!file) return head;
|
||||
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include <wchar.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict wcs, size_t wn, size_t n, mbstate_t *restrict st)
|
||||
{
|
||||
const wchar_t *ws = *wcs;
|
||||
size_t cnt = 0;
|
||||
if (!dst) n=0;
|
||||
while (ws && wn) {
|
||||
char tmp[MB_LEN_MAX];
|
||||
size_t l = wcrtomb(n<MB_LEN_MAX ? tmp : dst, *ws, 0);
|
||||
if (l==-1) {
|
||||
cnt = -1;
|
||||
break;
|
||||
}
|
||||
if (dst) {
|
||||
if (n<MB_LEN_MAX) {
|
||||
if (l>n) break;
|
||||
memcpy(dst, tmp, l);
|
||||
}
|
||||
dst += l;
|
||||
n -= l;
|
||||
}
|
||||
if (!*ws) {
|
||||
ws = 0;
|
||||
break;
|
||||
}
|
||||
ws++;
|
||||
wn--;
|
||||
cnt += l;
|
||||
}
|
||||
if (dst) *wcs = ws;
|
||||
return cnt;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
in_addr_t inet_network(const char *p)
|
||||
{
|
||||
return ntohl(inet_addr(p));
|
||||
}
|
||||
|
||||
struct in_addr inet_makeaddr(in_addr_t n, in_addr_t h)
|
||||
{
|
||||
if (n < 256) h |= n<<24;
|
||||
else if (n < 65536) h |= n<<16;
|
||||
else h |= n<<8;
|
||||
return (struct in_addr){ htonl(h) };
|
||||
}
|
||||
|
||||
in_addr_t inet_lnaof(struct in_addr in)
|
||||
{
|
||||
uint32_t h = ntohl(in.s_addr);
|
||||
if (h>>24 < 128) return h & 0xffffff;
|
||||
if (h>>24 < 192) return h & 0xffff;
|
||||
return h & 0xff;
|
||||
}
|
||||
|
||||
in_addr_t inet_netof(struct in_addr in)
|
||||
{
|
||||
uint32_t h = ntohl(in.s_addr);
|
||||
if (h>>24 < 128) return h >> 24;
|
||||
if (h>>24 < 192) return h >> 16;
|
||||
return h >> 8;
|
||||
}
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user