RTLD and ld

Status - 02/11/09

There have been updates to cmd/sgs to make life easier. We have added a Makefile.cross that will build just ld.

Status - 11/02/07

We have a building rtld or ld.so.1 and are in the process debugging it. You will need to do a make -k install in cmd/sgs to get this going after building your shared libs. We have to do the -k because the install will fail since we have not gotten round to dealing with the lint issue. 

We have been using the cross developemnt solaris ld for quite a while now. A pre-built bin is supplied in the update to the original tools packages which are at Project Tools should work without issues. 

So to recap, if you don't need or want to build the cross dev ld then just make -k install in cmd/sgs. 

Cross Development Solaris ld Build Notes

Since we are using a Solaris hosted x86 kernel build environment we had to create a linker that runs on x86 but would link powerpc based code. All the credit goes to Brian Horn for this magic. Not only did he get this going but he suggested improvements that the linker folks took to heart and worked into onnv.

So you'd like to build the ppc-dev cross development ld... please try it and let us know how it goes.

Ok, this is what one needs to do.

First, do the usual.  (i.e. cd polaris/trunk; bldenv -d polaris.sh)

Make sure that all header files have been installed in your proto root.
(i.e. make install_h from usr/src)

Now set the following environment variables:

    {{code}} 
    CC=/opt/SUNWspro/bin/cc
    LD=/usr/ccs/bin/ld
    AS=/usr/ccs/bin/as
    USE_PROTO={{/code}}

The first three are to force the use of the i386 compiler, loader and assembler.  The last tells the make NOT to use the ld built in the proto root.  All of those environment variables are for create a CROSS building ld (and related parts). If you were on a PowerPC Solaris platform, none of that would be necessary.

Now go to usr/src/cmd/sgs.

make -k install

(most things will build, but not all.  Everything needed for ld will build.  A working ld will be found in your proto root under usr/ccs/bin/ld. 

Development Related Notes

Mostly work on Solaris ld.  This works fine for building the kernel.  A lot of the stuff for building user applications has been done, but is now just starting the testing process.  There are likely still problems, but it is unknown.  All the libraries needed for the cross
build of ld are present and working.  Most of usr/src/cmd/sgs builds and probably works fine, but that is PowerPC application code.  Found (and "fixed") a bug in the GNU assembler code where it was generating misaligned relocations, but only in DWARF debug sections.  This never made it back to the "official" GNU code base.  Volunteers? 

Leveraged a bit of 2.6 code but mostly just started over from Nevada.  The libraries required for ld are libelf.so.1, libld.so.4 and liblddbg.so.4.

The biggest problems here were that the Solaris ld and related libraries haven't been built cross platform for many, many years.  There were (are) assumptions that the size and endianness of various fields in an elf image are the same for the host as the target. Of course we know different.

No work was done for thread local storage or 64-bit relocations at this time.

last modified by admin on 2009/10/26 12:17
Collectives
Project


© Sun Microsystems Inc. 2009
XWiki Enterprise 1.8.2.19075 - Documentation
Terms Of Use | Privacy | Trademarks | Copyright Policy | Site Guidelines | Site map | Help
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Use.