summaryrefslogtreecommitdiff
path: root/bfd/libcoff.h
diff options
context:
space:
mode:
authorJuan Manuel Guerrero <juan.guerrero@gmx.de>2020-04-14 17:30:01 +0100
committerNick Clifton <nickc@redhat.com>2020-04-14 17:30:01 +0100
commitf717994fe84df26ec4e4fe4104e018ece8b5b9cf (patch)
treef0ce03676b17fac838ae086565b69b6be3f36b55 /bfd/libcoff.h
parent06ca5dd49ac45e814ca167f441ac0b191b50bb37 (diff)
downloadbinutils-gdb-f717994fe84df26ec4e4fe4104e018ece8b5b9cf.tar.gz
[PATCH v2 2/2] coff-go32: support extended relocations
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 * 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. Use bfd_coff_swap_scnhdr_out instead of coff_swap_scnhdr_out. * cofflink.c (_bfd_coff_final_link): Test also for obj_go32 to enable extended reloc counter. * coffswap.h: (coff_swap_scnhdr_in, coff_swap_scnhdr_out): Declare with ATTRIBUTE_UNUSED. * libcoff-in.h: (struct coff_tdata): New field go32. (obj_go32): Define. * libcoff.h: Regenerate.
Diffstat (limited to 'bfd/libcoff.h')
-rw-r--r--bfd/libcoff.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 44c85d96c15..d7e0548bc50 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -37,8 +37,9 @@ extern "C" {
#define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
#define obj_pe(bfd) (coff_data (bfd)->pe)
+#define obj_go32(bfd) (coff_data (bfd)->go32)
#define obj_symbols(bfd) (coff_data (bfd)->symbols)
-#define obj_sym_filepos(bfd) (coff_data (bfd)->sym_filepos)
+#define obj_sym_filepos(bfd) (coff_data (bfd)->sym_filepos)
#define obj_relocbase(bfd) (coff_data (bfd)->relocbase)
#define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments)
#define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count)
@@ -118,6 +119,9 @@ typedef struct coff_tdata
used by ARM code. */
flagword flags;
+ /* Is this a GO32 coff file? */
+ bfd_boolean go32;
+
/* A stub (extra data prepended before the COFF image) and its size.
Used by coff-go32-exe, it contains executable data that loads the
COFF object into memory. */