When AIX added 64 bit support, it implemented what Apple MacOS Darwin
calls "FAT" libraries for its equivalent functionality -- both 32 bit
and 64 bit objects (or shared objects) are co-located in the same
archive.  GCC on AIX historically has followed the GCC multilib
directory hierarchy approach with separate directories and archives
for each multilib.

We now are working to support GCC on AIX in 64 bit mode.  To retain
the directory hierarchy, it is beneficial to shift (or at least
initially augment) the GCC multilib mechanism with AIX-style "FAT"
libraries.

It is beneficial for the "FAT" libraries to be created consistently
for GCC in both 32 bit mode and 64 bit mode, so this begins the
process for libgcc in the existing 32 bit build.  When all of the
libraries are converted, the multilib rules will look for 32 bit and
64 bit multilibs in the top-level library.  All target multilibs need
to be enabled at the same time, but the build can start the creation
of the "FAT" libraries without utilizing them.

The goal is to place both 32 bit and 64 bit objects and shared objects
in archives at the top-level, not multilib subdirectories.  The
multilibs are built in subdirectories, but must be combined during the
last parts of the target library build process.  Because of the way
that GCC bootstrap works, the libraries must be combined during the
multiple stages of GCC bootstrap, not solely when installed in the
final destination, so the libraries have to be correct at the end of
each target library build stage, not solely an install recipe.

For libgcc, this is accomplished by copying 64 bit objects into
top-level 32 bit library in 32 bit mode and 32 bit objects into
top-level 64 bit library in 64 bit mode.  The recipe is protected by
MULTIBUILDTOP so that it only is run at top-level after multilibs are
built.  The recipe is rather explicit, but it already has to know a
lot of details about the names and locations of objects, so I did not
see the need to insert additional macros, which only hide the purpose.
It also is a very target-specific purpose and context.

For other target libraries, I plan to attach something similar to the
all-local rule that only is valid for $(target_os) equal to AIX.
Something similar can be implemented for Darwin.

If anyone has a suggestion for a cleaner approach, please let me know.

Thanks, David

    libgcc/
        * config.host (extra_parts): Add crtcxa_64 and crtdbase_64.
        * config/rs6000/t-aix-cxa: Explicitly compile 32 bit with -maix32
        and 64 bit with -maix64.
        * config/rs6000/t-slibgcc-aix: Remove extra @multilib_dir@ level.
        Build and install AIX-style FAT libraries.

    gcc/
        * config/rs6000/aix72.h (STARTFILE_SPEC): Add 64 bit crtcxa.

Attachment: 0001-rs6000-libgcc-multilib.patch
Description: Binary data

Reply via email to