(Reposting from gcc-help since I didn't get any replies there.)

I have a question about SYSROOT_SUFFIX_SPEC, MULTILIB_OSDIRNAMES, and
multilib cross compilers.  I was experimenting with a multilib cross compiler
and was using SYSROOT_SUFFIX_SPEC to specify different sysroots for different
multilibs, including big-endian and little-endian with 32 and 64 bits.

Now lets say I create two sysroots:
                sysroot/be with a bin, lib, lib64, etc. directories
                sysroot/le with the same set of directories

These would represent the sysroot of either a 64 bit big-endian or a 64 bit
little-endian linux system that could also run 32 bit executables.
I want my cross compiler to be able to generate code for either system.

So I set these macros and SPECs:
        # m32 and be are defaults
        MULTILIB_OPTIONS = m64 mel                 # In makefile fragment
        MULTILIB_DIRNAMES = 64 el                  # In makefile fragment
        MULTILIB_OSDIRNAMES = m64=../lib64         # In makefile fragment
        SYSROOT_SUFFIX_SPEC = %{mel:/el;:/eb}      # in header file

What seems to be happening is that the search for system libraries
like libc.so work fine.  It looks in sysroot/be/lib or sysroot/be/lib64
or in the equivalent little-endian directories.  I.e. it searches:

        <sysroot><sysroot-suffix>/lib              # 32 bits
        <sysroot><sysroot-suffix>/lib/../lib64     # 64 bits

But when it looks for libgcc_s.so or libstdc++.so it is searching:

        <install-dir>/<target-name>/lib            # 32 bits
        <install_dir>/<target-name>/lib/../lib64   # 64 bits

It does not take into account SYSROOT_SUFFIX_SPEC.  In fact when I
do my build with this setup the little-endian libgcc_s.so files wind
up overwriting the big-endian libgcc_s.so files so two of my
libgcc_s.so files are completely missing from the install area.

Shouldn't SYSROOT_SUFFIX_SPEC be used for the gcc shared libraries 
as well as the sysroot areas?  I.e. install and search for libgcc_s.so.1 in:

        <install-dir><target-name><sysroot-suffix>/lib          # 32 bits
        <install-dir><target-name><sysroot-suffix>/lib/../lib64 # 64 bits

Steve Ellcey
sell...@imgtec.com

Reply via email to