This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: glibc 2.3.2 targeting arm-linux, failed to cross-compile.
On Fri, May 16, 2003 at 12:19:02AM -0400, Daniel Jacobowitz wrote:
> On Thu, May 15, 2003 at 08:46:10PM +0300, Nick Patavalis wrote:
> >
> > Finaly, and thanks to your patches, I got glibc 2.3.2 to cross-compile
> > (targeting arm-linux), and I installed it on a target SA1110-based
> > system. Test binaries I have created seem to run. That is, until they
> > issue the "connect" system call, at which point everything
> > segfaults. The following test program, for example, crashes reliably:
>
> Yes. I recommend reading the archives of this list; you'll find
> another patch I posted to fix this problem. It was about a month ago
> now.
>
I managed to cross-build, what appears to be, a working glibc-2.3.2
targeting arm-linux. Here are---all in all---the patches I applied,
starting from the distributed 2.3.2 sources:
PATCH 0: Semicolon at the end of "ENTRY"
diff -urN glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h glibc-2.3.2-sysdep_cancel/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
--- glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h Sun Jan 12 11:13:57 2003
+++ glibc-2.3.2-sysdep_cancel/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h Wed May 14 14:16:49 2003
@@ -34,7 +34,7 @@
# define PSEUDO(name, syscall_name, args) \
.section ".text"; \
PSEUDO_PROLOGUE; \
- ENTRY (name) \
+ ENTRY (name); \
SINGLE_THREAD_P_INT; \
bne .Lpseudo_cancel; \
DO_CALL (syscall_name, args); \
PATCH 1: Replace "lr" with "reg"
diff -urN glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h glibc-2.3.2-sysdep-cancel-lr/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
--- glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h Sun Jan 12 11:13:57 2003
+++ glibc-2.3.2-sysdep-cancel-lr/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h Mon May 19 14:17:49 2003
@@ -110,7 +110,7 @@
ldr reg, 2b; \
3: \
add ip, pc, ip; \
- ldr ip, [ip, lr]; \
+ ldr ip, [ip, reg]; \
teq ip, #0;
# define SINGLE_THREAD_P_INT \
str lr, [sp, $-4]!; \
PATCH 2: Reworked doargs
diff -urN glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h glibc-2.3.2-sysdep-cancel-doargs/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
--- glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h Mon May 19 14:23:32 2003
+++ glibc-2.3.2-sysdep-cancel-doargs/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h Mon May 19 14:24:55 2003
@@ -24,6 +24,15 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread
+/* We push lr onto the stack, so we have to use ldmib instead of ldmia
+ to find the saved arguments. */
+#undef DOARGS_5
+#undef DOARGS_6
+#undef DOARGS_7
+#define DOARGS_5 str r4, [sp, $-4]!; ldr r4, [sp, $8];
+#define DOARGS_6 mov ip, sp; stmfd sp!, {r4, r5}; ldmib ip, {r4, r5};
+#define DOARGS_7 mov ip, sp; stmfd sp!, {r4, r5, r6}; ldmib ip, {r4, r5, r6};
+
# undef PSEUDO_RET
# define PSEUDO_RET \
ldrcc pc, [sp], $4; \
Finally, I had to remove the "*** BUG in glibc/" line from "libc.so"
and "libpthreads.so", after building the library.
I used:
GCC-3.2.3 (cross configuration hosted on i386, targeting arm-linux)
BINUTILS-2.13.2 (cross config hosted on i386, targeting arm-linux)
Kernel headers from 2.4.18-rmk7
My only problem is that modules (even trivial ones) compiled with
GCC-3.2.3 fail to work when inserted in a 2.4.18-rmk7 kernel (kernel
is compiled using 2.95.3). I know that this is a compiler issue and
has nothing to do with "glibc", but do you happen to know if this
behavior is expected?
/npat
P.S. As far as I've searched the mailing-lists there seem to be no
other relevant patches (i.e. patches required to cross-compile a
stable glibc-2.3.2 targeting ARM). If you know differently, please
drop a line.
--
We shall not cease from exploration, and the end of all our exploring
will be to arrive where we started and know the place for the first
time.
-- T.S. Elliot