Hi, I'm trying to set up an uClibc chroot on my UltraSPARC. Static linking works out of the box but dynamic does not.
The first error I got was: '/lib/libc.so.0' is not an ELF executable for sparc I solved this by patching ldso/ldso/sparc/dl-sysdep.h. This is required because uClibc is compiled with -mcpu=v9 and the EM_SPARC magic is for -mcpu=v7 only. The second error I got was: Bus error which happend when the loader-code tried to assign a value to tpnt->st_dev in ldso/ldso/dl-elf.c(line 717). I "solved" this by just changing the type of st_dev to int in struct elf_resolve. With these changes, dynamic linking works again, at least with simple hello world apps, haven't tested anything more complex yet. But I don't really understand the dev_t thing. So, if someone can enlighten me, please do. :) Regards, Friedrich Oslage
Index: ldso/ldso/sparc/dl-sysdep.h
===================================================================
--- ldso/ldso/sparc/dl-sysdep.h (Revision 22074)
+++ ldso/ldso/sparc/dl-sysdep.h (Arbeitskopie)
@@ -26,8 +26,16 @@
GOT_BASE[3] = (int) MODULE; \
}
-/* Here we define the magic numbers that this dynamic loader should accept */
+/*
+ * Here we define the magic numbers that this dynamic loader should accept
+ *
+ * Note that SPARCV9 doesn't use EM_SPARCV9 since the userland is still 32-bit.
+ */
+#if defined(__sparc_v9__) || defined(__sparc_v8__)
+#define MAGIC1 EM_SPARC32PLUS
+#else
#define MAGIC1 EM_SPARC
+#endif
#undef MAGIC2
/* Used for error messages */
Index: ldso/include/dl-hash.h
===================================================================
--- ldso/include/dl-hash.h (Revision 22075)
+++ ldso/include/dl-hash.h (Arbeitskopie)
@@ -81,7 +81,7 @@
ElfW(Addr) relro_addr;
size_t relro_size;
- dev_t st_dev; /* device */
+ int st_dev; /* device */
ino_t st_ino; /* inode */
#ifdef __powerpc__
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ uClibc mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/uclibc
