[PATCH 2/2] coff-go32: support extended relocations
J.W. Jagersma
jwjagersma@gmail.com
Wed Apr 8 15:33:16 GMT 2020
On 2020-04-08 17:21, J.W. Jagersma wrote:
> This patch extends the relocation and line number counters for
> coff-go32 and coff-go32-exe to 32 bits. As I understand it works the
> same as for PE-COFF:
>
> If the number of relocations in an object file exceeds 65534, the
> NRELOC field is set to 65535 and the actual number of relocations is
> stored in the VADDR field of the first relocation entry.
>
> Executable files have no relocations, and thus the NRELOC field is
> repurposed to extend NLNNO to 32-bits.
>
> bfd/
> 2020-04-08 Juan Manuel Guerrero <juan.guerrero@gmx.de>
> Jan W. Jagersma <jwjagersma@gmail.com>
>
> * coff-go32.c (COFF_GO32, IMAGE_SCN_LNK_NRELOC_OVFL)
> (coff_swap_scnhdr_in, coff_swap_scnhdr_out): Define.
> (_bfd_go32_swap_scnhdr_in, _bfd_go32_swap_scnhdr_out)
> (_bfd_go32_mkobject): New functions.
> * coff-stgo32.c (IMAGE_SCN_LNK_NRELOC_OVFL)
> (coff_swap_scnhdr_in, coff_swap_scnhdr_out): Define.
> (go32exe_mkobject): Call _bfd_go32_mkobject.
> * coffcode.h (COFF_WITH_EXTENDED_RELOC_COUNTER): Define.
> (coff_set_alignment_hook): Define function for COFF_GO32_EXE
> and COFF_GO32.
> (coff_write_relocs): Enable extended reloc counter code if
> COFF_WITH_EXTENDED_RELOC_COUNTER is defined. Test for obj_go32.
> (coff_write_object_contents): Likewise. Pad section headers
> for COFF_GO32 and COFF_GO32EXE.
> cofflink.c (_bfd_coff_final_link): Test for obj_go32.
> coffswap.h: (coff_swap_scnhdr_in, coff_swap_scnhdr_in): Allow
> overriding these functions with macros of the same name.
> libcoff-in.h: (struct coff_tdata): New field go32.
> (obj_go32): Define.
> ---
I'm sorry, I did not thoroughly proofread the changelog before sending.
Please use the following:
* coff-go32.c (COFF_GO32, IMAGE_SCN_LNK_NRELOC_OVFL)
(coff_swap_scnhdr_in, coff_swap_scnhdr_out): Define.
(_bfd_go32_swap_scnhdr_in, _bfd_go32_swap_scnhdr_out)
(_bfd_go32_mkobject): New functions.
* coff-stgo32.c (IMAGE_SCN_LNK_NRELOC_OVFL)
(coff_swap_scnhdr_in, coff_swap_scnhdr_out): Define.
(go32exe_mkobject): Call _bfd_go32_mkobject.
* coffcode.h (COFF_WITH_EXTENDED_RELOC_COUNTER): Define.
(coff_set_alignment_hook): Define function for COFF_GO32_EXE
and COFF_GO32.
(coff_write_relocs): Enable extended reloc counter code if
COFF_WITH_EXTENDED_RELOC_COUNTER is defined. Test for obj_go32.
(coff_write_object_contents): Likewise. Pad section headers
for COFF_GO32 and COFF_GO32EXE.
* cofflink.c (_bfd_coff_final_link): Test for obj_go32.
* coffswap.h: (coff_swap_scnhdr_in, coff_swap_scnhdr_in): Allow
overriding these functions with macros of the same name.
* libcoff-in.h: (struct coff_tdata): New field go32.
(obj_go32): Define.
* libcoff.h: Regenerate.
More information about the Binutils
mailing list