Using ldso on sparc

Carmelo AMOROSO carmelo.amoroso at st.com
Wed May 28 11:58:02 UTC 2008


Friedrich Oslage wrote:
> 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.
>   
Hi,
I'm not sparc expert, but I think that this change is fine, according to 
what you have explained.
So I've just applied it.
Thanks
> 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.
>
>
>   
I've looked at this too...
dev_t is defined in sys/types.h

typedef __dev_t dev_t;

__dev_t is defined in libc/sysdeps/linux/common/bits/types.h as
__STD_TYPE __DEV_T_TYPE __dev_t;    /* Type of device numbers.  */

in turn __DEV_T_TYPE is defined for sparc in 
libc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h as:

#define __DEV_T_TYPE        __UQUAD_TYPE
that is a 64bits.... I don't know if this is ok for sparc 9 or not.

So this part of patch, being an impact on another archs, has been not 
applied.
Please, try to figure out a better solution.

Regards,
Carmelo



> 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
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc




More information about the uClibc mailing list