[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Creating sparc64 installation images



    Btw, have all the changes mentioned in [1] been upstreamed? I'm
    especially very interested in the changes made to gcc to enable
    multiarch support because we are still having issues with that
    in Debian which is why it's disabled in the Debian gcc packages
    for sparc64 [2], line 18.

There is nothing to upstream regarding the toolchain multiarch support
in GCC.  We have 4.4.7, 4.9.1 and svn (GCC 6) built with multilib.

Of course that assumes you already bootstraped, which is a fun activity.
If your starting point is a 64-bit glibc and a GCC with no multilib
support, you will have to do something similar to what we did:

We started with a 64-bit glibc and a GCC built with --disable-multilib,
i.e. no support for building nor running 32-bit binaries at all.  Our
goal was to have:
- A 32bit glibc (runtime + devel).
- A 64bit glibc (runtime + devel)
- A multilib 64bit GCC.
- A multilib 64bit binutils.

So, the first step was to get the installed pure 64-bit GCC able to
build 32-bit binaries.  I cherry-picked the following stuff from an old
Fedora 12 repository with sparcv9 (32-bit) packages (the Debian packages
are surely different, but you get it):

>From glibc-2.11.1-5 (fc12):

/lib/ld-linux.so.2  -> /lib/ld-linux.so.2
/lib/libc-2.11.1.so -> /lib/libc-2.11.1.so
/lib/libc.so.6      -> /lib/libc.so.6 (link to above)

>From glibc-devel-2.11.1-5 (fc12):

/usr/lib/crt1.o -> /usr/lib/crt1.o
/usr/lib/crti.o -> /usr/lib/crti.o
/usr/lib/crtn.o 
/usr/lib/libc_nonshared.a -> /usr/lib/libc_nonshared.a
/usr/lib/libc.so -> /usr/lib/libc.so
/usr/lib/libphtread.so -> /usr/lib/libpthread.so
/usr/lib/libpthread_nonshared.a -> /usr/lib/libpthread_nonshared.a
/usr/include/gnu/stubs-32.h -> /usr/include/gnu/stubs-32.h

>From libgcc-4.4.3-3 (fc12):

/usr/lib/libgcc_s-4.4.3-20100121.so.1 -> /usr/lib/libgcc_s-4.4.3-20100121.so.1
/usr/lib/libgcc_s.so.1                -> /usr/lib/libgcc_s.so.1

>From gcc-4.4.3-3 (fc12):

Before getting the 32-bit GCC libraries, we had to create a new
directory 32/, and modified the specs file of the installed GCC to look
for them in that directory:

*multilib:
. !m64 !m32;.:../lib64 m64 !m32;32:../lib !m64 m32;

Then we populated the directory with the Fedora 12 GCC 32-bit libraries:

/usr/lib/gcc/sparc64-redhat-linux/4.4.3/libgcc.a   -> /usr/lib/gcc/sparc64-redhat-linux/4.4.7/32/libgcc.a
/usr/lib/gcc/sparc64-redhat-linux/4.4.3/crtbegin.o -> /usr/lib/gcc/sparc64-redhat-linux/4.4.7/32/crtbegin.o
/usr/lib/gcc/sparc64-redhat-linux/4.4.3/crtend.o -> /usr/lib/gcc/sparc64-redhat-linux/4.4.7/32/crtend.o
/usr/lib/gcc/sparc64-redhat-linux/4.4.3/crtbeginT.o -> /usr/lib/gcc/sparc64-redhat-linux/4.4.7/32/crtbeginT.o
/usr/lib/gcc/sparc64-redhat-linux/4.4.3/crtendS.o -> /usr/lib/gcc/sparc64-redhat-linux/4.4.7/32/crtendS.o
/usr/lib/gcc/sparc64-redhat-linux/4.4.3/crtbeginS.o -> /usr/lib/gcc/sparc64-redhat-linux/4.4.7/32/crtbeginS.o
/usr/lib/gcc/sparc64-redhat-linux/4.4.3/crtfastmath.o -> /usr/lib/gcc/sparc64-redhat-linux/4.4.7/32/crtfastmath.o

And voila. At this point gcc -m32 worked.

Now that we had a system capable of building 32-bit sparc binaries it
was time to build sparcv9 glibc packages.  For that purpos we had to do
some extensive hacking in the glibc.spec file in order to convert
sparcv9 into a proper auxiliary architecture to sparc64 (note that the
RedHat sparc distro was 32bit with support for 64bit, while L4S is 64bit
with support for 32bit).  This is mostly irrelevant to you, as you use
different packaging/multilib logic in Debian.

Once we had sparcv9 (32bit) glibc packages built with the installed
mutant compiler, we could build the bootstrapped GCC with enabled
multilib.

Let me know if you need help for the bootstrapping, and I will try to
help.


Reply to: