On Mon, Mar 16, 2009 at 10:34 AM, Groleo Marius <[email protected]> wrote:
> On Fri, Mar 13, 2009 at 8:39 PM, Khem Raj <[email protected]> wrote:
>> On (13/03/09 18:40), Groleo Marius wrote:
>>> Hi list,
>>> I'm trying my luck compiling uClibc on a m68k Coldfire 5475 processor.
>>> I modified the Makefiles so the sources gets compiled with the -fPIC
>>> flag but I still get the error:
>>>
>>> /mnt/workspace/trunk/targets/m68k-unknown-linux-uclibc/build/build-libc/ldso/ldso/m68k/elfinterp.c:326:
>>> relocation truncated to fit: R_68K_PC16 against symbol `_dl_skip_args'
>>> defined in .bss section in ldso/ldso/ld-uClibc_so.a(ldso.oS).
>>>
>>> Does any one has any ideea ?
>>
>> can you try the attached patch
> I patched successfully but now I get other errors. below you have a
> snip of the log.
>
> [ALL  ]    ./libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h:33:
> warning: no previous prototype for 'testandset'
> [ALL  ]    libpthread/linuxthreads.old/manager.c: In function
> '__pthread_manager_event':
> [ALL  ]    libpthread/linuxthreads.old/manager.c:252: warning:
> function might be possible candidate for attribute 'noreturn'
> [ALL  ]    libpthread/linuxthreads.old/manager.c: In function
> 'pthread_handle_create':
> [ALL  ]    libpthread/linuxthreads.old/manager.c:582: warning:
> declaration of 'mask' shadows a parameter
> [ALL  ]    libpthread/linuxthreads.old/manager.c:472: warning:
> shadowed declaration is here
> [ALL  ]    m68k-unknown-linux-uclibc-gcc -c
> libpthread/linuxthreads.old/mutex.c -o
> libpthread/linuxthreads.old/mutex.os -include ./include/libc-symbols.h
> -Wall -pipe -Wstrict-prototypes -fno-strict-aliasing -Wnested-externs
> -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wformat=2
> -Wmissing-prototypes -Wmissing-declarations -Wnonnull -Wundef
> -fno-stack-protector -fno-builtin -nostdinc -I./include -I.
> -I./libc/sysdeps/linux/m68k -fno-asm
> -I/home/mariusn/workspace/trunk/_src/linux-2.6.26/include/asm-m68k
> -I/home/mariusn/workspace/trunk/_src/uClibc-0.9.29/libc/sysdeps/linux/common/
> -I/home/mariusn/workspace/trunk/_src/uClibc-0.9.29/libc/sysdeps/linux/
> -DUCLIBC_INTERNAL -std=gnu99 -O0 -g3
> -I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux/m68k
> -I./libpthread/linuxthreads.old/sysdeps/m68k
> -I./libpthread/linuxthreads.old/sysdeps/unix/sysv/linux
> -I./libpthread/linuxthreads.old/sysdeps/pthread
> -I./libpthread/linuxthreads.old -I./libpthread
> -I/home/mariusn/cross-compiled/m68k-unknown-linux-uclibc/m68k-unknown-linux-uclibc/sys-root/usr/include/
> -I/mnt/workspace/trunk/targets/m68k-unknown-linux-uclibc/build/gcc-core-static/lib/gcc/m68k-unknown-linux-uclibc/4.3.2//include-fixed
> -I/mnt/workspace/trunk/targets/m68k-unknown-linux-uclibc/build/gcc-core-static/lib/gcc/m68k-unknown-linux-uclibc/4.3.2/include
> -DMALLOC_DEBUGGING -DHEAP_DEBUGGING -fpic -DNOT_IN_libc
> -DIS_IN_libpthread -MT libpthread/linuxthreads.old/mutex.os -MD -MP
> -MF libpthread/linuxthreads.old/.mutex.os.dep
> [ALL  ]    In file included from libpthread/linuxthreads.old/internals.h:30,
> [ALL  ]                     from libpthread/linuxthreads.old/mutex.c:22:
> [ALL  ]    ./libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h:33:
> warning: no previous prototype for 'testandset'
> [ALL  ]    {standard input}: Assembler messages:
> [ALL  ]    {standard input}:10013: Error: operands mismatch --
> statement `sne -1(%fp)' ignored
> [ALL  ]    {standard input}:10120: Error: operands mismatch --
> statement `sne -1(%fp)' ignored
> [ERROR]    make[1]: *** [libpthread/linuxthreads.old/mutex.os] Error 1
>

Got it working with the attached patch.
Thanks a lot Raj.



-- 
Regards, Groleo!
diff -ruN uClibc-0.9.30.orig/ldso/ldso/m68k/dl-startup.h uClibc-0.9.30/ldso/ldso/m68k/dl-startup.h
--- uClibc-0.9.30.orig/ldso/ldso/m68k/dl-startup.h	2008-07-23 13:59:18.000000000 +0300
+++ uClibc-0.9.30/ldso/ldso/m68k/dl-startup.h	2009-03-16 10:09:50.000000000 +0200
@@ -4,6 +4,17 @@
  * Copyright (C) 2005 by Erik Andersen <[email protected]>
  */
 
+/* Perform operation OP with PC-relative SRC as the first operand and
+ * DST as the second.  TMP is available as a temporary if needed.  */
+
+#ifdef __mcoldfire__
+#define PCREL_OP(OP, SRC, DST, TMP, PC) \
+  "move.l #" SRC " - ., " TMP "\n\t" OP " (-8, " PC ", " TMP "), " DST
+#else
+#define PCREL_OP(OP, SRC, DST, TMP, PC) \
+  OP " " SRC "(" PC "), " DST
+#endif
+
 __asm__ ("\
 	.text\n\
 	.globl _start\n\
@@ -21,7 +32,7 @@
 	move.l %d0, %a4\n\
 	# See if we were run as a command with the executable file\n\
 	# name as an extra leading argument.\n\
-	move.l _dl_skip_args(%pc), %d0\n\
+	" PCREL_OP ("move.l", "_dl_skip_args", "%d0", "%d0", "%pc") "\n\
 	# Pop the original argument count\n\
 	move.l (%sp)+, %d1\n\
 	# Subtract _dl_skip_args from it.\n\
@@ -31,7 +42,7 @@
 	# Push back the modified argument count.\n\
 	move.l %d1, -(%sp)\n\
 	# Pass our finalizer function to the user in %a1.\n\
-	lea _dl_fini(%pc), %a1\n\
+	" PCREL_OP ("lea", "_dl_fini", "%a1", "%a1", "%pc") "\n\
 	# Initialize %fp with the stack pointer.\n\
 	move.l %sp, %fp\n\
 	# Jump to the user's entry point.\n\
diff -ruN uClibc-0.9.30.orig/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h uClibc-0.9.30/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h
--- uClibc-0.9.30.orig/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h	2008-01-06 02:04:02.000000000 +0200
+++ uClibc-0.9.30/libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h	2009-03-16 13:17:51.000000000 +0200
@@ -40,7 +40,7 @@
 #else
          "bset #7,%1; sne %0"
 #endif
-       : "=dm"(ret), "=m"(*spinlock)
+       : "=&dm"(ret), "=m"(*spinlock)
        : "m"(*spinlock)
        : "cc");
 
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to