This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, upstream has been updated
via 9930f8b92bb47b2dbea7679d948e3ecfbce23ca9 (commit)
via c058c0578db7b036fabdda6f98be567232d00e6e (commit)
via e158f13f3d80bd7a4e85c026a30fc85e06beb368 (commit)
via 8c79e4541e1258220be822670b22b1b9572e70a8 (commit)
via dc19aa547995f92b89449ed9ebb69ea08b2098ca (commit)
via 5e3820a8c616be4eaa1bdd1a55a713cb3a564537 (commit)
via 62775f4518169222d70d9ba2465e938df236aef9 (commit)
via 7a8856c38c50a2790443bd2c03d5f4d4c8c36fe5 (commit)
via 274f3c84562cbba1d99bab2d085d22d8aa401a4e (commit)
via ec0827d3c2af5c9569c04cbb6f57a3c581583722 (commit)
via fe7d30e6337f280a451ac057f47d48349b63e462 (commit)
from bfbcc35b0ff8e40570a99872fd538e344d8c7f75 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9930f8b92bb47b2dbea7679d948e3ecfbce23ca9
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu May 28 17:05:43 2015 +0200
getconf.c: undef VERSION
might come in via nptl so undef it before redefining it
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit c058c0578db7b036fabdda6f98be567232d00e6e
Author: Alexey Brodkin <Alexey.Brodkin(a)synopsys.com>
Date: Mon May 25 13:50:42 2015 +0300
ARC: enable IPv6 in defconfigs
These days IPv6 is used more and more in different software
packages. And so we're adding IPv6 support by default in uClibc
for ARC cores.
Signed-off-by: Alexey Brodkin <Alexey.Brodkin(a)synopsys.com>
Cc: Vineet Gupta <vgupta(a)synopsys.com>
Cc: Anton Kolesov <akolesov(a)synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit e158f13f3d80bd7a4e85c026a30fc85e06beb368
Author: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Date: Sun May 24 02:06:27 2015 +0900
h8300: Makefile update
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 8c79e4541e1258220be822670b22b1b9572e70a8
Author: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Date: Sun May 24 02:06:26 2015 +0900
h8300: Add new feature
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit dc19aa547995f92b89449ed9ebb69ea08b2098ca
Author: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Date: Sun May 24 02:06:25 2015 +0900
h8300: headers update
- wire up new kernel
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 5e3820a8c616be4eaa1bdd1a55a713cb3a564537
Author: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Date: Sun May 24 02:06:24 2015 +0900
h8300: Assembly functions
- remove symbol prefix
- new startup
- new clone syscall support
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 62775f4518169222d70d9ba2465e938df236aef9
Author: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Date: Sun May 24 02:06:23 2015 +0900
h8300: 64bit integer support
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 7a8856c38c50a2790443bd2c03d5f4d4c8c36fe5
Author: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Date: Sun May 24 02:06:22 2015 +0900
h8300: config update
- New toolchain
- Add new flags
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 274f3c84562cbba1d99bab2d085d22d8aa401a4e
Author: Daniel Golle <daniel(a)makrotopia.org>
Date: Sun May 17 22:49:23 2015 +0200
siginfo: add signal info for seccomp related SIGSYS
uClibc doesn't define signal info for the SIGSYS signal which is issued
in case of hitting a syscall prohibited by seccomp.
This is sad as it makes debugging seccomp filter policies impossible on
some architectures (at least ARM and PowerPC, maybe also others) which
do not coincidentally set si_value.sival_int as the syscall number.
To fix this, import the definitions and macros needed from glibc.
Signed-off-by: Daniel Golle <daniel(a)makrotopia.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit ec0827d3c2af5c9569c04cbb6f57a3c581583722
Author: Andrew Burgess <andrew.burgess(a)embecosm.com>
Date: Thu May 7 16:12:02 2015 +0100
test/silly: Extend include path.
When attempting to build uClibc under buildroot, including building the
tests, the silly tests don't currently compile, a result of attempting
to build using a compiler that does not yet have an installed version of
uClibc available. The error is a missing header file, specifically
atomic.h.
Taking inspiration from the nptl tests, I have extended the EXTRA_CFLAGS
variable to add the required include paths. The tests can now be built
under buildroot.
Signed-off-by: Andrew Burgess <andrew.burgess(a)embecosm.com>
Acked-by: Vineet Gupta <vgupta(a)synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit fe7d30e6337f280a451ac057f47d48349b63e462
Author: Will Newton <will.newton(a)imgtec.com>
Date: Fri May 8 01:15:19 2015 +0300
_scanf.c: Implement 'm' modifier for 'c' and '[' conversions.
The current code implements the 'm' modifier only for 's'
conversions and would cause a segfault if it was used for 'c'
or '[' conversions. This patch extends the code to cover these
cases too.
The original version could write scanned data outside the passed buffer
because index i used in the '[' conversion handling block was clobbered.
Signed-off-by: Will Newton <will.newton(a)imgtec.com>
Signed-off-by: Max Filippov <jcmvbkbc(a)gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
-----------------------------------------------------------------------
Summary of changes:
Rules.mak | 5 +-
extra/Configs/Config.h8300 | 5 +-
extra/Configs/Config.in | 2 +-
extra/Configs/defconfigs/arc/arcv2_defconfig | 1 +
extra/Configs/defconfigs/arc/defconfig | 1 +
include/stdint.h | 10 -
ldso/ldso/h8300/dl-sysdep.h | 1 +
libc/stdio/_scanf.c | 51 +++--
libc/sysdeps/linux/alpha/bits/siginfo.h | 11 +
libc/sysdeps/linux/common/bits/siginfo.h | 11 +
libc/sysdeps/linux/h8300/Makefile | 70 +------
libc/sysdeps/linux/h8300/Makefile.arch | 10 +
libc/sysdeps/linux/h8300/__longjmp.S | 6 +-
libc/sysdeps/linux/h8300/bits/byteswap.h | 15 +-
libc/sysdeps/linux/h8300/bits/fcntl.h | 7 +-
libc/sysdeps/linux/h8300/bits/kernel_stat.h | 50 -----
libc/sysdeps/linux/h8300/bits/kernel_types.h | 13 ++
libc/sysdeps/linux/h8300/bits/syscalls.h | 214 +++++++-------------
.../linux/h8300/bits/uClibc_arch_features.h | 2 +-
libc/sysdeps/linux/h8300/bsd-_setjmp.S | 10 +-
libc/sysdeps/linux/h8300/bsd-setjmp.S | 13 +-
libc/sysdeps/linux/h8300/clone.S | 36 +++-
libc/sysdeps/linux/h8300/{crt0.S => crt1.S} | 38 +++-
libc/sysdeps/linux/h8300/crti.S | 8 +-
libc/sysdeps/linux/h8300/crtn.S | 4 +-
libc/sysdeps/linux/h8300/setjmp.S | 4 +-
libc/sysdeps/linux/h8300/vfork.S | 54 +++--
libc/sysdeps/linux/ia64/bits/siginfo.h | 11 +
libc/sysdeps/linux/mips/bits/siginfo.h | 11 +
libc/sysdeps/linux/sparc/bits/siginfo.h | 11 +
test/silly/Makefile.in | 7 +
test/stdio/scanf_m.c | 24 +++
utils/getconf.c | 1 +
33 files changed, 363 insertions(+), 354 deletions(-)
create mode 100644 ldso/ldso/h8300/dl-sysdep.h
create mode 100644 libc/sysdeps/linux/h8300/Makefile.arch
delete mode 100644 libc/sysdeps/linux/h8300/bits/kernel_stat.h
rename libc/sysdeps/linux/h8300/{crt0.S => crt1.S} (66%)
create mode 100644 test/stdio/scanf_m.c
diff --git a/Rules.mak b/Rules.mak
index aa2e3a7..de9ffb3 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -455,9 +455,8 @@ ifeq ($(TARGET_ARCH),sh64)
endif
ifeq ($(TARGET_ARCH),h8300)
- SYMBOL_PREFIX=_
- CPU_LDFLAGS-$(CONFIG_H8300H)+= -Wl,-ms8300h
- CPU_LDFLAGS-$(CONFIG_H8S) += -Wl,-ms8300s
+ CPU_LDFLAGS-$(CONFIG_H8300H)+= -Wl,-mh8300h_linux
+ CPU_LDFLAGS-$(CONFIG_H8S) += -Wl,-mh8300s_linux
CPU_CFLAGS-$(CONFIG_H8300H) += -mh -mint32
CPU_CFLAGS-$(CONFIG_H8S) += -ms -mint32
endif
diff --git a/extra/Configs/Config.h8300 b/extra/Configs/Config.h8300
index 458851b..0c5486c 100644
--- a/extra/Configs/Config.h8300
+++ b/extra/Configs/Config.h8300
@@ -10,9 +10,10 @@ config TARGET_ARCH
config FORCE_OPTIONS_FOR_ARCH
bool
default y
- select ARCH_ANY_ENDIAN
+ select ARCH_BIG_ENDIAN
select ARCH_HAS_NO_MMU
- select ARCH_HAS_DEPRECATED_SYSCALLS
+ select ARCH_HAS_NO_LDSO
+ select HAVE_NO_PIC
choice
prompt "Target Processor"
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 1fd6860..242e45a 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -73,7 +73,7 @@ config TARGET_frv
bool "frv (BROKEN)"
config TARGET_h8300
- bool "h8300 (BROKEN)"
+ bool "h8300"
config TARGET_hppa
bool "hppa"
diff --git a/extra/Configs/defconfigs/arc/arcv2_defconfig
b/extra/Configs/defconfigs/arc/arcv2_defconfig
index 1e204aa..9e34694 100644
--- a/extra/Configs/defconfigs/arc/arcv2_defconfig
+++ b/extra/Configs/defconfigs/arc/arcv2_defconfig
@@ -19,6 +19,7 @@ UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
UCLIBC_HAS_LIBUTIL=y
UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
UCLIBC_SV4_DEPRECATED=y
+UCLIBC_HAS_IPV6=y
UCLIBC_HAS_RPC=y
UCLIBC_HAS_FULL_RPC=y
UCLIBC_USE_NETLINK=y
diff --git a/extra/Configs/defconfigs/arc/defconfig
b/extra/Configs/defconfigs/arc/defconfig
index 994abeb..bd93696 100644
--- a/extra/Configs/defconfigs/arc/defconfig
+++ b/extra/Configs/defconfigs/arc/defconfig
@@ -18,6 +18,7 @@ UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
UCLIBC_HAS_LIBUTIL=y
UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
UCLIBC_SV4_DEPRECATED=y
+UCLIBC_HAS_IPV6=y
UCLIBC_HAS_RPC=y
UCLIBC_HAS_FULL_RPC=y
UCLIBC_USE_NETLINK=y
diff --git a/include/stdint.h b/include/stdint.h
index b134925..9ca8445 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -238,7 +238,6 @@ typedef unsigned long long int uintmax_t;
# endif
-#if !defined(__H8300H__) && !defined(__H8300S__)
/* Minimum for largest signed integral type. */
# define INTMAX_MIN (-__INT64_C(9223372036854775807)-1)
/* Maximum for largest signed integral type. */
@@ -246,15 +245,6 @@ typedef unsigned long long int uintmax_t;
/* Maximum for largest unsigned integral type. */
# define UINTMAX_MAX (__UINT64_C(18446744073709551615))
-#else
-/* Minimum for largest signed integral type. */
-# define INTMAX_MIN (-LONG_LONG_MAX-1)
-/* Maximum for largest signed integral type. */
-# define INTMAX_MAX (LONG_LONG_MAX)
-
-/* Maximum for largest unsigned integral type. */
-# define UINTMAX_MAX (LONG_LONG_MAX<<1+1)
-#endif
/* Limits of other integer types. */
diff --git a/ldso/ldso/h8300/dl-sysdep.h b/ldso/ldso/h8300/dl-sysdep.h
new file mode 100644
index 0000000..880d048
--- /dev/null
+++ b/ldso/ldso/h8300/dl-sysdep.h
@@ -0,0 +1 @@
+/* dl not supported */
diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c
index 6ecb3cb..a5828c3 100644
--- a/libc/stdio/_scanf.c
+++ b/libc/stdio/_scanf.c
@@ -1352,7 +1352,20 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format,
va_list arg)
(psfs.conv_num >= CONV_c)
#endif /* __UCLIBC_HAS_WCHAR__ */
{
+ /* We might have to handle the allocation ourselves */
+ int len;
+ unsigned char **ptr;
+
b = (psfs.store ? ((unsigned char *) psfs.cur_ptr) : buf);
+ /* With 'm', we actually got a pointer to a pointer */
+ ptr = (void *)b;
+
+ if (psfs.flags & FLAG_MALLOC) {
+ len = 0;
+ b = NULL;
+ } else
+ len = -1;
+
fail = 1;
if (psfs.conv_num == CONV_c) {
@@ -1360,32 +1373,28 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format,
va_list arg)
sc.width = 1;
}
+ if (psfs.flags & FLAG_MALLOC)
+ b = malloc(sc.width);
+
+ i = 0;
while (__scan_getc(&sc) >= 0) {
zero_conversions = 0;
- *b = sc.cc;
- b += psfs.store;
+ b[i] = sc.cc;
+ i += psfs.store;
}
__scan_ungetc(&sc);
if (sc.width > 0) { /* Failed to read all required. */
goto DONE;
}
+ if (psfs.flags & FLAG_MALLOC)
+ *ptr = b;
psfs.cnt += psfs.store;
goto NEXT_FMT;
}
if (psfs.conv_num == CONV_s) {
- /* We might have to handle the allocation ourselves */
- int len;
- /* With 'm', we actually got a pointer to a pointer */
- unsigned char **ptr = (void *)b;
i = 0;
- if (psfs.flags & FLAG_MALLOC) {
- len = 0;
- b = NULL;
- } else
- len = -1;
-
/* Yes, believe it or not, a %s conversion can store nuls. */
while ((__scan_getc(&sc) >= 0) && !isspace(sc.cc)) {
zero_conversions = 0;
@@ -1400,10 +1409,6 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format,
va_list arg)
fail = 0;
}
- if (psfs.flags & FLAG_MALLOC)
- *ptr = b;
- /* The code below takes care of terminating NUL */
- b += i;
} else {
#ifdef __UCLIBC_HAS_WCHAR__
assert((psfs.conv_num == CONV_LEFTBRACKET) || \
@@ -1454,13 +1459,20 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format,
va_list arg)
#endif /* __UCLIBC_HAS_WCHAR__ */
+ i = 0;
while (__scan_getc(&sc) >= 0) {
zero_conversions = 0;
if (!scanset[sc.cc]) {
break;
}
- *b = sc.cc;
- b += psfs.store;
+ if (i == len) {
+ /* Pick a size that won't trigger a lot of
+ * mallocs early on ... */
+ len += 256;
+ b = realloc(b, len + 1);
+ }
+ b[i] = sc.cc;
+ i += psfs.store;
fail = 0;
}
}
@@ -1470,6 +1482,9 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format,
va_list arg)
if (fail) { /* nothing stored! */
goto DONE;
}
+ if (psfs.flags & FLAG_MALLOC)
+ *ptr = b;
+ b += i;
*b = 0; /* Nul-terminate string. */
psfs.cnt += psfs.store;
goto NEXT_FMT;
diff --git a/libc/sysdeps/linux/alpha/bits/siginfo.h
b/libc/sysdeps/linux/alpha/bits/siginfo.h
index 0a37ad0..7e476aa 100644
--- a/libc/sysdeps/linux/alpha/bits/siginfo.h
+++ b/libc/sysdeps/linux/alpha/bits/siginfo.h
@@ -97,6 +97,14 @@ typedef struct siginfo
int si_band; /* Band event for SIGPOLL. */
int si_fd;
} _sigpoll;
+
+ /* SIGSYS. */
+ struct
+ {
+ void *_call_addr; /* Calling user insn. */
+ int _syscall; /* Triggering system call number. */
+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
+ } _sigsys;
} _sifields;
} siginfo_t;
@@ -115,6 +123,9 @@ typedef struct siginfo
# define si_addr _sifields._sigfault.si_addr
# define si_band _sifields._sigpoll.si_band
# define si_fd _sifields._sigpoll.si_fd
+# define si_call_addr _sifields._sigsys._call_addr
+# define si_syscall _sifields._sigsys._syscall
+# define si_arch _sifields._sigsys._arch
/* Values for `si_code'. Positive values are reserved for kernel-generated
diff --git a/libc/sysdeps/linux/common/bits/siginfo.h
b/libc/sysdeps/linux/common/bits/siginfo.h
index c26e066..724f756 100644
--- a/libc/sysdeps/linux/common/bits/siginfo.h
+++ b/libc/sysdeps/linux/common/bits/siginfo.h
@@ -103,6 +103,14 @@ typedef struct siginfo
long int si_band; /* Band event for SIGPOLL. */
int si_fd;
} _sigpoll;
+
+ /* SIGSYS. */
+ struct
+ {
+ void *_call_addr; /* Calling user insn. */
+ int _syscall; /* Triggering system call number. */
+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
+ } _sigsys;
} _sifields;
} siginfo_t;
@@ -121,6 +129,9 @@ typedef struct siginfo
# define si_addr _sifields._sigfault.si_addr
# define si_band _sifields._sigpoll.si_band
# define si_fd _sifields._sigpoll.si_fd
+# define si_call_addr _sifields._sigsys._call_addr
+# define si_syscall _sifields._sigsys._syscall
+# define si_arch _sifields._sigsys._arch
/* Values for `si_code'. Positive values are reserved for kernel-generated
diff --git a/libc/sysdeps/linux/h8300/Makefile b/libc/sysdeps/linux/h8300/Makefile
index 2ab4ee6..5524623 100644
--- a/libc/sysdeps/linux/h8300/Makefile
+++ b/libc/sysdeps/linux/h8300/Makefile
@@ -1,65 +1,13 @@
# Makefile for uClibc
#
-# Copyright (C) 2000-2006 Erik Andersen <andersen(a)uclibc.org>
+# Copyright (C) 2015 Yoshinori Sato
+#
+# Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
#
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-
-TOPDIR=../../../../
-include $(TOPDIR)Rules.mak
-ifeq ($(DOPIC),y)
-# is this not provided by gcc ?
-ASFLAGS+=-D__PIC__
-endif
-
-#FIXME -- this arch should include its own crti.S and crtn.S
-UCLIBC_CTOR_DTOR=n
-
-CRT_SRC := crt0.S
-CRT_OBJ := crt0.o crt1.o
-CTOR_TARGETS := $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
-
-SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S
-SOBJ := $(patsubst %.S,%.o, $(SSRC))
-
-CSRC := ptrace.c brk.c
-COBJ := $(patsubst %.c,%.o, $(CSRC))
-
-OBJS := $(SOBJ) $(COBJ)
-
-OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH)
-
-all: $(OBJ_LIST) $(CTOR_TARGETS)
-
-$(OBJ_LIST): $(OBJS) $(CRT_OBJ)
- $(STRIPTOOL) -x -R .note -R .comment $^
- $(INSTALL) -d $(TOPDIR)lib/
- cp $(CRT_OBJ) $(TOPDIR)lib/
- echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $@
-
-$(CRT_OBJ): $(CRT_SRC)
- $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
-
-$(SOBJ): %.o : %.S
- $(CC) $(ASFLAGS) -c $< -o $@
-
-$(COBJ): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
-
-ifeq ($(UCLIBC_CTOR_DTOR),y)
-$(TOPDIR)lib/crti.o: crti.S
- $(INSTALL) -d $(TOPDIR)lib/
- $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@
-
-$(TOPDIR)lib/crtn.o: crtn.S
- $(INSTALL) -d $(TOPDIR)lib/
- $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@
-else
-$(CTOR_TARGETS):
- $(INSTALL) -d $(TOPDIR)lib/
- $(AR) $(ARFLAGS) $@
-endif
-
-headers:
-clean:
- $(RM) *.o *~ core
+top_srcdir=../../../../
+top_builddir=../../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.arch
+include $(top_srcdir)Makerules
diff --git a/libc/sysdeps/linux/h8300/Makefile.arch
b/libc/sysdeps/linux/h8300/Makefile.arch
new file mode 100644
index 0000000..371d3dd
--- /dev/null
+++ b/libc/sysdeps/linux/h8300/Makefile.arch
@@ -0,0 +1,10 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2015 Yoshinori Sato
+#
+# Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+#
+
+CSRC-y := brk.c ptrace.c
+
+SSRC-y := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S
diff --git a/libc/sysdeps/linux/h8300/__longjmp.S b/libc/sysdeps/linux/h8300/__longjmp.S
index eb433df..bcb0985 100644
--- a/libc/sysdeps/linux/h8300/__longjmp.S
+++ b/libc/sysdeps/linux/h8300/__longjmp.S
@@ -4,10 +4,10 @@
.h8300h
#endif
.text
-
-.global ___longjmp
-___longjmp:
+.global __longjmp
+
+__longjmp:
mov.l er1,er1
bne 1f
sub.l er1,er1
diff --git a/libc/sysdeps/linux/h8300/bits/byteswap.h
b/libc/sysdeps/linux/h8300/bits/byteswap.h
index 71a66c6..08ca99f 100644
--- a/libc/sysdeps/linux/h8300/bits/byteswap.h
+++ b/libc/sysdeps/linux/h8300/bits/byteswap.h
@@ -19,20 +19,7 @@
#ifndef _ASM_BITS_BYTESWAP_H
#define _ASM_BITS_BYTESWAP_H 1
-#define __bswap_non_constant_32(x) \
- __extension__ \
- ({ unsigned int __v; \
- __asm__ __volatile__ ("mov.l %0,er0\n\t" \
- "mov.b r0l,r1h\n\t" \
- "mov.b r0h,r1l\n\t" \
- "mov.w r1,e1\n\t" \
- "mov.w e0,r0\n\t" \
- "mov.b r0l,r1h\n\t" \
- "mov.b r0h,r1l\n\t" \
- "mov.l er1,%0" \
- : "=d" (__v) \
- : "0" (x): "er0","er1"); \
- __v; })
+#define __bswap_non_constant_32(x) __builtin_bswap32(x)
#endif
diff --git a/libc/sysdeps/linux/h8300/bits/fcntl.h
b/libc/sysdeps/linux/h8300/bits/fcntl.h
index 45deec4..1c653be 100644
--- a/libc/sysdeps/linux/h8300/bits/fcntl.h
+++ b/libc/sysdeps/linux/h8300/bits/fcntl.h
@@ -22,6 +22,9 @@
#include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
@@ -42,8 +45,10 @@
#ifdef __USE_GNU
# define O_DIRECTORY 040000 /* Must be a directory. */
-# define O_NOFOLLOW 0100000 /* Do not follow links. */
# define O_DIRECT 0200000 /* Direct disk access. */
+# define O_NOFOLLOW 0400000 /* Do not follow links. */
+# define O_NOATIME 01000000 /* Do not set atime. */
+# define O_CLOEXEC 02000000 /* Set close_on_exec. */
#endif
/* For now Linux has synchronisity options for data and read operations.
diff --git a/libc/sysdeps/linux/h8300/bits/kernel_stat.h
b/libc/sysdeps/linux/h8300/bits/kernel_stat.h
deleted file mode 100644
index 5f6c8ae..0000000
--- a/libc/sysdeps/linux/h8300/bits/kernel_stat.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef _BITS_STAT_STRUCT_H
-#define _BITS_STAT_STRUCT_H
-
-/* This file provides whatever this particular arch's kernel thinks
- * struct kernel_stat should look like... It turns out each arch has a
- * different opinion on the subject... */
-
-struct kernel_stat {
- unsigned short st_dev;
- unsigned short __pad1;
- unsigned long st_ino;
- unsigned short st_mode;
- unsigned short st_nlink;
- unsigned short st_uid;
- unsigned short st_gid;
- unsigned short st_rdev;
- unsigned short __pad2;
- unsigned long st_size;
- unsigned long st_blksize;
- unsigned long st_blocks;
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-struct kernel_stat64 {
- unsigned long long st_dev;
- unsigned char __pad1[2];
-#define _HAVE_STAT64___ST_INO
- unsigned long __st_ino;
- unsigned int st_mode;
- unsigned int st_nlink;
- unsigned long st_uid;
- unsigned long st_gid;
- unsigned short st_rdev;
- unsigned char __pad3[10];
- long long st_size;
- unsigned long st_blksize;
- unsigned long st_blocks; /* Number 512-byte blocks allocated. */
- unsigned long __pad4; /* future possible st_blocks high bits */
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
- unsigned long long st_ino;
-};
-
-#endif /* _BITS_STAT_STRUCT_H */
-
diff --git a/libc/sysdeps/linux/h8300/bits/kernel_types.h
b/libc/sysdeps/linux/h8300/bits/kernel_types.h
index 4cfd1bf..7e76891 100644
--- a/libc/sysdeps/linux/h8300/bits/kernel_types.h
+++ b/libc/sysdeps/linux/h8300/bits/kernel_types.h
@@ -35,6 +35,18 @@ typedef __kernel_dev_t __kernel_old_dev_t;
typedef long __kernel_long_t;
typedef unsigned long __kernel_ulong_t;
+#define __kernel_long_t __kernel_long_t
+#define __kernel_ino_t __kernel_ino_t
+#define __kernel_mode_t __kernel_mode_t
+#define __kernel_pid_t __kernel_pid_t
+#define __kernel_ipc_pid_t __kernel_ipc_pid_t
+#define __kernel_uid_t __kernel_uid_t
+#define __kernel_susecond_t __kernel_susecond_t
+#define __kernel_daddr_t __kernel_daddr_t
+#define __kernel_uid32_t __kernel_uid32_t
+#define __kernel_old_uid_t __kernel_old_uid_t
+#define __kernel_old_dev_t __kernel_old_dev_t
+
typedef struct {
#ifdef __USE_ALL
int val[2];
@@ -42,5 +54,6 @@ typedef struct {
int __val[2];
#endif
} __kernel_fsid_t;
+#define __kernel_fsid_t __kernel_fsid_t
#endif /* _BITS_KERNEL_TYPES_H */
diff --git a/libc/sysdeps/linux/h8300/bits/syscalls.h
b/libc/sysdeps/linux/h8300/bits/syscalls.h
index 5867ed6..b43795f 100644
--- a/libc/sysdeps/linux/h8300/bits/syscalls.h
+++ b/libc/sysdeps/linux/h8300/bits/syscalls.h
@@ -1,151 +1,85 @@
-/* Unlike the asm/unistd.h kernel header file (which this is partly based on),
- * this file must be able to cope with PIC and non-PIC code. For some arches
- * there is no difference. For x86 (which has far too few registers) there is
- * a difference. Regardless, including asm/unistd.h is hereby officially
- * forbidden. Don't do it. It is bad for you.
- */
+#ifndef _BITS_SYSCALLS_H
+#define _BITS_SYSCALLS_H
#ifndef _SYSCALL_H
# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h>
instead."
#endif
-#define __syscall_return(type, res) \
-do { \
- if ((unsigned long)(res) >= (unsigned long)(-125)) { \
- /* avoid using res which is declared to be in register d0; \
- errno might expand to a function call and clobber it. */ \
- int __err = -(res); \
- errno = __err; \
- res = -1; \
- } \
- return (type) (res); \
-} while (0)
+#ifndef __ASSEMBLER__
-#define _syscall0(type, name) \
-type name(void) \
-{ \
- register long __res __asm__("er0"); \
- __asm__ __volatile__ ("mov.l %1,er0\n\t" \
- "trapa #0\n\t" \
- : "=r" (__res) \
- : "ir" (__NR_##name) \
- : "cc"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- errno = -__res; \
- __res = -1; \
- } \
- return (type)__res; \
-}
+#include <errno.h>
-#define _syscall1(type, name, atype, a) \
-type name(atype a) \
-{ \
- register long __res __asm__("er0"); \
- __asm__ __volatile__ ("mov.l %2, er1\n\t" \
- "mov.l %1, er0\n\t" \
- "trapa #0\n\t" \
- : "=r" (__res) \
- : "ir" (__NR_##name), \
- "g" ((long)a) \
- : "cc", "er1"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- errno = -__res; \
- __res = -1; \
- } \
- return (type)__res; \
-}
+#define ASMFMT_0
+#define ASMFMT_1 , "g"(er1)
+#define ASMFMT_2 , "g"(er1), "g"(er2)
+#define ASMFMT_3 , "g"(er1), "g"(er2), "g"(er3)
+#define ASMFMT_4 , "g"(er1), "g"(er2), "g"(er3),
"g"(er4)
+#define ASMFMT_5 , "g"(er1), "g"(er2), "g"(er3),
"g"(er4), "g"(er5)
+#define ASMFMT_6 , "g"(er1), "g"(er2), "g"(er3),
"g"(er4), "m"(er5), "m"(er6)
-#define _syscall2(type, name, atype, a, btype, b) \
-type name(atype a, btype b) \
-{ \
- register long __res __asm__("er0"); \
- __asm__ __volatile__ ("mov.l %3, er2\n\t" \
- "mov.l %2, er1\n\t" \
- "mov.l %1, er0\n\t" \
- "trapa #0\n\t" \
- : "=r" (__res) \
- : "ir" (__NR_##name), \
- "g" ((long)a), \
- "g" ((long)b) \
- : "cc", "er1", "er2"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- errno = -__res; \
- __res = -1; \
- } \
- return (type)__res; \
-}
+#define SUBSTITUTE_ARGS_0() do {} while(0);
+#define SUBSTITUTE_ARGS_1(arg1) \
+ register long int er1 __asm__("er1") = (long int)arg1;
+#define SUBSTITUTE_ARGS_2(arg1, arg2) \
+ register long int er1 __asm__("er1") = (long int)arg1; \
+ register long int er2 __asm__("er2") = (long int)arg2;
+#define SUBSTITUTE_ARGS_3(arg1, arg2, arg3) \
+ register long int er1 __asm__("er1") = (long int)arg1; \
+ register long int er2 __asm__("er2") = (long int)arg2; \
+ register long int er3 __asm__("er3") = (long int)arg3;
+#define SUBSTITUTE_ARGS_4(arg1, arg2, arg3, arg4) \
+ register long int er1 __asm__("er1") = (long int)arg1; \
+ register long int er2 __asm__("er2") = (long int)arg2; \
+ register long int er3 __asm__("er3") = (long int)arg3; \
+ register long int er4 __asm__("er4") = (long int)arg4;
+#define SUBSTITUTE_ARGS_5(arg1, arg2, arg3, arg4, arg5) \
+ register long int er1 __asm__("er1") = (long int)arg1; \
+ register long int er2 __asm__("er2") = (long int)arg2; \
+ register long int er3 __asm__("er3") = (long int)arg3; \
+ register long int er4 __asm__("er4") = (long int)arg4; \
+ register long int er5 __asm__("er5") = (long int)arg5;
+#define SUBSTITUTE_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+ register long int er1 __asm__("er1") = (long int)arg1; \
+ register long int er2 __asm__("er2") = (long int)arg2; \
+ register long int er3 __asm__("er3") = (long int)arg3; \
+ register long int er4 __asm__("er4") = (long int)arg4; \
+ long int er5 = (long int)arg5; \
+ long int er6 = (long int)arg6;
-#define _syscall3(type, name, atype, a, btype, b, ctype, c) \
-type name(atype a, btype b, ctype c) \
-{ \
- register long __res __asm__("er0"); \
- __asm__ __volatile__ ("mov.l %4, er3\n\t" \
- "mov.l %3, er2\n\t" \
- "mov.l %2, er1\n\t" \
- "mov.l %1, er0\n\t" \
- "trapa #0\n\t" \
- : "=r" (__res) \
- : "ir" (__NR_##name), \
- "g" ((long)a), \
- "g" ((long)b), \
- "g" ((long)c) \
- : "cc", "er1", "er2", "er3"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- errno = -__res; \
- __res = -1; \
- } \
- return (type)__res; \
-}
+#define LOAD_ARGS_0
+#define LOAD_ARGS_1
+#define LOAD_ARGS_2
+#define LOAD_ARGS_3
+#define LOAD_ARGS_4
+#define LOAD_ARGS_5
+#define LOAD_ARGS_6 "mov.l er5,(a)-sp\n\tmov.l %6,er5\n\t" \
+ "mov.l er6,(a)-sp\n\tmov.l %7,er6\n\t"
-#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \
-type name(atype a, btype b, ctype c, dtype d) \
-{ \
- register long __res __asm__("er0"); \
- __asm__ __volatile__ ("mov.l %5, er4\n\t" \
- "mov.l %4, er3\n\t" \
- "mov.l %3, er2\n\t" \
- "mov.l %2, er1\n\t" \
- "mov.l %1, er0\n\t" \
- "trapa #0\n\t" \
- : "=r" (__res) \
- : "ir" (__NR_##name), \
- "g" ((long)a), \
- "g" ((long)b), \
- "g" ((long)c), \
- "g" ((long)d) \
- : "cc", "er1", "er2", "er3",
"er4"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- errno = -__res; \
- __res = -1; \
- } \
- return (type)__res; \
-}
+#define RESTORE_ARGS_0
+#define RESTORE_ARGS_1
+#define RESTORE_ARGS_2
+#define RESTORE_ARGS_3
+#define RESTORE_ARGS_4
+#define RESTORE_ARGS_5
+#define RESTORE_ARGS_6 "mov.l @sp+,er6\n\tmov.l @sp+,er5"
-#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e) \
-type name(atype a, btype b, ctype c, dtype d, etype e) \
-{ \
- register long __res __asm__("er0"); \
- __asm__ __volatile__ ( \
- "mov.l er5,@-sp\n\t"
\
- "mov.l %5, er4\n\t" \
- "mov.l %4, er3\n\t" \
- "mov.l %3, er2\n\t" \
- "mov.l %2, er1\n\t" \
- "mov.l %1, er0\n\t" \
- "mov.l %6, er5\n\t" \
- "trapa #0\n\t" \
- "mov.l @sp+,er5\n\t"
\
- : "=r" (__res) \
- : "ir" (__NR_##name), \
- "g" ((long)a), \
- "g" ((long)b), \
- "g" ((long)c), \
- "g" ((long)d), \
- "m" ((long)e) \
- : "cc", "er1", "er2", "er3",
"er4"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- errno = -__res; \
- __res = -1; \
- } \
- return (type)__res; \
-}
+/* The _NCS variant allows non-constant syscall numbers. */
+#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
+ ({ \
+ register long int er0 __asm__ ("er0"); \
+ SUBSTITUTE_ARGS_##nr(args) \
+ __asm__ __volatile__ ( \
+ LOAD_ARGS_##nr \
+ "mov.l %1,er0\n\t" \
+ "trapa #0\n\t" \
+ RESTORE_ARGS_##nr \
+ : "=r" (er0) \
+ : "ir" (name) ASMFMT_##nr \
+ : "memory" \
+ ); \
+ (int) er0; \
+ }) \
+)
+#endif /* __ASSEMBLER__ */
+#endif /* _BITS_SYSCALLS_H */
diff --git a/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h
b/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h
index b76b861..fb430ae 100644
--- a/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h
@@ -43,6 +43,6 @@
#define __UCLIBC_HAVE_SIGNED_ZERO__
/* only weird assemblers generally need this */
-#undef __UCLIBC_ASM_LINE_SEP__
+#define __UCLIBC_ASM_LINE_SEP__ !
#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/libc/sysdeps/linux/h8300/bsd-_setjmp.S
b/libc/sysdeps/linux/h8300/bsd-_setjmp.S
index fbe7025..766d9cc 100644
--- a/libc/sysdeps/linux/h8300/bsd-_setjmp.S
+++ b/libc/sysdeps/linux/h8300/bsd-_setjmp.S
@@ -1,4 +1,4 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. H8/300 version. */
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. H8/300 version. */
#include <jmpbuf-offsets.h>
@@ -8,10 +8,10 @@
.h8300h
#endif
.text
-
-.global __setjmp
-__setjmp:
+.global _setjmp
+
+_setjmp:
add.l #JB_SIZE,er0
mov.l @sp,er1 ; return PC
mov.l er1,@-er0
@@ -23,3 +23,5 @@ __setjmp:
sub.l er0,er0
mov.l er0,@(JB_SIZE:16,er1)
rts
+
+ .end
diff --git a/libc/sysdeps/linux/h8300/bsd-setjmp.S
b/libc/sysdeps/linux/h8300/bsd-setjmp.S
index 74ebb8f..77c810f 100644
--- a/libc/sysdeps/linux/h8300/bsd-setjmp.S
+++ b/libc/sysdeps/linux/h8300/bsd-setjmp.S
@@ -1,4 +1,4 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 1)'. H8/300 version. */
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 1)'. H8/300 version. */
#include <jmpbuf-offsets.h>
@@ -8,10 +8,10 @@
.h8300h
#endif
.text
-
-.global _setjmp
-_setjmp:
+.global setjmp
+
+setjmp:
add.l #JB_SIZE,er0
mov.l @sp,er1 ; return PC
mov.l er1,@-er0
@@ -21,8 +21,9 @@ _setjmp:
mov.l er4,@-er0
sub.l er0,er0
#if !defined(__PIC__)
- jmp @___sigjmp_save
+ jmp @__sigjmp_save
#else
- mov.l @(___sigjmp_save@GOTOFF,er5),er1
+ mov.l @(__sigjmp_save@GOTOFF,er5),er1
jmp @er3
#endif
+ .end
diff --git a/libc/sysdeps/linux/h8300/clone.S b/libc/sysdeps/linux/h8300/clone.S
index 554a297..a00eba4 100644
--- a/libc/sysdeps/linux/h8300/clone.S
+++ b/libc/sysdeps/linux/h8300/clone.S
@@ -1,5 +1,4 @@
-/* Adapted from glibc */
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. */
+/* Copyright 2015 Yoshinori Sato <ysato(a)users.sourceforge.jp> */
/* clone is even more special than fork as it mucks with stacks
and invokes a function in the right context after its all over. */
@@ -8,7 +7,8 @@
#include <bits/errno.h>
#include <sys/syscall.h>
-/* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
+/* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg
+ void *parent_tidptr, void *tls, void *child_tidptr) */
#ifdef __H8300H__
.h8300h
@@ -18,8 +18,8 @@
#endif
.text
-.globl _clone
-_clone:
+.globl clone
+clone:
/* Sanity check arguments. */
mov.l #-EINVAL,er3
mov.l er0,er0 /* no NULL function pointers */
@@ -31,13 +31,25 @@ _clone:
mov.l @(4:16,sp),er3
mov.l er3,@-er1
- /* Do the system call */
+ /* setup argument */
mov.l er0,er3 /* er3 = child entry */
- mov.l er1,er0
- mov.l er2,er1 /* er1 = flags */
- mov.l er0,er2 /* er2 = child sp */
- mov.l #__NR_clone,r0
+ sub.l #20,sp
+ mov.l er2,@sp /* flags */
+ mov.l er1,@(4,sp) /* new sp */
+ mov.l sp,er1
+ mov.l @(20+8,sp),er0
+ mov.l er0,@er1 /* parent tid */
+ adds #4,er1
+ mov.l @(20+16,sp),er0
+ mov.l er0,@er1 /* child tid */
+ adds #4,er1
+ mov.l @(20+12,sp),er0
+ mov.l er0,@er1 /* tls */
+ /* do the system call */
+ mov.l sp,er1
+ mov.l #__NR_clone,er0
trapa #0
+ add.l #20,sp
mov.l er0,er0
bmi __syscall_error
beq thread_start
@@ -62,7 +74,9 @@ __syscall_error:
thread_start:
mov.l @sp+,er0 /* restore args */
- jsr @er3
+ jsr @er3
mov.l er0,er1
mov.l #__NR_exit,er0
trapa #0
+
+ .end
diff --git a/libc/sysdeps/linux/h8300/crt0.S b/libc/sysdeps/linux/h8300/crt1.S
similarity index 66%
rename from libc/sysdeps/linux/h8300/crt0.S
rename to libc/sysdeps/linux/h8300/crt1.S
index be6768d..847872a 100644
--- a/libc/sysdeps/linux/h8300/crt0.S
+++ b/libc/sysdeps/linux/h8300/crt1.S
@@ -28,17 +28,39 @@ not, see <http://www.gnu.org/licenses/>. */
#else
.h8300h
#endif
+/*
+void __uClibc_main(int (*main)(int, char **, char **), int argc,
+ char **argv, void (*app_init)(void), void (*app_fini)(void),
+ void (*rtld_fini)(void),void *stack_end attribute_unused)
+*/
.text
_start: /* put here so that references to _start work with elf-PIC */
- mov.l @(0,sp),er0 /* argc */
- mov.l @(4,sp),er1 /* argv */
- mov.l @(8,sp),er2 /* envp */
+ mov.l @sp+,er1 /* argc */
+ mov.l @sp+,er2 /* argv */
+ add.l #4,sp
+
#if !defined(__PIC__)
- jsr @___uClibc_main
+ mov.l sp, @-sp
+ sub.l er0,er0
+ mov.l er0,@-sp
+ mov.l #_fini,er0
+ mov.l er0,@-sp
+ mov.l #_init,er0
+ mov.l er0,@-sp
+ mov.l #main,er0
+ jsr @__uClibc_main
#else
- mov.l @(___uClibc_main@GOTOFF,er5),er3
+ mov.l sp, @-sp
+ sub.l er0,er0
+ mov.l er0,@-sp
+ mov.l @(_fini@GOTOFF,er5),er0
+ mov.l er0,@-sp
+ mov.l @(_init@GOTOFF,er5),er0
+ mov.l er0,@-sp
+ mov.l @(main@GOTOFF,er5),er0
+ mov.l @(__uClibc_main@GOTOFF,er5),er3
jsr @er3
#endif
@@ -61,9 +83,9 @@ empty_func:
/* Define a symbol for the first piece of initialized data. */
.data
- .globl __data_start
-__data_start:
+ .globl _data_start
+_data_start:
.long 0
.weak data_start
- data_start = __data_start
+ data_start = _data_start
diff --git a/libc/sysdeps/linux/h8300/crti.S b/libc/sysdeps/linux/h8300/crti.S
index 270df27..cc6afe9 100644
--- a/libc/sysdeps/linux/h8300/crti.S
+++ b/libc/sysdeps/linux/h8300/crti.S
@@ -10,8 +10,8 @@
.section .init
; #NO_APP
.align 1
- .global __init
-__init:
+ .global _init
+_init:
mov.l er6,@-er7
mov.l er7,er6
; #APP
@@ -20,8 +20,8 @@ __init:
.section .fini
; #NO_APP
.align 1
- .global __fini
-__fini:
+ .global _fini
+_fini:
mov.l er6,@-er7
mov.l er7,er6
; #APP
diff --git a/libc/sysdeps/linux/h8300/crtn.S b/libc/sysdeps/linux/h8300/crtn.S
index 8f9fa1f..a390704 100644
--- a/libc/sysdeps/linux/h8300/crtn.S
+++ b/libc/sysdeps/linux/h8300/crtn.S
@@ -10,7 +10,7 @@
.section .init
; #NO_APP
.align 1
- .global __init
+ .global _init
; #NO_APP
mov.l @er7+,er6
rts
@@ -19,7 +19,7 @@
.section .fini
; #NO_APP
.align 1
- .global __fini
+ .global _fini
; #NO_APP
mov.l @er7+,er6
rts
diff --git a/libc/sysdeps/linux/h8300/setjmp.S b/libc/sysdeps/linux/h8300/setjmp.S
index f2795fa..0b8f052 100644
--- a/libc/sysdeps/linux/h8300/setjmp.S
+++ b/libc/sysdeps/linux/h8300/setjmp.S
@@ -7,9 +7,9 @@
#endif
.text
-.global ___sigsetjmp
+.global __sigsetjmp
-___sigsetjmp:
+__sigsetjmp:
add.l #JB_SIZE,er0
mov.l @sp,er1 ; return PC
mov.l er1,@-er0
diff --git a/libc/sysdeps/linux/h8300/vfork.S b/libc/sysdeps/linux/h8300/vfork.S
index 9b65f4f..1c70dd2 100644
--- a/libc/sysdeps/linux/h8300/vfork.S
+++ b/libc/sysdeps/linux/h8300/vfork.S
@@ -1,10 +1,7 @@
+/* Copyright 2002, 2015 Yoshinori Sato <ysato(a)users.sourceforge.jp> */
#include <sys/syscall.h>
-#ifndef __NR_vfork
-#define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
-#endif
-
#ifdef __H8300S__
.h8300s
#else
@@ -12,29 +9,60 @@
#endif
.text
.align 2
- .globl ___vfork
- .hidden ___vfork
- .type ___vfork,@function
-___vfork:
+ .globl __vfork
+ .hidden __vfork
+ .type __vfork,@function
+__vfork:
+#ifdef __NR_vfork
mov.l @sp+, er1
sub.l er0,er0
mov.b #__NR_vfork,r0l
trapa #0
+
mov.l #-4096, er2
cmp.l er0,er2
bcs fix_errno
- jmp @er1 /* don't return, just jmp directly */
+ jmp @er1 /* don't return, just jmp directly */
fix_errno:
neg.l er0
-#if !defined(__PIC__)
+# if !defined(__PIC__)
mov.l er0,@_errno
-#else
+# else
mov.l @(_errno@GOTOFF,er5),er2
mov.l er0,@er2
-#endif
+# endif
sub.l er0,er0
dec.l #1,er0
- jmp @er1 /* don't return, just jmp directly */
+ jmp @er1 /* don't return, just jmp directly */
+#else
+ mov.l @sp+,er2 /* er2 = return address */
+ mov.l #vfork_args,er1
+ sub.l er0,er0
+ mov.b #__NR_clone,r0l
+ trapa #0
+ mov.l #-4096,er1
+ cmp.l er0,er1
+ bcc done
+ neg.l er0
+# if !defined(__PIC__)
+ mov.l er0,@errno
+# else
+ mov.l @(errno@GOTOFF,er5),er1
+ mov.l er0,@er1
+# endif
+ sub.l er0,er0
+ dec.l #1,er0
+done:
+ jmp @er2
+
+vfork_args:
+ .long 0x80004100 /* CLONE_VFORK | CLONE_VM | SIGCHLD */
+ .long 0
+ .long 0
+ .long 0
+ .long 0
+#endif
weak_alias(__vfork,vfork)
libc_hidden_def(vfork)
+ .end
diff --git a/libc/sysdeps/linux/ia64/bits/siginfo.h
b/libc/sysdeps/linux/ia64/bits/siginfo.h
index 3ac988b..df18b36 100644
--- a/libc/sysdeps/linux/ia64/bits/siginfo.h
+++ b/libc/sysdeps/linux/ia64/bits/siginfo.h
@@ -102,6 +102,14 @@ typedef struct siginfo
long int si_band; /* Band event for SIGPOLL. */
int si_fd;
} _sigpoll;
+
+ /* SIGSYS. */
+ struct
+ {
+ void *_call_addr; /* Calling user insn. */
+ int _syscall; /* Triggering system call number. */
+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
+ } _sigsys;
} _sifields;
} siginfo_t;
@@ -120,6 +128,9 @@ typedef struct siginfo
# define si_addr _sifields._sigfault.si_addr
# define si_band _sifields._sigpoll.si_band
# define si_fd _sifields._sigpoll.si_fd
+# define si_call_addr _sifields._sigsys._call_addr
+# define si_syscall _sifields._sigsys._syscall
+# define si_arch _sifields._sigsys._arch
# ifdef __USE_GNU
# define si_imm _sifields._sigfault._si_imm
diff --git a/libc/sysdeps/linux/mips/bits/siginfo.h
b/libc/sysdeps/linux/mips/bits/siginfo.h
index 5199d4d..b204301 100644
--- a/libc/sysdeps/linux/mips/bits/siginfo.h
+++ b/libc/sysdeps/linux/mips/bits/siginfo.h
@@ -108,6 +108,14 @@ typedef struct siginfo
long int si_band; /* Band event for SIGPOLL. */
int si_fd;
} _sigpoll;
+
+ /* SIGSYS. */
+ struct
+ {
+ void *_call_addr; /* Calling user insn. */
+ int _syscall; /* Triggering system call number. */
+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
+ } _sigsys;
} _sifields;
} siginfo_t;
@@ -127,6 +135,9 @@ typedef struct siginfo
# define si_addr_lsb _sifields._sigfault.si_addr_lsb
# define si_band _sifields._sigpoll.si_band
# define si_fd _sifields._sigpoll.si_fd
+# define si_call_addr _sifields._sigsys._call_addr
+# define si_syscall _sifields._sigsys._syscall
+# define si_arch _sifields._sigsys._arch
/* Values for `si_code'. Positive values are reserved for kernel-generated
diff --git a/libc/sysdeps/linux/sparc/bits/siginfo.h
b/libc/sysdeps/linux/sparc/bits/siginfo.h
index 3ffeb6d..da1c838 100644
--- a/libc/sysdeps/linux/sparc/bits/siginfo.h
+++ b/libc/sysdeps/linux/sparc/bits/siginfo.h
@@ -104,6 +104,14 @@ typedef struct siginfo
int si_band; /* Band event for SIGPOLL. */
int si_fd;
} _sigpoll;
+
+ /* SIGSYS. */
+ struct
+ {
+ void *_call_addr; /* Calling user insn. */
+ int _syscall; /* Triggering system call number. */
+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
+ } _sigsys;
} _sifields;
} siginfo_t;
@@ -123,6 +131,9 @@ typedef struct siginfo
# define si_trapno _sifields._sigfault.si_trapno
# define si_band _sifields._sigpoll.si_band
# define si_fd _sifields._sigpoll.si_fd
+# define si_call_addr _sifields._sigsys._call_addr
+# define si_syscall _sifields._sigsys._syscall
+# define si_arch _sifields._sigsys._arch
/* Values for `si_code'. Positive values are reserved for kernel-generated
diff --git a/test/silly/Makefile.in b/test/silly/Makefile.in
index 9bb4032..da83d9a 100644
--- a/test/silly/Makefile.in
+++ b/test/silly/Makefile.in
@@ -6,3 +6,10 @@ RET_tiny := 42
# missing internal headers, disable these
GLIBC_TESTS_DISABLED := tst-atomic_glibc tst-atomic-long_glibc
+
+atomic_headers := -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
+ -I$(top_srcdir)libc/sysdeps/linux \
+ -I$(top_builddir)include
+
+CFLAGS_tst-atomic = $(atomic_headers)
+CFLAGS_tst-atomic-long = $(atomic_headers)
diff --git a/test/stdio/scanf_m.c b/test/stdio/scanf_m.c
new file mode 100644
index 0000000..0ce78b6
--- /dev/null
+++ b/test/stdio/scanf_m.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(void)
+{
+ const char *buf = "hello world";
+ char *ps = NULL, *pc = NULL;
+ char s[6], c;
+
+ /* Check that %[...]/%c work. */
+ sscanf(buf, "%[a-z] %c", s, &c);
+ /* Check that %m[...]/%mc work. */
+ sscanf(buf, "%m[a-z] %mc", &ps, &pc);
+
+ if (strcmp(ps, "hello") != 0 || *pc != 'w' ||
+ strcmp(s, "hello") != 0 || c != 'w')
+ return 1;
+
+ free(ps);
+ free(pc);
+
+ return 0;
+}
diff --git a/utils/getconf.c b/utils/getconf.c
index 408a574..3dd3d75 100644
--- a/utils/getconf.c
+++ b/utils/getconf.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#define PACKAGE "getconf regression test"
+#undef VERSION
#define VERSION ""
#define _(x) x
#define error(status, errnum, fmt, ...) \
hooks/post-receive
--
uClibc-ng - small C library for embedded systems