From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Mitchell To: binutils@sourceware.cygnus.com Subject: Patches for IRIX6 N32-ABI ld Date: Thu, 01 Jul 1999 00:00:00 -0000 Message-id: <19990626110155A.mitchell@codesourcery.com> X-SW-Source: 1999-q2/msg00354.html I'm going to begin submitting the patches required to support the N32 ABI on IRIX6. Although these have been tested heavily on IRIX6 (a complete EGCS build and regression test-run), they have not been tested no any other MIPS platform. Therefore, it is possible (likely?) that I have broken something elsewhere. I hope that people will test these patches, and report problems; I will, of course, attempt to fix them as quickly as possible. I'm going to try to keep the individual patches as simple as possible, and do the easiest ones first. That way, we can look at each change and make sure it makes sense, and avoid getting bogged down. This first one is very simple. OK to check in? -- Mark Mitchell mark@codesourcery.com CodeSourcery, LLC http://www.codesourcery.com 1999-06-26 Mark Mitchell * elf32-mips.c (sgi_compat_t): New enumeration. (ABI_N32_P): New macro. (SGI_COMPAT): Return what kind of compatibility is being provided. (mips_elf_relocate_section): Fix typo. Index: elf32-mips.c =================================================================== RCS file: /cvs/binutils/binutils/bfd/elf32-mips.c,v retrieving revision 1.5 diff -u -p -r1.5 elf32-mips.c --- elf32-mips.c 1999/06/12 13:08:29 1.5 +++ elf32-mips.c 1999/06/26 17:53:13 @@ -125,12 +125,26 @@ static bfd_byte *elf32_mips_get_relocate PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, boolean, asymbol **)); -/* This is true for Irix 5 executables, false for normal MIPS ELF ABI - executables. FIXME: At the moment, we default to always generating - Irix 5 executables. */ +/* The kind of SGI compatibility we're striving for. */ -#define SGI_COMPAT(abfd) (1) +typedef enum { + sct_none, + sct_irix5, + sct_irix6 +} sgi_compat_t; +/* Nonzero if ABFD is using the N32 ABI. */ + +#define ABI_N32_P(abfd) \ + ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) + +/* What version of Irix we are trying to be compatible with. FIXME: + At the moment, we never generate "normal" MIPS ELF ABI executables; + we always use some version of Irix. */ + +#define SGI_COMPAT(abfd) \ + (ABI_N32_P (abfd) ? sct_irix6 : sct_irix5) + /* This structure is used to hold .got information when linking. It is stored in the tdata field of the bfd_elf_section_data structure. */ @@ -5638,7 +5652,7 @@ mips_elf_relocate_section (output_bfd, i && (r == bfd_reloc_undefined || r == bfd_reloc_overflow)) r = bfd_reloc_ok; - if (SGI_COMPAT (abfd) + if (SGI_COMPAT (output_bfd) && scpt != NULL && (input_section->flags & SEC_ALLOC) != 0) {