Multilib/Adding new ABIs
This article outlines the steps necessary to add a new ABI to gx86-multilib framework.
Adding a new ABI group (arch)
Once multilib support is introduced in a new architecture (or group of architectures), a new ABI group needs to be introduced. The group name serves as the USE flag prefix and needs to be the same for all arches involved in particular multilib. Preferably, it should match the most generic name for the arch group.
Examples of ABI groups are: abi_x86 (x86 and amd64), abi_ppc (ppc and ppc64), or abi_mips (mips).
The following steps need to be taken in order to add a new ABI group:
- Create a profiles/desc/abi_xxx.desc file for the new ABI.
- In the profiles/base/make.defaults file:
- Add ABI_XXX (an uppercase variant of ABI group name) into the USE_EXPAND variable.
- Add ABI_XXX into the USE_EXPAND_HIDDEN variable.
- In the profiles/base/use.mask file:
- Mask all abi_xxx_* flags.
- In profiles/arch/* for arches involved in the multilib:
- Set the default value for ABI_XXX in the make.defaults file.
- Add the native ABI entry (abi_xxx_yyy) to the use.force file.
- Unmask the native ABI (-abi_xxx_yyy) in the use.mask file.
- Set the native ABI as only ABI in IUSE_IMPLICIT in the make.defaults file.
- In profiles/arch/* for multilib profiles of the above arches:
- Add -ABI_XXX to USE_EXPAND_HIDDEN in make.defaults to make the flags visible.
- Unmask other supported ABIs (-abi_xxx_yyy) in the use.mask file.
- In eclass/multilib-build.eclass:
- Add all new ABIs to _MULTILIB_FLAGS variable.
- Add conditionals appropriate for the new ABIs to the header template in
multilib_prepare_wrappers()
function (it is important that the #error contains full ABI flag since the substitution relies on it). - Add ABI->USE flag mapping to
multilib_prepare_wrappers()
function.
Before those changes are committed, they need to be tested and a full pkgcheck scan
needs to be done in order to ensure that the new flags do not introduce dependency errors.
If there are no-multilib profiles that inherit from multilib profiles, the multilib changes need to be reversed in them.
Adding new ABIs to existing groups
If a new ABI is to be added to an existing group, the following steps need to be taken:
- Add the new ABI to the profiles/desc/abi_xxx.desc file.
- In profiles/base/use.mask
- Mask the new abi_xxx_yyy flag.
- In profiles/arch/* for multilib profiles.
- Unmask the new ABI (-abi_xxx_yyy) in the use.mask file.
- In the eclass/multilib-build.eclass:
- Add the new ABI to the _MULTILIB_FLAGS variable.
- Add conditional appropriate for the new ABI to the header template in
multilib_prepare_wrappers()
function (it is important that the #error contains full ABI flag since the substitution relies on it). - Add ABI->USE flag mapping to
multilib_prepare_wrappers()
function.
Before those changes are committed, they need to be tested and a full pkgcheck scan
needs to be done in order to ensure that the new flag does not introduce dependency errors.