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, 1.0 has been updated
via 0bfe2a56912f4d90ee39f322f0bde92a01d6ec6e (commit)
via 1bfc0e93e694e6b3b30e9f5b8194ef8ec178df8a (commit)
via f6b1ea78c0bb708cd719a00de469769a1be023db (commit)
via c5a409f98681db04f745cdf242c6166ecb13b9bd (commit)
via 0b71a91bfa06cdc2c8092698e442bf9412d26a2f (commit)
via 46699f7cd268ef3d945477c38c5ac1191f1d5c09 (commit)
via c8ec1c17b8bebfe0e1536bd8d3d4ddee1ffca2ec (commit)
via 3dc45e6498755f5b7afcbdf15ae73f427dfedfab (commit)
via 8c62ce0c041059b4b9b823d70cb7073f82ddd1c6 (commit)
via 62001886d7e3d3d85482b231591722c794c6ebb1 (commit)
via 35f1863fcc0bc2bc8596c312cccccf0fc8ea4add (commit)
via 7508d14424c0fdc65d7ba35e99da710c38754929 (commit)
via b4c496207001d9e18f4154bb4381174f0dc2011b (commit)
via e364302aeaa7fc4f18c66acdbba5dd2c14f77555 (commit)
via e9fd792344b30b370346d0224d54edb6a96d5cff (commit)
via 8df92aac2ccb8fa20899c4b025e8dfaa7414919b (commit)
via 90edbb4e01e8a65ae7415af88bd194cea1aa0520 (commit)
via a7f7831ec0914f471883c1dfe494a3e68557b56f (commit)
via b2d27c71bd13820a4263fa7ebda4c1a4a95b501c (commit)
via b6c1e98422165a36b19a68daaeee11856033a7f1 (commit)
via 8d92e32a73655a0820ce5085f017911abaad28b3 (commit)
via 8484e59e6b1dfe424d13f736c146aafbeac5cabf (commit)
via 065e2add9fd443ffaabc4ce66298714fec9756fb (commit)
via 98d8242d872774356d8efb93857036f3a26578d7 (commit)
via 3328a7c918aaf460ae0e20d0b6545b721f77efb1 (commit)
via 26446139e4b065452740cf73c7643f94cece6fa5 (commit)
from 1775f37b1a35a22e186280b752913bda9f9ee7e9 (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 0bfe2a56912f4d90ee39f322f0bde92a01d6ec6e
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Jun 7 02:30:16 2015 -0500
disable not available CFLAGS for h8300
commit 1bfc0e93e694e6b3b30e9f5b8194ef8ec178df8a
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Jun 7 02:32:35 2015 -0500
h8300 has no NPTL
commit f6b1ea78c0bb708cd719a00de469769a1be023db
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Jun 7 13:15:59 2015 -0500
just use 4k pages for microblaze, the config are missing and never committed into
uClibc
commit c5a409f98681db04f745cdf242c6166ecb13b9bd
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Jun 7 13:29:33 2015 -0500
avoid some compiler warnings
Patch seen here:
http://lists.uclibc.org/pipermail/uclibc/2015-April/048892.html
commit 0b71a91bfa06cdc2c8092698e442bf9412d26a2f
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Wed Jun 10 08:14:11 2015 -0500
allow endian choice for microblaze biendian architecture
commit 46699f7cd268ef3d945477c38c5ac1191f1d5c09
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Wed Jun 10 10:17:11 2015 -0500
use common ptrace.h for xtensa, fixes buildroot issues compiling enlightment
commit c8ec1c17b8bebfe0e1536bd8d3d4ddee1ffca2ec
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Wed Jun 10 10:16:24 2015 -0500
use mktemp, otherwise test is failing. reverts partially
7c721d31e4b7a0bdf6f803b8e7c38996bf60b59f
commit 3dc45e6498755f5b7afcbdf15ae73f427dfedfab
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Wed Jun 10 10:13:43 2015 -0500
disable silly test for mips/sparc
commit 8c62ce0c041059b4b9b823d70cb7073f82ddd1c6
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 62001886d7e3d3d85482b231591722c794c6ebb1
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 35f1863fcc0bc2bc8596c312cccccf0fc8ea4add
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 7508d14424c0fdc65d7ba35e99da710c38754929
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 b4c496207001d9e18f4154bb4381174f0dc2011b
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 e364302aeaa7fc4f18c66acdbba5dd2c14f77555
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 e9fd792344b30b370346d0224d54edb6a96d5cff
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 8df92aac2ccb8fa20899c4b025e8dfaa7414919b
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 90edbb4e01e8a65ae7415af88bd194cea1aa0520
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 a7f7831ec0914f471883c1dfe494a3e68557b56f
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 b2d27c71bd13820a4263fa7ebda4c1a4a95b501c
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>
commit b6c1e98422165a36b19a68daaeee11856033a7f1
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed May 6 22:38:38 2015 +0200
nptl_db: fix ommitting td_ta_setconcurrency
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 8d92e32a73655a0820ce5085f017911abaad28b3
Author: Roland McGrath <roland(a)gnu.org>
Date: Tue Apr 28 11:07:24 2015 +0800
init.c (__nptl_initial_report_events): New variable.
(__pthread_initialize_minimal_internal): Initialize pd->report_events
to that.
This patch helps NPTL report TD_CREATE event, so that GDB could catch the
event and update its thread_list.
Link:
http://lists.uclibc.org/pipermail/uclibc/2015-April/048921.html
[shengyong:
- original patch from glibc: commit 7d9d8bd18906fdd17364f372b160d7ab896ce909
- context adjust
- update nptl_db/ChangeLog]
Signed-off-by: Roland McGrath <roland(a)gnu.org>
Signed-off-by: Sheng Yong <shengyong1(a)huawei.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 8484e59e6b1dfe424d13f736c146aafbeac5cabf
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Apr 29 23:52:18 2015 +0200
buildsys: pregen depends on xlocale
pt-initfini eventually depends on xlocale
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 065e2add9fd443ffaabc4ce66298714fec9756fb
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Apr 29 10:41:42 2015 +0200
strftime: comment on %0xY %+nY %-nY
Would fix: date -u +%4Y%2m%2d%2H%2M%2S
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 98d8242d872774356d8efb93857036f3a26578d7
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Apr 29 10:22:18 2015 +0200
buildsys: swap V=1 with V=2 command printing
Previously V=1 did print abbreviated commands and V=2 the full commands.
Kbuild-based build-systems behave in the opposite way and this is
apparently confusing or inconvenient for users so swap our V handling to
be in line with kbuild (and automake as far as V=0 / V=1 is concerned).
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 3328a7c918aaf460ae0e20d0b6545b721f77efb1
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Apr 23 23:17:00 2015 +0200
buildsys: LT{,.old} CRT prereq
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 26446139e4b065452740cf73c7643f94cece6fa5
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Apr 23 23:15:45 2015 +0200
buildsys: Tweak pregen wrt headers_dep
Required for !NPTL, !context-funcs for example.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
-----------------------------------------------------------------------
Summary of changes:
Makefile.help | 4 +-
Makefile.in | 6 +-
Makerules | 5 +-
Rules.mak | 7 +-
extra/Configs/Config.h8300 | 5 +-
extra/Configs/Config.in | 5 +-
extra/Configs/Config.microblaze | 1 +
extra/Configs/defconfigs/arc/arcv2_defconfig | 1 +
extra/Configs/defconfigs/arc/defconfig | 1 +
extra/locale/Makefile.in | 12 +-
include/stdint.h | 10 -
ldso/include/dl-string.h | 2 +
ldso/ldso/h8300/dl-sysdep.h | 1 +
libc/misc/time/time.c | 24 +++
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/microblaze/bits/uClibc_page.h | 18 +-
libc/sysdeps/linux/mips/bits/siginfo.h | 11 +
libc/sysdeps/linux/sparc/bits/siginfo.h | 11 +
libc/sysdeps/linux/xtensa/sys/ptrace.h | 155 --------------
libpthread/nptl/sysdeps/pthread/Makefile.in | 2 +-
libpthread/nptl_db/ChangeLog | 23 +++
libpthread/nptl_db/Makefile.in | 8 +-
libpthread/nptl_db/db_info.c | 4 +-
libpthread/nptl_db/structs.def | 3 +-
libpthread/nptl_db/td_ta_map_lwp2thr.c | 69 +++++--
libpthread/nptl_db/td_ta_thr_iter.c | 25 ++-
libpthread/nptl_db/td_thr_event_enable.c | 24 ++-
libpthread/nptl_db/td_thr_get_info.c | 81 +++++---
libpthread/nptl_db/td_thr_getfpregs.c | 7 +-
libpthread/nptl_db/td_thr_getgregs.c | 7 +-
libpthread/nptl_db/td_thr_setfpregs.c | 7 +-
libpthread/nptl_db/td_thr_setgregs.c | 7 +-
libpthread/nptl_db/td_thr_tlsbase.c | 25 ++-
libpthread/nptl_db/td_thr_validate.c | 16 +-
libpthread/nptl_db/thread_dbP.h | 5 +-
test/nptl/tst-cancel4.c | 53 ++---
test/silly/Makefile.in | 16 +-
test/stdio/scanf_m.c | 24 +++
utils/getconf.c | 1 +
59 files changed, 655 insertions(+), 669 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%)
delete mode 100644 libc/sysdeps/linux/xtensa/sys/ptrace.h
create mode 100644 test/stdio/scanf_m.c
diff --git a/Makefile.help b/Makefile.help
index abc6471..f6c7627 100644
--- a/Makefile.help
+++ b/Makefile.help
@@ -53,8 +53,8 @@ help:
@echo 'Environment variables:'
@echo ' O=<abspath> - Use <abspath> as object directory'
@echo ' V="" - Quiet build (default)'
- @echo ' V=1 - Brief build (show defines, ld flags)'
- @echo ' V=2 - Very verbose build'
+ @echo ' V=1 - Very verbose build (show full commands)'
+ @echo ' V=2 - Brief build (show defines, ld flags)'
@echo ' CROSS_COMPILE= - Override CROSS_COMPILER_PREFIX from .config'
@echo ' ARCH= - Use given arch for config targets'
@echo ' SHELL= - Shell to use for make'
diff --git a/Makefile.in b/Makefile.in
index c8195ff..245649c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -29,6 +29,7 @@ headers:
endif # ifeq ($(HAVE_DOT_CONFIG),y)
+include $(top_srcdir)extra/locale/Makefile.in
include $(top_srcdir)ldso/Makefile.in
include $(top_srcdir)libcrypt/Makefile.in
include $(top_srcdir)libintl/Makefile.in
@@ -39,7 +40,6 @@ include $(top_srcdir)libutil/Makefile.in
include $(top_srcdir)libpthread/Makefile.in
include $(top_srcdir)librt/Makefile.in
include $(top_srcdir)libubacktrace/Makefile.in
-include $(top_srcdir)extra/locale/Makefile.in
# last included to catch all the objects added by others (locales/threads)
include $(top_srcdir)libc/Makefile.in
@@ -186,9 +186,7 @@ headers: $(top_builddir)include/bits/uClibc_config.h | subdirs
subdirs: $(addprefix $(top_builddir),$(subdirs))
$(pregen-headers-y): $(headers_dep)
-
-pregen-headers: $(pregen-headers-y)
-pregen: headers pregen-headers
+pregen: headers $(pregen-headers-y) $(headers_dep)
$(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
$(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh |
$(top_builddir)include/bits
diff --git a/Makerules b/Makerules
index dd19cea..d6f7e24 100644
--- a/Makerules
+++ b/Makerules
@@ -94,7 +94,7 @@ else
export MAKE_IS_SILENT := n
SECHO := @echo
ifneq ($(V)$(VERBOSE),)
-ifeq ($(V),1)
+ifeq ($(V),2)
DISP := bri# brief, like pur but with defines
Q := @
else
@@ -430,6 +430,9 @@ CTOR_TARGETS=$(top_builddir)lib/crti.o $(top_builddir)lib/crtn.o
else
CTOR_TARGETS:=
endif
+ifeq ($(HAS_NO_THREADS)$(UCLIBC_HAS_THREADS_NATIVE),)
+$(lib-so-y): $(CTOR_TARGETS)
+endif
ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
CRTRELOC=$(top_builddir)lib/crtreloc.o
diff --git a/Rules.mak b/Rules.mak
index 548982b..6916435 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -301,12 +301,14 @@ ifneq ($(TARGET_ARCH),bfin)
ifneq ($(TARGET_ARCH),nios2)
ifneq ($(TARGET_ARCH),sh)
ifneq ($(TARGET_ARCH),c6x)
+ifneq ($(TARGET_ARCH),h8300)
CPU_CFLAGS-y += -msoft-float
endif
endif
endif
endif
endif
+endif
$(eval $(call check-gcc-var,-std=gnu99))
CPU_CFLAGS-y += $(CFLAG_-std=gnu99)
@@ -431,9 +433,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 3c2add6..73d3883 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -74,8 +74,8 @@ config TARGET_cris
#config TARGET_frv
# bool "frv (BROKEN)"
-#config TARGET_h8300
-# bool "h8300 (BROKEN)"
+config TARGET_h8300
+ bool "h8300"
#config TARGET_hppa
# bool "hppa"
@@ -570,6 +570,7 @@ config UCLIBC_HAS_THREADS_NATIVE
!TARGET_bfin && \
!TARGET_c6x && \
!TARGET_cris && \
+ !TARGET_h8300 && \
!TARGET_hppa && \
!TARGET_ia64 && \
!TARGET_m68k && \
diff --git a/extra/Configs/Config.microblaze b/extra/Configs/Config.microblaze
index fddc5d6..60d10d6 100644
--- a/extra/Configs/Config.microblaze
+++ b/extra/Configs/Config.microblaze
@@ -10,4 +10,5 @@ config TARGET_ARCH
config FORCE_OPTIONS_FOR_ARCH
bool
default y
+ select ARCH_ANY_ENDIAN
select ARCH_HAS_DEPRECATED_SYSCALLS
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/extra/locale/Makefile.in b/extra/locale/Makefile.in
index 1a2305b..efd07ed 100644
--- a/extra/locale/Makefile.in
+++ b/extra/locale/Makefile.in
@@ -29,7 +29,8 @@ BUILD_CFLAGS-gen_collate := -D_GNU_SOURCE
locale_headers-$(UCLIBC_HAS_LOCALE) := $(top_builddir)include/bits/uClibc_locale_data.h
-#DEPH-locale := $(top_builddir)include/bits/sysnum.h
+headers_dep += $(locale_headers-y)
+
DEPH-locale := $(top_builddir)include/bits/uClibc_config.h
DEPH-gen_collate := $(DEPH-locale)
DEPH-gen_ldc := $(addprefix $(locale_OUT)/,c8tables.h wctables.h locale_tables.h
locale_collate.h) $(DEPH-locale)
@@ -46,9 +47,6 @@ locale_OBJ := $(locale_OUT)/locale_data.o
CFLAGS-locale_data.c := -D__WCHAR_ENABLED -I$(locale_OUT) -I$(locale_DIR)
-headers_dep += $(locale_headers-y)
-headers: $(locale_headers-y)
-
libc-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
libc-nomulti-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
@@ -68,7 +66,7 @@ $(locale_OUT)%.s: $(locale_OUT)%.S FORCE ; $(compile.s)
$(locale_OUT)%.dep:
-locale_headers: $(top_builddir)include/bits/uClibc_locale_data.h
+locale_headers: $(locale_headers-y)
# make sure that the host system has locales (this check is ok for uClibc/glibc)
# we do not know though which locales were really enabled for libc at build time
@@ -155,10 +153,10 @@ $(locale_OUT)/gen_wctype : $(locale_DIR)/gen_wctype.c
ifneq ($(V),)
ifeq ($(V),1)
-FLAG-locale-verbose := -v
+FLAG-locale-verbose := -v -v
endif
ifeq ($(V),2)
-FLAG-locale-verbose := -v -v
+FLAG-locale-verbose := -v
endif
endif
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/include/dl-string.h b/ldso/include/dl-string.h
index aacad10..14ae617 100644
--- a/ldso/include/dl-string.h
+++ b/ldso/include/dl-string.h
@@ -204,7 +204,9 @@ static __always_inline char * _dl_get_last_path_component(char *path)
# define _dl_strcat strcat
# define _dl_strcpy strcpy
# define _dl_strcmp strcmp
+# define _dl_strchr strchr
# define _dl_strrchr strrchr
+# define _dl_strstr strstr
# define _dl_memcpy memcpy
# define _dl_memcmp memcmp
# define _dl_memset memset
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/misc/time/time.c b/libc/misc/time/time.c
index a3fccb2..03635d8 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -1084,7 +1084,25 @@ LOOP:
o_count = 1;
if ((*(o = (CHAR_T *)p) == '%') && (*++p != '%')) {
+#if 0 /* TODO, same for strptime */
+ /* POSIX.1-2008 allows %0xY %+nY %-nY etc. for certain formats.
+ * Just accept these for all (for now) */
+ const int plus = *p == '+';
+ CHAR_T *q = (CHAR_T *)p;
+ long int o_width = __XL_NPP(strtol)(p, &q, 0 __LOCALE_ARG);
+ if (o_width > 0 && o_width < 256) { /* arbitrary upper limit */
+ o_count = o_width;
+ if (plus) {
+ *s++ = '+';
+ --count;
+ }
+ p = q;
+ } else {
+ o_count = 2;
+ }
+#else
o_count = 2;
+#endif
mod = ILLEGAL_SPEC;
if ((*p == 'O') || (*p == 'E')) { /* modifier */
mod |= ((*p == 'O') ? NO_O_MOD : NO_E_MOD);
@@ -1317,7 +1335,13 @@ ISO_LOOP:
ccp = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME, field_val) __LOCALE_ARG);
fmt_to_wc(o, ccp);
} else {
+#if 0 /* TODO, same for strptime */
+ size_t min_count = ((i >> 1) & 3) + 1;
+ if (o_count < min_count)
+ o_count = min_count;
+#else
o_count = ((i >> 1) & 3) + 1;
+#endif
ccp = buf + o_count;
do {
*(char *)(--ccp) = '0' + (field_val % 10);
diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c
index d48fd12..f2a9670 100644
--- a/libc/stdio/_scanf.c
+++ b/libc/stdio/_scanf.c
@@ -1351,7 +1351,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) {
@@ -1359,32 +1372,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;
@@ -1399,10 +1408,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) || \
@@ -1453,13 +1458,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;
}
}
@@ -1469,6 +1481,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/microblaze/bits/uClibc_page.h
b/libc/sysdeps/linux/microblaze/bits/uClibc_page.h
index 9335d8e..580ca13 100644
--- a/libc/sysdeps/linux/microblaze/bits/uClibc_page.h
+++ b/libc/sysdeps/linux/microblaze/bits/uClibc_page.h
@@ -20,23 +20,7 @@
#ifndef _UCLIBC_PAGE_H
#define _UCLIBC_PAGE_H
-#include <generated/autoconf.h>
-
-#if defined(CONFIG_MICROBLAZE_32K_PAGES)
-#define PAGE_SHIFT 15
-#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
-#define PAGE_SHIFT 14
-#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
-#define PAGE_SHIFT 13
-#elif defined(CONFIG_MICROBLAZE_4K_PAGES)
-#define PAGE_SHIFT 12
-#else
-#if !defined(CONFIG_MMU)
-#warning Missing CONFIG_MICROBLAZE_nnK_PAGES, assuming 4K
-#endif
-#define PAGE_SHIFT 12
-#endif
-
+#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
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/libc/sysdeps/linux/xtensa/sys/ptrace.h
b/libc/sysdeps/linux/xtensa/sys/ptrace.h
deleted file mode 100644
index 882b8c8..0000000
--- a/libc/sysdeps/linux/xtensa/sys/ptrace.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* `ptrace' debugger support interface. Linux version.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _SYS_PTRACE_H
-#define _SYS_PTRACE_H 1
-
-#include <features.h>
-
-/* Kludge away careless namespace pollution from the kernel. */
-
-#undef PTRACE_GETREGS
-#undef PTRACE_SETREGS
-#undef PTRACE_GETFPREGS
-#undef PTRACE_SETFPREGS
-#undef PTRACE_GETFPREGSIZE
-
-
-__BEGIN_DECLS
-
-/* Type of the REQUEST argument to `ptrace.' */
-enum __ptrace_request
-{
- /* Indicate that the process making this request should be traced.
- All signals received by this process can be intercepted by its
- parent, and its parent can use the other `ptrace' requests. */
- PTRACE_TRACEME = 0,
-#define PT_TRACE_ME PTRACE_TRACEME
-
- /* Return the word in the process's text space at address ADDR. */
- PTRACE_PEEKTEXT = 1,
-#define PT_READ_I PTRACE_PEEKTEXT
-
- /* Return the word in the process's data space at address ADDR. */
- PTRACE_PEEKDATA = 2,
-#define PT_READ_D PTRACE_PEEKDATA
-
- /* Return the word in the process's user area at offset ADDR. */
- PTRACE_PEEKUSER = 3,
-#define PT_READ_U PTRACE_PEEKUSER
-
- /* Write the word DATA into the process's text space at address ADDR. */
- PTRACE_POKETEXT = 4,
-#define PT_WRITE_I PTRACE_POKETEXT
-
- /* Write the word DATA into the process's data space at address ADDR. */
- PTRACE_POKEDATA = 5,
-#define PT_WRITE_D PTRACE_POKEDATA
-
- /* Write the word DATA into the process's user area at offset ADDR. */
- PTRACE_POKEUSER = 6,
-#define PT_WRITE_U PTRACE_POKEUSER
-
- /* Continue the process. */
- PTRACE_CONT = 7,
-#define PT_CONTINUE PTRACE_CONT
-
- /* Kill the process. */
- PTRACE_KILL = 8,
-#define PT_KILL PTRACE_KILL
-
- /* Single step the process.
- This is not supported on all machines. */
- PTRACE_SINGLESTEP = 9,
-#define PT_STEP PTRACE_SINGLESTEP
-
- /* Get all general purpose registers used by a processes.
- This is not supported on all machines. */
- PTRACE_GETREGS = 12,
-#define PT_GETREGS PTRACE_GETREGS
-
- /* Set all general purpose registers used by a processes.
- This is not supported on all machines. */
- PTRACE_SETREGS = 13,
-#define PT_SETREGS PTRACE_SETREGS
-
- /* Get all floating point registers used by a processes.
- This is not supported on all machines. */
- PTRACE_GETFPREGS = 14,
-#define PT_GETFPREGS PTRACE_GETFPREGS
-
- /* Set all floating point registers used by a processes.
- This is not supported on all machines. */
- PTRACE_SETFPREGS = 15,
-#define PT_SETFPREGS PTRACE_SETFPREGS
-
- /* Attach to a process that is already running. */
- PTRACE_ATTACH = 16,
-#define PT_ATTACH PTRACE_ATTACH
-
- /* Detach from a process attached to with PTRACE_ATTACH. */
- PTRACE_DETACH = 17,
-#define PT_DETACH PTRACE_DETACH
-
- /* Get size required for the buffer holding the floating point registers.
- This is not supported on all machines. */
- PTRACE_GETFPREGSIZE = 18,
-#define PT_GETFPREGSIZE PTRACE_GETFPREGSIZE
-
- /* Continue and stop at the next (return from) syscall. */
- PTRACE_SYSCALL = 24
-#define PT_SYSCALL PTRACE_SYSCALL
-};
-
-/* Options set using PTRACE_SETOPTIONS. */
-enum __ptrace_setoptions {
- PTRACE_O_TRACESYSGOOD = 0x00000001,
- PTRACE_O_TRACEFORK = 0x00000002,
- PTRACE_O_TRACEVFORK = 0x00000004,
- PTRACE_O_TRACECLONE = 0x00000008,
- PTRACE_O_TRACEEXEC = 0x00000010,
- PTRACE_O_TRACEVFORKDONE = 0x00000020,
- PTRACE_O_TRACEEXIT = 0x00000040,
- PTRACE_O_MASK = 0x0000007f
-};
-
-/* Wait extended result codes for the above trace options. */
-enum __ptrace_eventcodes {
- PTRACE_EVENT_FORK = 1,
- PTRACE_EVENT_VFORK = 2,
- PTRACE_EVENT_CLONE = 3,
- PTRACE_EVENT_EXEC = 4,
- PTRACE_EVENT_VFORK_DONE = 5,
- PTRACE_EVENT_EXIT = 6
-};
-
-/* Perform process tracing functions. REQUEST is one of the values
- above, and determines the action to be taken.
- For all requests except PTRACE_TRACEME, PID specifies the process to be
- traced.
-
- PID and the other arguments described above for the various requests should
- appear (those that are used for the particular request) as:
- pid_t PID, void *ADDR, int DATA, void *ADDR2
- after REQUEST. */
-extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
-
-__END_DECLS
-
-#endif /* _SYS_PTRACE_H */
diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in
b/libpthread/nptl/sysdeps/pthread/Makefile.in
index 84adfe0..849c75f 100644
--- a/libpthread/nptl/sysdeps/pthread/Makefile.in
+++ b/libpthread/nptl/sysdeps/pthread/Makefile.in
@@ -78,7 +78,7 @@ $(libpthread_pthread_OUT)/pt-crti.o:
$(libpthread_pthread_OUT)/pt-crti.S
$(libpthread_pthread_OUT)/pt-crtn.o: $(libpthread_pthread_OUT)/pt-crtn.S
$(compile.S)
-$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) |
$(top_builddir)include/bits/uClibc_config.h
+$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) | $(headers_dep)
$(compile.c)
$(libpthread_pthread_OUT)/defs.h: $(PTHREAD_INITFINI)
$(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
diff --git a/libpthread/nptl_db/ChangeLog b/libpthread/nptl_db/ChangeLog
index 52c8491..92021cb 100644
--- a/libpthread/nptl_db/ChangeLog
+++ b/libpthread/nptl_db/ChangeLog
@@ -1,3 +1,26 @@
+2007-05-16 Roland McGrath <roland(a)redhat.com>
+
+ * td_thr_get_info.c: Fake the results for TH->th_unique == 0.
+ * td_thr_validate.c: Likewise.
+ * td_thr_setgregs.c: Likewise.
+ * td_thr_setfpregs.c: Likewise.
+ * td_thr_getgregs.c: Likewise.
+ * td_thr_getfpregs.c: Likewise.
+ * td_thr_tlsbase.c: Likewise.
+
+ * structs.def: Add DB_VARIABLE (__nptl_initial_report_events).
+ * db_info.c: Add necessary declaration.
+ * td_thr_event_enable.c: Set __nptl_initial_report_events too.
+
+ * td_ta_thr_iter.c (iterate_thread_list): Make FAKE_EMPTY bool.
+ Use th_unique=0 in fake descriptor before initialization.
+
+ * td_ta_map_lwp2thr.c (__td_ta_lookup_th_unique): New function, broken
+ out of ...
+ (td_ta_map_lwp2thr): ... here, call it. But don't before __stack_user
+ is initialized, then fake a handle with th_unique=0.
+ * thread_dbP.h: Declare it.
+
2004-09-09 Roland McGrath <roland(a)redhat.com>
* td_ta_map_lwp2thr.c (td_ta_map_lwp2thr): Don't abort if inferior's
diff --git a/libpthread/nptl_db/Makefile.in b/libpthread/nptl_db/Makefile.in
index 76102e6..5a493d8 100644
--- a/libpthread/nptl_db/Makefile.in
+++ b/libpthread/nptl_db/Makefile.in
@@ -22,13 +22,13 @@ libthread_db_FULL_NAME := libthread_db-$(VERSION).so
libthread_db_DIR := $(top_srcdir)libpthread/nptl_db
libthread_db_OUT := $(top_builddir)libpthread/nptl_db
-libthread_db_SRC := $(wildcard $(libthread_db_DIR)/td_*.c) \
- $(libthread_db_DIR)/fetch-value.c
+libthread_db_SRC := $(notdir $(wildcard $(libthread_db_DIR)/td_*.c) \
+ $(libthread_db_DIR)/fetch-value.c)
ifeq ($(UCLIBC_SUSV4_LEGACY),)
libthread_db_SRC := $(filter-out td_ta_setconcurrency.c,$(libthread_db_SRC))
endif
-libthread_db_OBJ := $(patsubst
$(libthread_db_DIR)/%.c,$(libthread_db_OUT)/%.o,$(libthread_db_SRC))
+libthread_db_OBJ := $(addprefix $(libthread_db_OUT)/,$(libthread_db_SRC:.c=.o))
libthread_db-so-y := $(libthread_db_OBJ:.o=.oS)
ifeq ($(DOPIC),y)
@@ -37,7 +37,7 @@ else
libthread_db-a-y := $(libthread_db_OBJ)
endif
-libthread_db-multi-y := $(libthread_db_SRC)
+libthread_db-multi-y := $(addprefix $(libthread_db_DIR)/,$(libthread_db_SRC))
lib-a-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.a
lib-so-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.so
diff --git a/libpthread/nptl_db/db_info.c b/libpthread/nptl_db/db_info.c
index 521ad78..a57a053 100644
--- a/libpthread/nptl_db/db_info.c
+++ b/libpthread/nptl_db/db_info.c
@@ -1,7 +1,7 @@
/* This file is included by pthread_create.c to define in libpthread
all the magic symbols required by libthread_db.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -37,6 +37,8 @@ typedef struct
typedef struct link_map link_map;
+/* Actually static in nptl/init.c, but we only need it for typeof. */
+extern bool __nptl_initial_report_events;
#define schedparam_sched_priority schedparam.sched_priority
diff --git a/libpthread/nptl_db/structs.def b/libpthread/nptl_db/structs.def
index 915867b..bb571d4 100644
--- a/libpthread/nptl_db/structs.def
+++ b/libpthread/nptl_db/structs.def
@@ -1,5 +1,5 @@
/* List of types and symbols in libpthread examined by libthread_db.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -55,6 +55,7 @@ DB_FUNCTION (__nptl_death_event)
DB_SYMBOL (__nptl_threads_events)
DB_VARIABLE (__nptl_nthreads)
DB_VARIABLE (__nptl_last_event)
+DB_VARIABLE (__nptl_initial_report_events)
DB_ARRAY_VARIABLE (__pthread_keys)
DB_STRUCT (pthread_key_struct)
diff --git a/libpthread/nptl_db/td_ta_map_lwp2thr.c
b/libpthread/nptl_db/td_ta_map_lwp2thr.c
index 9709777..6b4382f 100644
--- a/libpthread/nptl_db/td_ta_map_lwp2thr.c
+++ b/libpthread/nptl_db/td_ta_map_lwp2thr.c
@@ -1,5 +1,5 @@
/* Which thread is running on an LWP?
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,8 +23,8 @@
td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
- lwpid_t lwpid, td_thrhandle_t *th)
+__td_ta_lookup_th_unique (const td_thragent_t *ta_arg,
+ lwpid_t lwpid, td_thrhandle_t *th)
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
ps_err_e err;
@@ -117,9 +117,6 @@ td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
switch (ta->ta_howto)
{
- case ta_howto_unknown:
- return TD_DBERR;
-
default:
return TD_DBERR;
@@ -131,6 +128,7 @@ td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
0, regs, &addr);
if (terr != TD_OK)
return terr;
+
/* In this descriptor the nelem word is overloaded as the bias. */
addr += (int32_t) DB_DESC_NELEM (ta->ta_howto_data.reg);
th->th_unique = addr;
@@ -142,22 +140,22 @@ td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
if (&ps_get_thread_area == NULL)
return TD_NOCAPAB;
- /* A la x86-64, there is a constant magic index for get_thread_area. */
- if (ps_get_thread_area (ta->ph, lwpid,
- ta->ta_howto_data.const_thread_area,
- &th->th_unique) != PS_OK)
- return TD_ERR; /* XXX Other error value? */
- break;
+ /* A la x86-64, there is a magic index for get_thread_area. */
+ if (ps_get_thread_area (ta->ph, lwpid,
+ ta->ta_howto_data.const_thread_area,
+ &th->th_unique) != PS_OK)
+ return TD_ERR; /* XXX Other error value? */
+ break;
- case ta_howto_reg_thread_area:
+ case ta_howto_reg_thread_area:
if (&ps_get_thread_area == NULL)
return TD_NOCAPAB;
- /* A la i386, there is a register with an index for get_thread_area. */
- if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
- return TD_ERR;
- terr = _td_fetch_value_local (ta, ta->ta_howto_data.reg_thread_area, -1,
- 0, regs, &addr);
+ /* A la i386, a register holds the index for get_thread_area. */
+ if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
+ return TD_ERR;
+ terr = _td_fetch_value_local (ta, ta->ta_howto_data.reg_thread_area,
+ -1, 0, regs, &addr);
if (terr != TD_OK)
return terr;
/* In this descriptor the nelem word is overloaded as scale factor. */
@@ -171,7 +169,40 @@ td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
}
/* Found it. Now complete the `td_thrhandle_t' object. */
- th->th_ta_p = (td_thragent_t *) ta;
+ th->th_ta_p = ta;
return TD_OK;
}
+
+td_err_e
+td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
+ lwpid_t lwpid, td_thrhandle_t *th)
+{
+ td_thragent_t *const ta = (td_thragent_t *) ta_arg;
+
+ /* We cannot rely on thread registers and such information at all
+ before __pthread_initialize_minimal has gotten far enough. They
+ sometimes contain garbage that would confuse us, left by the kernel
+ at exec. So if it looks like initialization is incomplete, we only
+ fake a special descriptor for the initial thread. */
+
+ psaddr_t list;
+ td_err_e err = DB_GET_SYMBOL (list, ta, __stack_user);
+ if (err != TD_OK)
+ return err;
+
+ err = DB_GET_FIELD (list, ta, list, list_t, next, 0);
+ if (err != TD_OK)
+ return err;
+
+ if (list == 0)
+ {
+ if (ps_getpid (ta->ph) != lwpid)
+ return TD_ERR;
+ th->th_ta_p = ta;
+ th->th_unique = 0;
+ return TD_OK;
+ }
+
+ return __td_ta_lookup_th_unique (ta_arg, lwpid, th);
+}
diff --git a/libpthread/nptl_db/td_ta_thr_iter.c b/libpthread/nptl_db/td_ta_thr_iter.c
index 1fd02ef..0f1b2bf 100644
--- a/libpthread/nptl_db/td_ta_thr_iter.c
+++ b/libpthread/nptl_db/td_ta_thr_iter.c
@@ -1,5 +1,6 @@
/* Iterate over a process's threads.
- Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+ Copyright (C) 1999,2000,2001,2002,2003,2004,2007
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>om>, 1999.
@@ -23,7 +24,7 @@
static td_err_e
iterate_thread_list (td_thragent_t *ta, td_thr_iter_f *callback,
void *cbdata_p, td_thr_state_e state, int ti_pri,
- psaddr_t head, int fake_empty)
+ psaddr_t head, bool fake_empty)
{
td_err_e err;
psaddr_t next, ofs;
@@ -40,13 +41,13 @@ iterate_thread_list (td_thragent_t *ta, td_thr_iter_f *callback,
if (next == 0 && fake_empty)
{
- /* __pthread_initialize_minimal has not run.
- There is just the main thread to return. */
- td_thrhandle_t th;
- err = td_ta_map_lwp2thr (ta, ps_getpid (ta->ph), &th);
- if (err == TD_OK)
- err = callback (&th, cbdata_p) != 0 ? TD_DBERR : TD_OK;
- return err;
+ /* __pthread_initialize_minimal has not run. There is just the main
+ thread to return. We cannot rely on its thread register. They
+ sometimes contain garbage that would confuse us, left by the
+ kernel at exec. So if it looks like initialization is incomplete,
+ we only fake a special descriptor for the initial thread. */
+ td_thrhandle_t th = { ta, 0 };
+ return callback (&th, cbdata_p) != 0 ? TD_DBERR : TD_OK;
}
/* Cache the offset from struct pthread to its list_t member. */
@@ -135,13 +136,15 @@ td_ta_thr_iter (const td_thragent_t *ta_arg, td_thr_iter_f
*callback,
err = DB_GET_SYMBOL (list, ta, __stack_user);
if (err == TD_OK)
- err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri, list, 1);
+ err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri,
+ list, true);
/* And the threads with stacks allocated by the implementation. */
if (err == TD_OK)
err = DB_GET_SYMBOL (list, ta, stack_used);
if (err == TD_OK)
- err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri, list, 0);
+ err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri,
+ list, false);
return err;
}
diff --git a/libpthread/nptl_db/td_thr_event_enable.c
b/libpthread/nptl_db/td_thr_event_enable.c
index f49682d..fd94580 100644
--- a/libpthread/nptl_db/td_thr_event_enable.c
+++ b/libpthread/nptl_db/td_thr_event_enable.c
@@ -1,5 +1,5 @@
/* Enable event process-wide.
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>om>, 1999.
@@ -25,7 +25,25 @@ td_thr_event_enable (const td_thrhandle_t *th, int onoff)
{
LOG ("td_thr_event_enable");
- /* Write the new value into the thread data structure. */
- return DB_PUT_FIELD (th->th_ta_p, th->th_unique, pthread, report_events, 0,
+ if (th->th_unique != 0)
+ {
+ /* Write the new value into the thread data structure. */
+ td_err_e err = DB_PUT_FIELD (th->th_ta_p, th->th_unique, pthread,
+ report_events, 0,
+ (psaddr_t) 0 + (onoff != 0));
+ if (err != TD_OK)
+ return err;
+
+ /* Just in case we are in the window between initializing __stack_user
+ and copying from __nptl_initial_report_events, we set it too.
+ It doesn't hurt to do this for non-initial threads, since it
+ won't be consulted again anyway. It would take another fetch
+ to get the tid and determine this isn't the initial thread,
+ so just do it always. */
+ }
+
+ /* We are faking it for the initial thread before its thread
+ descriptor is set up. */
+ return DB_PUT_VALUE (th->th_ta_p, __nptl_initial_report_events, 0,
(psaddr_t) 0 + (onoff != 0));
}
diff --git a/libpthread/nptl_db/td_thr_get_info.c b/libpthread/nptl_db/td_thr_get_info.c
index 09d0d1a..27d5d70 100644
--- a/libpthread/nptl_db/td_thr_get_info.c
+++ b/libpthread/nptl_db/td_thr_get_info.c
@@ -1,5 +1,5 @@
/* Get thread information.
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999,2000,2001,2002,2003,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>om>, 1999.
@@ -31,35 +31,49 @@ td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop)
LOG ("td_thr_get_info");
- /* Copy the whole descriptor in once so we can access the several
- fields locally. Excess copying in one go is much better than
- multiple ps_pdread calls. */
- err = DB_GET_STRUCT (copy, th->th_ta_p, th->th_unique, pthread);
- if (err != TD_OK)
- return err;
-
- err = DB_GET_FIELD_ADDRESS (tls, th->th_ta_p, th->th_unique,
- pthread, specific, 0);
- if (err != TD_OK)
- return err;
-
- err = DB_GET_FIELD_LOCAL (schedpolicy, th->th_ta_p, copy, pthread,
- schedpolicy, 0);
- if (err != TD_OK)
- return err;
- err = DB_GET_FIELD_LOCAL (schedprio, th->th_ta_p, copy, pthread,
- schedparam_sched_priority, 0);
- if (err != TD_OK)
- return err;
- err = DB_GET_FIELD_LOCAL (tid, th->th_ta_p, copy, pthread, tid, 0);
- if (err != TD_OK)
- return err;
- err = DB_GET_FIELD_LOCAL (cancelhandling, th->th_ta_p, copy, pthread,
- cancelhandling, 0);
- if (err != TD_OK)
- return err;
- err = DB_GET_FIELD_LOCAL (report_events, th->th_ta_p, copy, pthread,
- report_events, 0);
+ if (th->th_unique == 0)
+ {
+ /* Special case for the main thread before initialization. */
+ copy = NULL;
+ tls = 0;
+ cancelhandling = 0;
+ schedprio = 0;
+ tid = 0;
+ err = DB_GET_VALUE (report_events, th->th_ta_p,
+ __nptl_initial_report_events, 0);
+ }
+ else
+ {
+ /* Copy the whole descriptor in once so we can access the several
+ fields locally. Excess copying in one go is much better than
+ multiple ps_pdread calls. */
+ err = DB_GET_STRUCT (copy, th->th_ta_p, th->th_unique, pthread);
+ if (err != TD_OK)
+ return err;
+
+ err = DB_GET_FIELD_ADDRESS (tls, th->th_ta_p, th->th_unique,
+ pthread, specific, 0);
+ if (err != TD_OK)
+ return err;
+
+ err = DB_GET_FIELD_LOCAL (schedpolicy, th->th_ta_p, copy, pthread,
+ schedpolicy, 0);
+ if (err != TD_OK)
+ return err;
+ err = DB_GET_FIELD_LOCAL (schedprio, th->th_ta_p, copy, pthread,
+ schedparam_sched_priority, 0);
+ if (err != TD_OK)
+ return err;
+ err = DB_GET_FIELD_LOCAL (tid, th->th_ta_p, copy, pthread, tid, 0);
+ if (err != TD_OK)
+ return err;
+ err = DB_GET_FIELD_LOCAL (cancelhandling, th->th_ta_p, copy, pthread,
+ cancelhandling, 0);
+ if (err != TD_OK)
+ return err;
+ err = DB_GET_FIELD_LOCAL (report_events, th->th_ta_p, copy, pthread,
+ report_events, 0);
+ }
if (err != TD_OK)
return err;
@@ -86,9 +100,10 @@ td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop)
infop->ti_lid = tid == 0 ? ps_getpid (th->th_ta_p->ph) : (uintptr_t) tid;
infop->ti_traceme = report_events != 0;
- err = DB_GET_FIELD_LOCAL (infop->ti_startfunc, th->th_ta_p, copy, pthread,
- start_routine, 0);
- if (err == TD_OK)
+ if (copy != NULL)
+ err = DB_GET_FIELD_LOCAL (infop->ti_startfunc, th->th_ta_p, copy, pthread,
+ start_routine, 0);
+ if (copy != NULL && err == TD_OK)
{
uint32_t idx;
for (idx = 0; idx < TD_EVENTSIZE; ++idx)
diff --git a/libpthread/nptl_db/td_thr_getfpregs.c
b/libpthread/nptl_db/td_thr_getfpregs.c
index ff4b599..4f4742a 100644
--- a/libpthread/nptl_db/td_thr_getfpregs.c
+++ b/libpthread/nptl_db/td_thr_getfpregs.c
@@ -1,5 +1,5 @@
/* Get a thread's floating-point register set.
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>om>, 1999.
@@ -28,6 +28,11 @@ td_thr_getfpregs (const td_thrhandle_t *th, prfpregset_t *regset)
LOG ("td_thr_getfpregs");
+ if (th->th_unique == 0)
+ /* Special case for the main thread before initialization. */
+ return ps_lgetfpregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
+ regset) != PS_OK ? TD_ERR : TD_OK;
+
/* We have to get the state and the PID for this thread. */
err = DB_GET_FIELD (cancelhandling, th->th_ta_p, th->th_unique, pthread,
cancelhandling, 0);
diff --git a/libpthread/nptl_db/td_thr_getgregs.c b/libpthread/nptl_db/td_thr_getgregs.c
index 497941b..d5f0f61 100644
--- a/libpthread/nptl_db/td_thr_getgregs.c
+++ b/libpthread/nptl_db/td_thr_getgregs.c
@@ -1,5 +1,5 @@
/* Get a thread's general register set.
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>om>, 1999.
@@ -28,6 +28,11 @@ td_thr_getgregs (const td_thrhandle_t *th, prgregset_t regset)
LOG ("td_thr_getgregs");
+ if (th->th_unique == 0)
+ /* Special case for the main thread before initialization. */
+ return ps_lgetregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
+ regset) != PS_OK ? TD_ERR : TD_OK;
+
/* We have to get the state and the PID for this thread. */
err = DB_GET_FIELD (cancelhandling, th->th_ta_p, th->th_unique, pthread,
cancelhandling, 0);
diff --git a/libpthread/nptl_db/td_thr_setfpregs.c
b/libpthread/nptl_db/td_thr_setfpregs.c
index 3c4e8ed..3154953 100644
--- a/libpthread/nptl_db/td_thr_setfpregs.c
+++ b/libpthread/nptl_db/td_thr_setfpregs.c
@@ -1,5 +1,5 @@
/* Set a thread's floating-point register set.
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>om>, 1999.
@@ -28,6 +28,11 @@ td_thr_setfpregs (const td_thrhandle_t *th, const prfpregset_t
*fpregs)
LOG ("td_thr_setfpregs");
+ if (th->th_unique == 0)
+ /* Special case for the main thread before initialization. */
+ return ps_lsetfpregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
+ fpregs) != PS_OK ? TD_ERR : TD_OK;
+
/* We have to get the state and the PID for this thread. */
err = DB_GET_FIELD (cancelhandling, th->th_ta_p, th->th_unique, pthread,
cancelhandling, 0);
diff --git a/libpthread/nptl_db/td_thr_setgregs.c b/libpthread/nptl_db/td_thr_setgregs.c
index 83d2cd9..5945dea 100644
--- a/libpthread/nptl_db/td_thr_setgregs.c
+++ b/libpthread/nptl_db/td_thr_setgregs.c
@@ -1,5 +1,5 @@
/* Set a thread's general register set.
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>om>, 1999.
@@ -28,6 +28,11 @@ td_thr_setgregs (const td_thrhandle_t *th, prgregset_t gregs)
LOG ("td_thr_setgregs");
+ if (th->th_unique == 0)
+ /* Special case for the main thread before initialization. */
+ return ps_lsetregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
+ gregs) != PS_OK ? TD_ERR : TD_OK;
+
/* We have to get the state and the PID for this thread. */
err = DB_GET_FIELD (cancelhandling, th->th_ta_p, th->th_unique, pthread,
cancelhandling, 0);
diff --git a/libpthread/nptl_db/td_thr_tlsbase.c b/libpthread/nptl_db/td_thr_tlsbase.c
index f7d4c29..9f98bd9 100644
--- a/libpthread/nptl_db/td_thr_tlsbase.c
+++ b/libpthread/nptl_db/td_thr_tlsbase.c
@@ -1,5 +1,5 @@
/* Locate TLS data for a thread.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -29,8 +29,29 @@ td_thr_tlsbase (const td_thrhandle_t *th,
if (modid < 1)
return TD_NOTLS;
+ psaddr_t pd = th->th_unique;
+ if (pd == 0)
+ {
+ /* This is the fake handle for the main thread before libpthread
+ initialization. We are using 0 for its th_unique because we can't
+ trust that its thread register has been initialized. But we need
+ a real pointer to have any TLS access work. In case of dlopen'd
+ libpthread, initialization might not be for quite some time. So
+ try looking up the thread register now. Worst case, it's nonzero
+ uninitialized garbage and we get bogus results for TLS access
+ attempted too early. Tough. */
+
+ td_thrhandle_t main_th;
+ err = __td_ta_lookup_th_unique (th->th_ta_p, ps_getpid (th->th_ta_p->ph),
+ &main_th);
+ if (err == 0)
+ pd = main_th.th_unique;
+ if (pd == 0)
+ return TD_TLSDEFER;
+ }
+
/* Get the DTV pointer from the thread descriptor. */
- err = DB_GET_FIELD (dtv, th->th_ta_p, th->th_unique, pthread, dtvp, 0);
+ err = DB_GET_FIELD (dtv, th->th_ta_p, pd, pthread, dtvp, 0);
if (err != TD_OK)
return err;
diff --git a/libpthread/nptl_db/td_thr_validate.c b/libpthread/nptl_db/td_thr_validate.c
index 49c30c1..1b96b51 100644
--- a/libpthread/nptl_db/td_thr_validate.c
+++ b/libpthread/nptl_db/td_thr_validate.c
@@ -1,5 +1,5 @@
/* Validate a thread handle.
- Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999,2001,2002,2003,2004,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>om>, 1999.
@@ -74,16 +74,10 @@ td_thr_validate (const td_thrhandle_t *th)
if (err == TD_OK)
err = check_thread_list (th, list, &uninit);
- if (err == TD_NOTHR && uninit)
- {
- /* __pthread_initialize_minimal has not run yet.
- But the main thread still has a valid ID. */
- td_thrhandle_t main_th;
- err = td_ta_map_lwp2thr (th->th_ta_p,
- ps_getpid (th->th_ta_p->ph), &main_th);
- if (err == TD_OK && th->th_unique != main_th.th_unique)
- err = TD_NOTHR;
- }
+ if (err == TD_NOTHR && uninit && th->th_unique == 0)
+ /* __pthread_initialize_minimal has not run yet.
+ There is only the special case thread handle. */
+ err = TD_OK;
}
return err;
diff --git a/libpthread/nptl_db/thread_dbP.h b/libpthread/nptl_db/thread_dbP.h
index 24623ef..b8399f7 100644
--- a/libpthread/nptl_db/thread_dbP.h
+++ b/libpthread/nptl_db/thread_dbP.h
@@ -1,5 +1,5 @@
/* Private header for thread debug library
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -254,4 +254,7 @@ extern td_err_e _td_store_value_local (td_thragent_t *ta,
extern td_err_e _td_check_sizeof (td_thragent_t *ta, uint32_t *sizep,
int sizep_name) attribute_hidden;
+extern td_err_e __td_ta_lookup_th_unique (const td_thragent_t *ta,
+ lwpid_t lwpid, td_thrhandle_t *th);
+
#endif /* thread_dbP.h */
diff --git a/test/nptl/tst-cancel4.c b/test/nptl/tst-cancel4.c
index 4ba4045..ecaf297 100644
--- a/test/nptl/tst-cancel4.c
+++ b/test/nptl/tst-cancel4.c
@@ -302,7 +302,8 @@ tf_writev (void *arg)
exit (1);
}
-
+/* sleep is not early cancelable, disable for now */
+#if 0
static void *
tf_sleep (void *arg)
{
@@ -333,7 +334,7 @@ tf_sleep (void *arg)
exit (1);
}
-
+#endif
static void *
tf_usleep (void *arg)
@@ -996,7 +997,6 @@ tf_pause (void *arg)
static void *
tf_accept (void *arg)
{
- int tfd;
struct sockaddr_un sun;
/* To test a non-blocking accept call we make the call file by using
a datagrame socket. */
@@ -1020,13 +1020,11 @@ tf_accept (void *arg)
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-1-XXXXXX");
- tfd = mkstemp(sun.sun_path);
- if (tfd < 0)
+ if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
- close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
@@ -1071,7 +1069,6 @@ tf_accept (void *arg)
static void *
tf_send (void *arg)
{
- int tfd;
struct sockaddr_un sun;
tempfd = socket (AF_UNIX, SOCK_STREAM, 0);
@@ -1087,16 +1084,15 @@ tf_send (void *arg)
if (++tries > 10)
{
printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+ exit (1);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-2-XXXXXX");
- tfd = mkstemp(sun.sun_path);
- if (tfd < 0)
+ if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
- close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
@@ -1155,7 +1151,6 @@ tf_send (void *arg)
static void *
tf_recv (void *arg)
{
- int tfd;
struct sockaddr_un sun;
tempfd = socket (AF_UNIX, SOCK_STREAM, 0);
@@ -1171,16 +1166,15 @@ tf_recv (void *arg)
if (++tries > 10)
{
printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+ exit (1);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-3-XXXXXX");
- tfd = mkstemp(sun.sun_path);
- if (tfd < 0)
+ if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
- close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
@@ -1238,7 +1232,6 @@ tf_recv (void *arg)
static void *
tf_recvfrom (void *arg)
{
- int tfd;
struct sockaddr_un sun;
tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
@@ -1254,16 +1247,15 @@ tf_recvfrom (void *arg)
if (++tries > 10)
{
printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+ exit (1);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-4-XXXXXX");
- tfd = mkstemp(sun.sun_path);
- if (tfd < 0)
+ if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
- close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
@@ -1315,7 +1307,6 @@ tf_recvfrom (void *arg)
static void *
tf_recvmsg (void *arg)
{
- int tfd;
struct sockaddr_un sun;
tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
@@ -1331,16 +1322,15 @@ tf_recvmsg (void *arg)
if (++tries > 10)
{
printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+ exit (1);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-5-XXXXXX");
- tfd = mkstemp(sun.sun_path);
- if (tfd < 0)
+ if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
- close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
@@ -1693,7 +1683,6 @@ tf_msync (void *arg)
static void *
tf_sendto (void *arg)
{
- int tfd;
if (arg == NULL)
// XXX If somebody can provide a portable test case in which sendto()
// blocks we can enable this test to run in both rounds.
@@ -1714,16 +1703,15 @@ tf_sendto (void *arg)
if (++tries > 10)
{
printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+ exit (1);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-6-XXXXXX");
- tfd = mkstemp(sun.sun_path);
- if (tfd < 0)
+ if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
- close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
@@ -1771,7 +1759,6 @@ tf_sendto (void *arg)
static void *
tf_sendmsg (void *arg)
{
- int tfd;
if (arg == NULL)
// XXX If somebody can provide a portable test case in which sendmsg()
// blocks we can enable this test to run in both rounds.
@@ -1792,16 +1779,15 @@ tf_sendmsg (void *arg)
if (++tries > 10)
{
printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+ exit (1);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-7-XXXXXX");
- tfd = mkstemp(sun.sun_path);
- if (tfd < 0)
+ if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
- close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
@@ -1893,7 +1879,6 @@ tf_creat (void *arg)
static void *
tf_connect (void *arg)
{
- int tfd;
if (arg == NULL)
// XXX If somebody can provide a portable test case in which connect()
// blocks we can enable this test to run in both rounds.
@@ -1914,16 +1899,15 @@ tf_connect (void *arg)
if (++tries > 10)
{
printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+ exit (1);
}
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-2-XXXXXX");
- tfd = mkstemp(sun.sun_path);
- if (tfd < 0)
+ if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
- close(tfd);
sun.sun_family = AF_UNIX;
}
while (bind (tempfd, (struct sockaddr *) &sun,
@@ -2135,7 +2119,6 @@ static struct
ADD_TEST (ppoll, 2, 0),
ADD_TEST (write, 2, 0),
ADD_TEST (writev, 2, 0),
- ADD_TEST (sleep, 2, 0),
ADD_TEST (usleep, 2, 0),
ADD_TEST (nanosleep, 2, 0),
ADD_TEST (wait, 2, 0),
diff --git a/test/silly/Makefile.in b/test/silly/Makefile.in
index 2114d4d..4f35368 100644
--- a/test/silly/Makefile.in
+++ b/test/silly/Makefile.in
@@ -4,5 +4,17 @@
RET_hello := 42
RET_tiny := 42
-# missing internal headers, disable these
-TESTS_DISABLED := tst-atomic tst-atomic-long
+ifeq ($(TARGET_ARCH),mips)
+TESTS_DISABLED += tst-atomic tst-atomic-long
+endif
+
+ifeq ($(TARGET_ARCH),sparc)
+TESTS_DISABLED += tst-atomic tst-atomic-long
+endif
+
+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) -fPIC
+CFLAGS_tst-atomic-long = $(atomic_headers) -fPIC
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