Hi all,
I'm facing a compilation error while building GCC 7.2.0 libgo with
uClibc-ng 1.0.26 with this error:
runtime_sysinfo.go:418:17: error: use of undefined type
‘___uclibc_locale_struct’
Here is the relevant build output: https://pastebin.com/B7urxS2m
The problematic runtime_sysinfo.go is created using -fdump-go-spec: it's
used to automatically generate Go declarations from C code (see
https://golang.org/doc/install/gccgo#Automatic_generation_of_Go_declaration…).
The generated gen-sysinfo.go is indeed missing ___uclibc_locale_struct
declaration.
Looks like -fdump-go-spec generates types only from typedef declarations,
ignoring structs, like "struct __uclibc_locale_struct;" in uClibc_locale.h.
This simple change allows to build libgo fine:
--- uClibc_locale.h.orig 2017-09-25 19:49:38.000000000 +0000
+++ uClibc_locale.h 2017-09-28 07:27:14.035517712 +0000
@@ -73,6 +73,7 @@
*/
struct __uclibc_locale_struct;
+typedef struct __uclibc_locale_struct __uclibc_locale_struct;
typedef struct __uclibc_locale_struct *__locale_t;
#endif /* !defined(__LOCALE_C_ONLY) */
Does this change look sane? Or should I patch GCC libgo/sysinfo.c instead
to add "typedef struct __uclibc_locale_struct __uclibc_locale_struct;"
there?
Thanks,
Alex
An issue has been found with current implementation of ARC signal restorer
function in uClibc and how GDB handles it. When debugger information is not
present, everything worked fine, because GDB would use a built-in logic to
determine if function is a signal restorer. However when debugging information
is present, debugger would rely solely on it and wouldn't use ARC-specific
functions to detect signal handler frames. Because debug information for signal restorer is generated
completely by the compiler, it lacks a marker, that identifies this as a
signal frame that requires special handling. While it is possible to insert
that marker via inline assembly, that still doesn't solve the whole problem,
because some other expectations are not met by the debug information - there
is no "nop" in front of the function, needed to fool debugger into thinking
that this was a function call, and references to previous frame information
need to be described manually. The simplest way to fix the problem is just
to make sure that signal restorer function will not have any debug function
at all, which can be done by writing it in assembly.
Alternative, more complex solution, where debug information for signal
frame is manually defined can be found in
glibc/sysdeps/unix/sysv/linux/x86_64/sigaction.c [1].
[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x8…
Signed-off-by: Anton Kolesov <Anton.Kolesov(a)synopsys.com>
Anton