Hi,
I'm trying to build uclibc-ng-test, but I can't link with complex trigo functions (such as cacos, casin, catan, etc.). They are required for the following test targets: test-double, test-double-finite, test-float, test-float-finite, test-idouble, and test-ifloat. They are declared in uclibc-ng/sysdeps/linux/common/bits/cmathcalls.h, but I can't find their definitions.
Does uclibc-ng define them?
Thanks,
--
Laurent Thévenoux
lthevenoux(a)kalray.eu
Kalray S.A.
180 Avenue de l'Europe 38330 Montbonnot FRANCE
Definitions of POLLWRNORM, POLLWRBAND and POLLREMOVE in xtensa linux
kernel are non-standard. Provide bits/poll.h with correct values for
these constants.
This fixes the following strace build errors:
In file included from xlat/pollflags.h:4:0,
from poll.c:34:
./static_assert.h:40:24: error: static assertion failed: "POLLWRBAND != 0x0100"
# define static_assert _Static_assert
^
xlat/pollflags.h:75:1: note: in expansion of macro ‘static_assert’
static_assert((POLLWRBAND) == (0x0100), "POLLWRBAND != 0x0100");
^~~~~~~~~~~~~
./static_assert.h:40:24: error: static assertion failed: "POLLREMOVE != 0x0800"
# define static_assert _Static_assert
^
xlat/pollflags.h:117:1: note: in expansion of macro ‘static_assert’
static_assert((POLLREMOVE) == (0x0800), "POLLREMOVE != 0x0800");
^~~~~~~~~~~~~
Signed-off-by: Max Filippov <jcmvbkbc(a)gmail.com>
---
libc/sysdeps/linux/xtensa/bits/poll.h | 49 +++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 libc/sysdeps/linux/xtensa/bits/poll.h
diff --git a/libc/sysdeps/linux/xtensa/bits/poll.h b/libc/sysdeps/linux/xtensa/bits/poll.h
new file mode 100644
index 000000000000..4588cc326006
--- /dev/null
+++ b/libc/sysdeps/linux/xtensa/bits/poll.h
@@ -0,0 +1,49 @@
+/* Copyright (C) 1997, 2001, 2006 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_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
+
+/* Event types that can be polled for. These bits may be set in `events'
+ to indicate the interesting event types; they will appear in `revents'
+ to indicate the status of the file descriptor. */
+#define POLLIN 0x001 /* There is data to read. */
+#define POLLPRI 0x002 /* There is urgent data to read. */
+#define POLLOUT 0x004 /* Writing now will not block. */
+
+#ifdef __USE_XOPEN
+/* These values are defined in XPG4.2. */
+# define POLLRDNORM 0x040 /* Normal data may be read. */
+# define POLLRDBAND 0x080 /* Priority data may be read. */
+# define POLLWRNORM POLLOUT /* Writing now will not block. */
+# define POLLWRBAND 0x100 /* Priority data may be written. */
+#endif
+
+#ifdef __USE_GNU
+/* These are extensions for Linux. */
+# define POLLMSG 0x400
+# define POLLREMOVE 0x800
+# define POLLRDHUP 0x2000
+#endif
+
+/* Event types always implicitly polled for. These bits need not be set in
+ `events', but they will appear in `revents' to indicate the status of
+ the file descriptor. */
+#define POLLERR 0x008 /* Error condition. */
+#define POLLHUP 0x010 /* Hung up. */
+#define POLLNVAL 0x020 /* Invalid polling request. */
--
2.11.0
On January 29,2017 a patch (9b457baf8d46329f7d7ee2aa084022bb0df88551<https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=9b457baf8d4632…>)by mirabilos m(a)mirbsd.org<mailto:m@mirbsd.org> was accepted in the repository. I have a few questions on this patch.
1) The patch created a new file syscall6.S in the i386 directory. It seems functionally equivalent to the syscall.S. Both process 6 arguments plus the NR. Both use the exact same registers. Only an alignment directive has been added and the order of loading the registers is reverse. It also appears that glib does not have a special syscall6.S. Why did we go this route special casing 6 argument syscalls only?
2) The LOADARGS_6, RESTOREARGS_6 and ASMFMT_6 defines are removed from <bits/syscall.h>. It is not clear why from the patch.
3) There seems to be a deficiency in the syscall setup that is not present in glibc making it impossible to get a backtrace from a syscall. For example, If one looks at uclibs-ng's sysdeps.h in i386, one can see cfi_adjust_cfa_offset/cfi_rel_offset usage in the _PUSH_ARGS_1 and _POP_ARGS_N macros allowing backtrace information to be present on the stack. However, syscall/syscall6.S as well as bits/syscalls.h do not allow for this. In addition, it appears that glibc does have this mechanism in its syscall.S.
Thoughts anyone?
Thanks,
----
John Ata, CISSP
Senior Principal Software Engineer
Electronics Systems
STOP Operating System<http://www.baesystems.com/en-us/product/stop> Software Development
T 703-563-8115 | F 703-668-4359 | john.ata(a)baesystems.com<mailto:john.ata@baesystems.com>
http://www.baesystems.com/csp
[cid:image001.png@01D138BC.8E54E330][cid:image003.png@01D138BC.8E54E330]<http://www.twitter.com/baesystemsinc>[cid:image004.png@01D138BC.8E54E330]<http://www.youtube.com/baesystemsinc>[cid:image006.png@01D138BC.8E54E330]<http://www.flickr.com/photos/baesystemsinc/>
On Linux/MIPS (O32 ABI) for system call we have two result registers - v0 and a3.
v0 contains actual syscall result on success or error number on fail, a3 set to 0/1
for indicating syscall success/fail. (if a3 == 1, v0 contains errno).
Now as we can see from definition of handle_sys (arch/mips/kernel/scall32-o32.S),
handler treats returned by syscall function (let's call "original") values in
range [-EMAXERRNO; 0[ as -errno, a3 is set to 1 and final returned (to userspace)
value is (-original).
INLINE_SYSCALL_NOERR_NCS defined in mips/bits/syscalls.h will handle
this behaviour.
Signed-off-by: Volodymyr Boyko <boyko.cxx(a)gmail.com>
---
libc/sysdeps/linux/mips/bits/syscalls.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libc/sysdeps/linux/mips/bits/syscalls.h b/libc/sysdeps/linux/mips/bits/syscalls.h
index 787bb7d..b8f8059 100644
--- a/libc/sysdeps/linux/mips/bits/syscalls.h
+++ b/libc/sysdeps/linux/mips/bits/syscalls.h
@@ -29,6 +29,16 @@
} \
result_var; })
+#define INLINE_SYSCALL_NOERR_NCS(name, nr, args...) \
+({ \
+ INTERNAL_SYSCALL_DECL(err); \
+ long res = INTERNAL_SYSCALL_NCS(name, err, nr, args); \
+ if (unlikely(INTERNAL_SYSCALL_ERROR_P(res, err))) { \
+ res = -res; \
+ } \
+ res; \
+})
+
#define INTERNAL_SYSCALL_DECL(err) long err attribute_unused
#define INTERNAL_SYSCALL_ERROR_P(val, err) ((long) (err))
--
2.7.4
Hello.
I faced a problem I can't solve by myself so I will be grateful for any
help.
This code causes segfault:
#include <poll.h>
#include <pthread.h>
static void * thread_func (void *arg) {
int count = 0;
struct pollfd pfds[1] = { 0 };
poll(pfds, count, 1000);
}
int main () {
pthread_t thread;
if (pthread_create(&thread, NULL, thread_func, NULL)) return 1;
if (pthread_cancel(thread)) return 2;
if (pthread_join(thread, NULL)) return 3;
return 0;
}
This is how backtrace looks:
Thread 2 received signal SIG32.
Thread 2:
#0 0xb76b24f6 in __poll_nocancel (fds=0xb76a0414, nfds=0, timeout=1000)
at libc/sysdeps/linux/common/poll.c:27
#1 0xb76b2585 in __GI_poll (fds=0xb76a0414, nfds=0, timeout=1000) at
libc/sysdeps/linux/common/poll.c:208
#2 0x080484c3 in thread_func ()
#3 0xb77954b0 in start_thread (arg=0xb76ebba0) at
libpthread/nptl/pthread_create.c:285
#4 0xb76fcae7 in clone () at libc/sysdeps/linux/i386/clone.S:103
Thread 1:
#0 0xb77996f1 in pthread_join (threadid=3077487520, thread_return=0x0)
at libpthread/nptl/pthread_join.c:88
#1 0x08048522 in main ()
Architecture is i386.
Interesting thing is that segmentation fault only happens when uClibc-ng
built with debug enabled (DODEBUG=y).
Thank you.