Hi Leonid,
you recently fixed a bug somehow related to static linking stuff. Do you have an idea why compiling for PowerPC fails like this when using static linking: /home/wbx/ppc-static/toolchain_qemu-ppc-macppc_uclibc-ng_hard/usr/bin/ppc-openadk-linux-uclibc-gcc -Wl,-EB -Wl,-z,now -Wl,-static -static-libgcc -Wl,-rpath,/home/wbx/ppc-static/toolchain_build_qemu-ppc-macppc_uclibc-ng_hard/w-uClibc-ng-1.0.15-1/uClibc-ng-1.0.15/test/argp -L/home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/lib -L/home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib -Wl,-O1 -Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib -static bug-argp1.o -o bug-argp1 -luargp /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigismember': sigsetops.c:(.text+0x0): multiple definition of `__sigismember' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x0): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigaddset': sigsetops.c:(.text+0x28): multiple definition of `__sigaddset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x28): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigdelset': sigsetops.c:(.text+0x4c): multiple definition of `__sigdelset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x4c): first defined here collect2: error: ld returned 1 exit status make[8]: *** [bug-argp1] Error 1 make[7]: *** [_dircompile_argp] Error 2 make[6]: *** [test_compile] Error 2 make[5]: *** [/home/wbx/ppc-static/toolchain_build_qemu-ppc-macppc_uclibc-ng_hard/w-uClibc-ng-1.0.15-1/uClibc-ng-1.0.15/.installed] Error 2 make[4]: *** [uclibc-ng-install] Error 2 make[3]: *** [toolchain/final] Error 2 make[2]: *** [world] Error 2
ARM and MIPS works fine.
best regards Waldemar
I can't comment on what causes the "multiple definition ..." issue, but here's what I do to get around it. LDFLAGS="-zmuldefs" This tells it to ignore it when linking, though a real fix would probably be better.
Lance
On 5/31/2016 2:08 PM, Waldemar Brodkorb wrote:
Hi Leonid,
you recently fixed a bug somehow related to static linking stuff. Do you have an idea why compiling for PowerPC fails like this when using static linking: /home/wbx/ppc-static/toolchain_qemu-ppc-macppc_uclibc-ng_hard/usr/bin/ppc-openadk-linux-uclibc-gcc -Wl,-EB -Wl,-z,now -Wl,-static -static-libgcc -Wl,-rpath,/home/wbx/ppc-static/toolchain_build_qemu-ppc-macppc_uclibc-ng_hard/w-uClibc-ng-1.0.15-1/uClibc-ng-1.0.15/test/argp -L/home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/lib -L/home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib -Wl,-O1 -Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib -static bug-argp1.o -o bug-argp1 -luargp /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigismember': sigsetops.c:(.text+0x0): multiple definition of `__sigismember' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x0): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigaddset': sigsetops.c:(.text+0x28): multiple definition of `__sigaddset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x28): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigdelset': sigsetops.c:(.text+0x4c): multiple definition of `__sigdelset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x4c): first defined here collect2: error: ld returned 1 exit status make[8]: *** [bug-argp1] Error 1 make[7]: *** [_dircompile_argp] Error 2 make[6]: *** [test_compile] Error 2 make[5]: *** [/home/wbx/ppc-static/toolchain_build_qemu-ppc-macppc_uclibc-ng_hard/w-uClibc-ng-1.0.15-1/uClibc-ng-1.0.15/.installed] Error 2 make[4]: *** [uclibc-ng-install] Error 2 make[3]: *** [toolchain/final] Error 2 make[2]: *** [world] Error 2
ARM and MIPS works fine.
best regards Waldemar _______________________________________________ devel mailing list devel@uclibc-ng.org http://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel
On Tue, May 31, 2016 at 11:08 PM, Waldemar Brodkorb wbx@uclibc-ng.org wrote:
Hi Leonid,
you recently fixed a bug somehow related to static linking stuff. Do you have an idea why compiling for PowerPC fails like this when using static linking:
Looks like conditional #ifdef's conflict somewhere. Have no idea why problem appear on PPC only yet. Could you provide your .config for PPC & output of nm -S libuargp/argp-xinl.os ?
Will be even better if you can publish complete PPC toolchain, this allow me to reproduce the problem myself.
Regards, Leonid
/home/wbx/ppc-static/toolchain_qemu-ppc-macppc_uclibc-ng_hard/usr/bin/ppc-openadk-linux-uclibc-gcc -Wl,-EB -Wl,-z,now -Wl,-static -static-libgcc -Wl,-rpath,/home/wbx/ppc-static/toolchain_build_qemu-ppc-macppc_uclibc-ng_hard/w-uClibc-ng-1.0.15-1/uClibc-ng-1.0.15/test/argp -L/home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/lib -L/home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib -Wl,-O1 -Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib -static bug-argp1.o -o bug-argp1 -luargp /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigismember': sigsetops.c:(.text+0x0): multiple definition of `__sigismember' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x0): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigaddset': sigsetops.c:(.text+0x28): multiple definition of `__sigaddset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x28): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigdelset': sigsetops.c:(.text+0x4c): multiple definition of `__sigdelset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x4c): first defined here collect2: error: ld returned 1 exit status make[8]: *** [bug-argp1] Error 1 make[7]: *** [_dircompile_argp] Error 2 make[6]: *** [test_compile] Error 2 make[5]: *** [/home/wbx/ppc-static/toolchain_build_qemu-ppc-macppc_uclibc-ng_hard/w-uClibc-ng-1.0.15-1/uClibc-ng-1.0.15/.installed] Error 2 make[4]: *** [uclibc-ng-install] Error 2 make[3]: *** [toolchain/final] Error 2 make[2]: *** [world] Error 2
ARM and MIPS works fine.
best regards Waldemar
Hi Leonid, Leonid Lisovskiy wrote,
On Tue, May 31, 2016 at 11:08 PM, Waldemar Brodkorb wbx@uclibc-ng.org wrote:
Hi Leonid,
you recently fixed a bug somehow related to static linking stuff. Do you have an idea why compiling for PowerPC fails like this when using static linking:
Looks like conditional #ifdef's conflict somewhere. Have no idea why problem appear on PPC only yet.
Yeah, that is strange. ARM/MIPS works, both NPTL, too. So what is different in PPC?
Could you provide your .config for PPC & output of nm -S libuargp/argp-xinl.os ?
Will be even better if you can publish complete PPC toolchain, this allow me to reproduce the problem myself.
You can find a toolchain here: http://debug.openadk.org/ppc-static/ Linux/x86_64 statically linked.
No extra dir is in the archive, two directories and a README are extracted. It is a relocatable toolchain, the two directories just must be in the same directory.
best regards Waldemar
On Thu, Jun 2, 2016 at 10:04 PM, Waldemar Brodkorb wbx@uclibc-ng.org wrote:
Will be even better if you can publish complete PPC toolchain, this allow me to reproduce the problem myself.
You can find a toolchain here: http://debug.openadk.org/ppc-static/ Linux/x86_64 statically linked.
Thank you, I will try. Anyway, please send to me uClibc-ng .config you used in your PPC build. Potential unusual problems could be related with it.
regards, Leonid
Hi Leonid, Leonid Lisovskiy wrote,
On Thu, Jun 2, 2016 at 10:04 PM, Waldemar Brodkorb wbx@uclibc-ng.org wrote:
Will be even better if you can publish complete PPC toolchain, this allow me to reproduce the problem myself.
You can find a toolchain here: http://debug.openadk.org/ppc-static/ Linux/x86_64 statically linked.
Thank you, I will try. Anyway, please send to me uClibc-ng .config you used in your PPC build. Potential unusual problems could be related with it.
Attached the config.
best regards Waldemar
On Fri, Jun 3, 2016 at 6:25 PM, Waldemar Brodkorb wbx@uclibc-ng.org wrote:
You can find a toolchain here: http://debug.openadk.org/ppc-static/
I reproduce the problem, using toolchain provided. Will try to fix it.
Additional five cents more - libuargp(UCLIBC_HAS_ARGP) requires getopt functions, so must "depends on" or "select" UCLIBC_HAS_GNU_GETOPT & UCLIBC_HAS_GETOPT_LONG in extra/Configs/Config.in to avoid following build errors:
lib/libuargp.a(argp-parse.os): In function `argp_parse': argp-parse.c:(.text.argp_parse+0x41a): undefined reference to `_getopt_long_only_r' argp-parse.c:(.text.argp_parse+0x443): undefined reference to `_getopt_long_r'
Regards Leonid
This problem is a side effect of commit 251a3c19cb "sleep: employ __USE_EXTERN_INLINES (with necessary fixes)" due to dropped "extern" clause. See comment for libc/sysdeps/linux/common/bits/sigset.h:
+ /* dropped extern below: otherwise every module with __USE_EXTERN_INLINES + * will have its own copy of out-of line function emitted. */
I have to find more smart solution to allow use of __USE_EXTERN_INLINES outside of libc itself.
Regards, Leonid
Hi Leonid, Leonid Lisovskiy wrote,
On Fri, Jun 3, 2016 at 6:25 PM, Waldemar Brodkorb wbx@uclibc-ng.org wrote:
You can find a toolchain here: http://debug.openadk.org/ppc-static/
I reproduce the problem, using toolchain provided. Will try to fix it.
Additional five cents more - libuargp(UCLIBC_HAS_ARGP) requires getopt functions, so must "depends on" or "select" UCLIBC_HAS_GNU_GETOPT & UCLIBC_HAS_GETOPT_LONG in extra/Configs/Config.in to avoid following build errors:
lib/libuargp.a(argp-parse.os): In function `argp_parse': argp-parse.c:(.text.argp_parse+0x41a): undefined reference to `_getopt_long_only_r' argp-parse.c:(.text.argp_parse+0x443): undefined reference to `_getopt_long_r'
Thanks, I applied a fix using select.
best regards Waldemar
Commit 251a3c19cb "sleep: employ __USE_EXTERN_INLINES (with necessary fixes)" introduces following problems:
1. __USE_EXTERN_INLINES forcibly enabled build fails
... LD libuClibc-1.0.15.so libc/libc_so.a(cmsg_nxthdr.os): In function `__GI___cmsg_nxthdr': cmsg_nxthdr.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr' libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here libc/libc_so.a(creat.os): In function `__GI___cmsg_nxthdr': creat.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr' libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here ...
2. libuargp wrongly contains __cmsg_nxthdr/__sigismember/__sigdelset/__sigaddset global symbols on platforms which includes signal.h from sys/procfs.h As result, static linking will fail:
TEST_LINK argp/ bug-argp1 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigismember': sigsetops.c:(.text+0x0): multiple definition of `__sigismember' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x0): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigaddset': sigsetops.c:(.text+0x28): multiple definition of `__sigaddset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x28): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigdelset': sigsetops.c:(.text+0x4c): multiple definition of `__sigdelset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x4c): first defined here
We have to partially revert 251a3c19cb to fix problems above. It is safe to do this after commit 162cfaea20 *: inline constant __sig{add,del}set and __sigismember since we are able to use new inlines from within libc and leave the rest of world(__USE_EXTERN_INLINES) equal to glibc now.
Signed-off-by: Leonid Lisovskiy lly.dev@gmail.com --- libc/signal/sigsetops.c | 2 +- libc/sysdeps/linux/common/bits/sigset.h | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/libc/signal/sigsetops.c b/libc/signal/sigsetops.c index fa5fe6a..da5803e 100644 --- a/libc/signal/sigsetops.c +++ b/libc/signal/sigsetops.c @@ -3,7 +3,7 @@
#include <features.h>
-#define __PROVIDE_OUT_OF_LINE_SIGSETFN +#define _EXTERN_INLINE #ifndef __USE_EXTERN_INLINES # define __USE_EXTERN_INLINES 1 #endif diff --git a/libc/sysdeps/linux/common/bits/sigset.h b/libc/sysdeps/linux/common/bits/sigset.h index f220e81..2c9fe74 100644 --- a/libc/sysdeps/linux/common/bits/sigset.h +++ b/libc/sysdeps/linux/common/bits/sigset.h @@ -52,6 +52,10 @@ typedef struct { #if !defined _SIGSET_H_fns && defined _SIGNAL_H # define _SIGSET_H_fns 1
+# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE __extern_inline +# endif + /* Return a mask that includes the bit for SIG only. */ /* Unsigned cast ensures shift/mask insns are used. */ # define __sigmask(sig) \ @@ -151,24 +155,14 @@ typedef struct { /* These functions needn't check for a bogus signal number -- error checking is done in the non __ versions. */
-# if !defined __USE_EXTERN_INLINES || defined __PROVIDE_OUT_OF_LINE_SIGSETFN extern int __sigismember (const __sigset_t *, int); libc_hidden_proto(__sigismember) extern void __sigaddset (__sigset_t *, int); libc_hidden_proto(__sigaddset) extern void __sigdelset (__sigset_t *, int); libc_hidden_proto(__sigdelset) -# endif
# ifdef __USE_EXTERN_INLINES -# undef _EXTERN_INLINE -# ifdef __PROVIDE_OUT_OF_LINE_SIGSETFN -# define _EXTERN_INLINE -# else /* normal case */ - /* dropped extern below: otherwise every module with __USE_EXTERN_INLINES - * will have its own copy of out-of line function emitted. */ -# define _EXTERN_INLINE /*extern*/ __always_inline -# endif # define __SIGSETFN(RET_TYPE, NAME, BODY, CONST) \ _EXTERN_INLINE RET_TYPE \ NAME (CONST __sigset_t *__set, int __sig) \
Hi Leonid, Leonid Lisovskiy wrote,
Commit 251a3c19cb "sleep: employ __USE_EXTERN_INLINES (with necessary fixes)" introduces following problems:
- __USE_EXTERN_INLINES forcibly enabled build fails
... LD libuClibc-1.0.15.so libc/libc_so.a(cmsg_nxthdr.os): In function `__GI___cmsg_nxthdr': cmsg_nxthdr.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr' libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here libc/libc_so.a(creat.os): In function `__GI___cmsg_nxthdr': creat.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr' libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here ...
- libuargp wrongly contains __cmsg_nxthdr/__sigismember/__sigdelset/__sigaddset
global symbols on platforms which includes signal.h from sys/procfs.h As result, static linking will fail:
TEST_LINK argp/ bug-argp1 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigismember': sigsetops.c:(.text+0x0): multiple definition of `__sigismember' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x0): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigaddset': sigsetops.c:(.text+0x28): multiple definition of `__sigaddset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x28): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigdelset': sigsetops.c:(.text+0x4c): multiple definition of `__sigdelset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x4c): first defined here
We have to partially revert 251a3c19cb to fix problems above. It is safe to do this after commit 162cfaea20 *: inline constant __sig{add,del}set and __sigismember since we are able to use new inlines from within libc and leave the rest of world(__USE_EXTERN_INLINES) equal to glibc now.
Signed-off-by: Leonid Lisovskiy lly.dev@gmail.com
libc/signal/sigsetops.c | 2 +- libc/sysdeps/linux/common/bits/sigset.h | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-)
Great! Now I can test static build for more architectures. Applied and pushed, Thx Waldemar