This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
elf32-mips.c patch from Ralf
- To: binutils@sourceware.cygnus.com
- Subject: elf32-mips.c patch from Ralf
- From: "Mark P. Mitchell" <mark@codesourcery.com>
- Date: Tue, 10 Aug 1999 00:42:06 -0600 (MDT)
- Reply-to: mark@codesourcery.com
Ralf suggested an alternate fix to the one I checked in for the case
where there are no global GOT entries. He pointed out that my fix
wsa not ABI-compliant. Here's the patch.
-- Mark
Tue Aug 10 00:34:29 1999 Mark P. Mitchell <mark@codesourcery.com>
Ralf Baechle <ralf@uni-koblenz.de>
* elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Always
output DT_MIPS_GOTSYM.
(_bfd_mips_elf_finish_dynamic_sections): Use the same value as
DT_MIPS_SYMTABNO if there are no global GOT symbols.
Index: elf32-mips.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/elf32-mips.c,v
retrieving revision 1.47
diff -c -p -r1.47 elf32-mips.c
*** elf32-mips.c 1999/08/10 06:27:47 1.47
--- elf32-mips.c 1999/08/10 06:41:41
*************** _bfd_mips_elf_check_relocs (abfd, info,
*** 7557,7563 ****
/* Even though we don't directly need a GOT entry for
this symbol, a symbol must have a dynamic symbol
! table index greater that DT_GOTSYM if there are
dynamic relocations against it. */
if (h != NULL
&& !mips_elf_record_global_got_symbol (h, info, g))
--- 7557,7563 ----
/* Even though we don't directly need a GOT entry for
this symbol, a symbol must have a dynamic symbol
! table index greater that DT_MIPS_GOTSYM if there are
dynamic relocations against it. */
if (h != NULL
&& !mips_elf_record_global_got_symbol (h, info, g))
*************** _bfd_mips_elf_size_dynamic_sections (out
*** 8163,8170 ****
if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0))
return false;
! if (g != NULL && g->global_gotsym != NULL
! && ! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0))
return false;
if (IRIX_COMPAT (dynobj) == ict_irix5
--- 8163,8169 ----
if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0))
return false;
! if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0))
return false;
if (IRIX_COMPAT (dynobj) == ict_irix5
*************** _bfd_mips_elf_finish_dynamic_sections (o
*** 8559,8564 ****
--- 8558,8580 ----
dyn.d_un.d_val = g->local_gotno;
break;
+ case DT_MIPS_UNREFEXTNO:
+ /* The index into the dynamic symbol table which is the
+ entry of the first external symbol that is not
+ referenced within the same object. */
+ dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1;
+ break;
+
+ case DT_MIPS_GOTSYM:
+ if (g->global_gotsym)
+ {
+ dyn.d_un.d_val = g->global_gotsym->dynindx;
+ break;
+ }
+ /* In case if we don't have global got symbols we default
+ to setting DT_MIPS_GOTSYM to the same value as
+ DT_MIPS_SYMTABNO, so we just fall through. */
+
case DT_MIPS_SYMTABNO:
name = ".dynsym";
elemsize = MIPS_ELF_SYM_SIZE (output_bfd);
*************** _bfd_mips_elf_finish_dynamic_sections (o
*** 8569,8585 ****
dyn.d_un.d_val = s->_cooked_size / elemsize;
else
dyn.d_un.d_val = s->_raw_size / elemsize;
- break;
-
- case DT_MIPS_UNREFEXTNO:
- /* The index into the dynamic symbol table which is the
- entry of the first external symbol that is not
- referenced within the same object. */
- dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1;
- break;
-
- case DT_MIPS_GOTSYM:
- dyn.d_un.d_val = g->global_gotsym->dynindx;
break;
case DT_MIPS_HIPAGENO:
--- 8585,8590 ----