[PATCH 5/6] aix: implement R_TOCU and R_TOCL relocations

CHIGOT, CLEMENT clement.chigot@atos.net
Tue Feb 16 09:58:55 GMT 2021


Implement support for largetoc on XCOFF.
R_TOCU and R_TOCL are referenced by the new BFD defines:
BFD_RELOC_PPC_TOC16_HI and BFD_RELOC_PPC_TOC16_LO.
A new toc storage class is added XMC_TE.

In gas, add a function to transform addis format used by AIX
"addis RT, D(RA)" into the ELF format "addis RT, RA, SI".

bfd/ChangeLog:
2020-11-20  Clément Chigot  <clement.chigot@atos.net>

        * bfd-in2.h (BFD_RELOC_PPC_TOC16_HI, BFD_RELOC_PPC_TOC16_LO):
        New defines
        * coff-rs6000.c (xcoff_calculate_relocation): Call
        xcoff_reloc_type_¨toc for R_TOCU and R_TOCL.
        (xcoff_howto_table): Add R_TOCU and R_TOCL howtos.
        (_bfd_xcoff_reloc_type_lookup): Add cases for
        BFD_RELOC_PPC_TOC16_{HI, LO}.
        (xcoff_reloc_type_toc): Implement R_TOCU and R_TOCL.
        * coff64-rs6000.c (xcoff64_calculate_relocation): Call
        xcoff_reloc_type_toc for R_TOCU and R_TOCL.
        (xcoff64_howto_table): Add R_TOCU and R_TOCL howtos.
        (xcoff64_reloc_type_lookup): Add cases for
        BFD_RELOC_PPC_TOC16_{HI, LO}.
        (xcoff64_reloc_type_toc): Implement R_TOCU and R_TOCL.
        * libbfd.h (bfd_reloc_code_real_names): Add
        BFD_RELOC_PPC_TOC16_{HI, LO}.

gas/ChangeLog:
2020-11-20  Clément Chigot  <clement.chigot@atos.net>

        * config/tc-ppc.c (ppc_xcoff_suffix): New function.
        (MAP, MAP32, MAP64): New macros for XCOFF.
        (ppc_xcoff_fixup_addis): New function.
        (ppc_is_toc_sym): Handle XMC_TE.
        (fixup_size): Add cases for BFD_RELOC_PPC_TOC16_{HI,LO}.
        (md_assemble): Call ppc_xcoff_fixup_addis for XCOFF.
        (ppc_change_csect): Handle XMC_TE.
        (ppc_tc): Enable .tc symbols to have only a XMC_TC or XMC_TE
        storage class.
        (ppc_symbol_new_hook): Handle XMC_TE.
        (ppc_frob_symbol): Likewise.
        (ppc_fix_adjustable): Likewise.
        (md_apply_fix): Handle BFD_RELOC_PPC_TOC16_{HI,LO}.

ld/ChangeLog:
2020-11-20  Clément Chigot  <clement.chigot@atos.net>

        * scripttempl/aix.sc: Add .te to .data section.
        * testsuite/ld-powerpc/aix52.exp: Add test structure for AIX7+.
        Add aix-largetoc-1 test.
        * testsuite/ld-powerpc/aix-largetoc-1-32.d: New test.
        * testsuite/ld-powerpc/aix-largetoc-1-64.d: New test.
        * testsuite/ld-powerpc/aix-largetoc-1.ex: New test.
        * testsuite/ld-powerpc/aix-largetoc-1.s: New test.



Clément Chigot


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-aix-implement-R_TOCU-and-R_TOCL-relocations.patch
Type: application/octet-stream
Size: 21030 bytes
Desc: 0005-aix-implement-R_TOCU-and-R_TOCL-relocations.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20210216/db7cf4a1/attachment-0001.obj>


More information about the Binutils mailing list