mips(el): Invalid ELF .size directive errors with binutils-2.21
Hi, I am using a binutils-2.21 snapshot (2011-03-18) on my Debian/sid i386 Host and tried to include the same version for my mipsel-toolchain. Even with including the new --size-option=warning option [1] as a CFLAGS into the uclibc.mk script, the build of uClibc-0.9.32-rc3 breaks (see below). This should *not* happen with this option: Spy out errors as warnings and continue. As binutils-2.21 is nearly ready-to-be-released, there will be more reports like this as they were on LKML (all issues there got fixed). Doug has already reported here some errors for powerpc, yesterday. From a previous build I have collected some more warnings. host-binutils (see above) and target-binutils was 2.21.51.0.6 (H.J. Lu). While hunting another toolchain bug, I could talk a bit with Peter: There are some macros for mips (see sys/asm.h) to solve these .cprestore/.frame warnings, but not all *.S files were converted to use them consistently. I have about 2000 patches to apply to uClibc (done in 2007/2008, need much manual rework), IIRC I solved these, but are late in the queue. First I have to make general code work/cleanup/fix, after that the arch specifics. But I have no clue on how to fix that. As he is busy with other stuff, I am asking here on the ML. Regards, - Sedat - [1] http://sourceware.org/git/?p=binutils.git;a=commit;h=636841837f3e071fe46e56497a0037dd672b8ffd [ build.log ] ... touch /home/sd/src/freetz/freetz-trunk/source/toolchain-mipsel_gcc-4.6.0-RC-20110314_uClibc-0.9.32-rc3/gcc-4.6.0-RC-20110314-initial/.installed make -C /home/sd/src/freetz/freetz-trunk/source/toolchain-mipsel_gcc-4.6.0-RC-20110314_uClibc-0.9.32-rc3/uClibc-0.9.32-rc3 \ LOCALE_DATA_FILENAME=uClibc-locale-le-32-de_DE-en_US.tar.gz V=1 \ PREFIX= \ DEVEL_PREFIX=/ \ RUNTIME_PREFIX=/ \ HOSTCC=gcc -D_GNU_SOURCE -fno-stack-protector -U_GNU_SOURCE -fno-strict-aliasing -Wa,--size-check=warning \ all make[1]: Entering directory `/home/sd/src/freetz/freetz-trunk/source/toolchain-mipsel_gcc-4.6.0-RC-20110314_uClibc-0.9.32-rc3/uClibc-0.9.32-rc3' GEN include/bits/sysnum.h make[2]: Nothing to be done for `locale_headers'. MKDIR lib AS lib/crt1.o -DNDEBUG -D__ASSEMBLER__ -DL_crt1 AS lib/Scrt1.o -DNDEBUG -D__ASSEMBLER__ -DL_Scrt1 libc/sysdeps/linux/mips/crt1.S: Assembler messages: libc/sysdeps/linux/mips/crt1.S:117: Warning: No .cprestore pseudo-op used in PIC code AS lib/crti.o -DNDEBUG -D__ASSEMBLER__ AS lib/crtn.o -DNDEBUG -D__ASSEMBLER__ initfini.c: Assembler messages: initfini.c:47: Error: .size expression for _init does not evaluate to a constant initfini.c:47: Error: .size expression for _fini does not evaluate to a constant make[1]: *** [lib/crtn.o] Fehler 1 make[1]: Leaving directory `/home/sd/src/freetz/freetz-trunk/source/toolchain-mipsel_gcc-4.6.0-RC-20110314_uClibc-0.9.32-rc3/uClibc-0.9.32-rc3' make: *** [/home/sd/src/freetz/freetz-trunk/source/toolchain-mipsel_gcc-4.6.0-RC-20110314_uClibc-0.9.32-rc3/uClibc-0.9.32-rc3/lib/libc.a] Fehler 2 $ egrep 'Assembler messages|Warning: No|pseudo-op' logs/build.log | egrep '^ldso|^libc' libc/sysdeps/linux/mips/crt1.S: Assembler messages: libc/sysdeps/linux/mips/crt1.S:117: Warning: No .cprestore pseudo-op used in PIC code ldso/ldso/mips/resolve.S: Assembler messages: ldso/ldso/mips/resolve.S:151: Warning: No .cprestore pseudo-op used in PIC code libc/sysdeps/linux/mips/syscall_error.S: Assembler messages: libc/sysdeps/linux/mips/syscall_error.S:50: Warning: No .frame pseudo-op used in PIC code libc/sysdeps/linux/mips/clone.S: Assembler messages: libc/sysdeps/linux/mips/clone.S:146: Warning: No .frame pseudo-op used in PIC code ldso/ldso/mips/resolve.S: Assembler messages: ldso/ldso/mips/resolve.S:151: Warning: No .cprestore pseudo-op used in PIC code - EOT - ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
[PATCH] unbreak vfork on cris architecture
unfortunately the common vfork implementation, which just use the syscall function to interact with the kernel, does not work on the cris architecture. The system call vfork is special, on most architectures just calling syscall is not enough. The patch below adds the vfork implementation from klibc. License should be compatible. Signed-off-by: Waldemar Brodkorb w...@openadk.org --- libc/sysdeps/linux/cris/Makefile.arch |2 +- libc/sysdeps/linux/cris/vfork.S | 33 + 2 files changed, 34 insertions(+), 1 deletions(-) create mode 100644 libc/sysdeps/linux/cris/vfork.S diff --git a/libc/sysdeps/linux/cris/Makefile.arch b/libc/sysdeps/linux/cris/Makefile.arch index 43e1912..8a682b0 100644 --- a/libc/sysdeps/linux/cris/Makefile.arch +++ b/libc/sysdeps/linux/cris/Makefile.arch @@ -7,7 +7,7 @@ CSRC := __init_brk.c brk.c sbrk.c -SSRC := setjmp.S __longjmp.S clone.S sysdep.S syscall.S +SSRC := setjmp.S __longjmp.S clone.S sysdep.S syscall.S vfork.S ifeq ($(UNIFIED_SYSCALL),y) SSRC += __uClibc_syscall.S endif diff --git a/libc/sysdeps/linux/cris/vfork.S b/libc/sysdeps/linux/cris/vfork.S new file mode 100644 index 000..22b3d5d --- /dev/null +++ b/libc/sysdeps/linux/cris/vfork.S @@ -0,0 +1,33 @@ +/* + * vfork.S + * + * On cris, r9 contains the syscall number (set by generated stub); + * r10..r13 contain arguments 0-3 per the standard calling convention. + * The return address is in $srp; so we just need to avoid the stack + * usage of the normal syscall stubs. + */ + +#include asm/unistd.h +#include sys/syscall.h + + .section .text,ax + .balign 4 + .globl __vfork + .type __vfork,@function +__vfork: + move.d __NR_vfork, $r9 + break 13 + + cmps.w -4096,$r10 + blo 1f + neg.d $r10,$r11 + move.d $r11,[errno] + moveq -1,$r10 +1: + ret + nop + + .size __vfork,.-__vfork + +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) -- 1.7.4.1 ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH] unbreak vfork on cris architecture
On Mon, Mar 21, 2011 at 10:24 AM, Waldemar Brodkorb wrote: unfortunately the common vfork implementation, which just use the syscall function to interact with the kernel, does not work on the cris architecture. The system call vfork is special, on most architectures just calling syscall is not enough. The patch below adds the vfork implementation from klibc. License should be compatible. this lacks an explanation as to why vfork is so special on cris. different calling convention ? different return values ? something else ? your simple implementation is probably incorrect -- errno cannot be referenced directly. -mike ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: unbreak vfork on cris architecture
On Mon, Mar 21, 2011 at 11:14 AM, Thorsten Glaser wrote: your simple implementation is probably incorrect -- errno cannot be referenced directly. Mh. On the other hand, the manpage says: In a multithreaded application, vfork() borrows only the thread of control that called vfork() in the parent; that is, the child contains only one thread. The use of vfork() in multithreaded applications, however, is unsafe due to race conditons that can cause the child process to become deadlocked and consequently block both the child and parent process from execution indefinitely. which is irrelevant in the case of updating errno -- the vfork failed and thus no 2nd process is running But if that’s a concern… fix it i have nothing to do with cris. but the answer here is not fix it but rather patch not merged. no sweat off my back since i dont have any cris hardware. He found a problem and a WFM-style fix, which at least improves the situation. then file a bug in bugzilla so someone else will fix it eventually By all means, replace the errno access with a jump to __syscall_error after setting up registers in a way that routine (from sysdeps/linux/cris/sysdep.S) expects it; I don’t know cris assembly but it doesn’t look _too_ hard… tailing to __syscall_error is probably a wise decision -mike ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
static linking failed on MIPS due to multiple definitions
With 0.9.32-rc3, following testing program failed with static linking on MIPS. The result is same with gcc-4.4.5 and gcc-4.5.2. While my old 0.9.29 uClibc plus gcc-4.4.5 works well. Here is static-test.c #include signal.h int main(void) { struct sigaction old, new; sigaction(11, new, old); return 3; } $ mipsel-linux-gcc static-test.c -o static-test -static -lpthread /big/toolchains/stbgcc-4.5.2-0.2/bin/../mipsel-linux-uclibc/sys-root/usr/lib/libc.a(sigaction.os): In function `__libc_sigaction': sigaction.c:(.text+0x0): multiple definition of `__libc_sigaction' /big/toolchains/stbgcc-4.5.2-0.2/bin/../mipsel-linux-uclibc/sys-root/usr/lib/libpthread.a(pt-sigaction.os):pt-sigaction.c:(.text+0x0): first defined here /big/toolchains/stbgcc-4.5.2-0.2/bin/../mipsel-linux-uclibc/sys-root/usr/lib/libc.a(sigaction.os): In function `sigaction': sigaction.c:(.text+0x18): multiple definition of `__sigaction' /big/toolchains/stbgcc-4.5.2-0.2/bin/../mipsel-linux-uclibc/sys-root/usr/lib/libpthread.a(pt-sigaction.os):pt-sigaction.c:(.text+0x18): first defined here collect2: ld returned 1 exit status It is weird here since both __libc_sigaction and __sigaction are hidden, but somehow got pulled in by linker and spit error as above. The similar problem happened on most sig* functions, like sigprocmask, etc. Thanks, Jian ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [patch] remove .size directives from libc/sysdeps/linux/powerpc/crtn.S
On 3/20/2011 1:32 PM, Douglas Mencken wrote: GNU as used to accept (and ignore?) .size directives which referred to undefined symbols. In binutils 2.21, these are treated as errors: AS lib/crti.o AS lib/crtn.o initfini.c: Assembler messages: initfini.c:23: Error: .size expression with symbol `_init' does not evaluate to a constant initfini.c:23: Error: .size expression with symbol `_fini' does not evaluate to a constant make: *** [lib/crtn.o] Error 1 So here's the patch: --- evil/libc/sysdeps/linux/powerpc/crtn.S +++ good/libc/sysdeps/linux/powerpc/crtn.S @@ -9,7 +9,6 @@ addi 1,1,32 mtlr 0 blr - .size _init, .-_init .section .fini .align 2 @@ -20,4 +19,3 @@ addi 1,1,32 mtlr 0 blr - .size _fini, .-_fini the problem is because one of those two labels is missing can you figure out why http://ftp.osuosl.org/pub/manulix/scripts/build-scripts/PPFILES/ppfiles-uclibc/powerpc-crtn.patch After applying, the problem is gone: $ make V=1 AS lib/crti.o -DHAVE_ASM_PPC_REL16 -DHAVE_FORCED_UNWIND -DNDEBUG -D__USE_STDIO_FUTEXES__ -D__ASSEMBLER__ -DUSE___THREAD AS lib/crtn.o -DHAVE_ASM_PPC_REL16 -DHAVE_FORCED_UNWIND -DNDEBUG -D__USE_STDIO_FUTEXES__ -D__ASSEMBLER__ -DUSE___THREAD CC ldso/ldso/ldso.oS -DHAVE_ASM_PPC_REL16 -DHAVE_FORCED_UNWIND -DNDEBUG -D__USE_STDIO_FUTEXES__ -DSHARED -DNOT_IN_libc -DIS_IN_rtld -DUCLIBC_RUNTIME_PREFIX=/ -DUCLIBC_LDSO=ld-uClibc.so.0 -DLDSO_ELFINTERP=powerpc/elfinterp.c -DNOT_IN_libc -DIS_IN_rtld -DUCLIBC_RUNTIME_PREFIX=/ -DUCLIBC_LDSO=ld-uClibc.so.0 AS ldso/ldso/powerpc/resolve.oS -DHAVE_ASM_PPC_REL16 -DHAVE_FORCED_UNWIND -DNDEBUG -D__USE_STDIO_FUTEXES__ -DSHARED -DNOT_IN_libc -DIS_IN_rtld -DUCLIBC_RUNTIME_PREFIX=/ -DUCLIBC_LDSO=ld-uClibc.so.0 -D__ASSEMBLER__ -DUSE___THREAD AR cr ldso/ldso/ld-uClibc_so.a STRIP -x -R .note -R .comment ldso/ldso/ld-uClibc_so.a ... ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc