mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 13:27:26 +08:00
order relocs after segments for mach-o
bfd: * mach-o.c (bfd_mach_o_write_relocs): Move compuation of relocs file position from here... to (bfd_mach_o_build_seg_command): Here.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2012-01-13 Iain Sandoe <idsandoe@googlemail.com>
|
||||||
|
|
||||||
|
* mach-o.c (bfd_mach_o_write_relocs): Move compuation of relocs file
|
||||||
|
position from here... to (bfd_mach_o_build_seg_command): Here.
|
||||||
|
|
||||||
2012-01-12 Iain Sandoe <idsandoe@googlemail.com>
|
2012-01-12 Iain Sandoe <idsandoe@googlemail.com>
|
||||||
|
|
||||||
* mach-o.c (bfd_mach_o_count_indirect_symbols): New.
|
* mach-o.c (bfd_mach_o_count_indirect_symbols): New.
|
||||||
|
27
bfd/mach-o.c
27
bfd/mach-o.c
@ -1185,7 +1185,6 @@ bfd_mach_o_canonicalize_dynamic_reloc (bfd *abfd, arelent **rels,
|
|||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
bfd_mach_o_write_relocs (bfd *abfd, bfd_mach_o_section *section)
|
bfd_mach_o_write_relocs (bfd *abfd, bfd_mach_o_section *section)
|
||||||
{
|
{
|
||||||
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
arelent **entries;
|
arelent **entries;
|
||||||
asection *sec;
|
asection *sec;
|
||||||
@ -1198,13 +1197,6 @@ bfd_mach_o_write_relocs (bfd *abfd, bfd_mach_o_section *section)
|
|||||||
if (bed->_bfd_mach_o_swap_reloc_out == NULL)
|
if (bed->_bfd_mach_o_swap_reloc_out == NULL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* Allocate relocation room. */
|
|
||||||
mdata->filelen = FILE_ALIGN(mdata->filelen, 2);
|
|
||||||
section->nreloc = sec->reloc_count;
|
|
||||||
sec->rel_filepos = mdata->filelen;
|
|
||||||
section->reloff = sec->rel_filepos;
|
|
||||||
mdata->filelen += sec->reloc_count * BFD_MACH_O_RELENT_SIZE;
|
|
||||||
|
|
||||||
if (bfd_seek (abfd, section->reloff, SEEK_SET) != 0)
|
if (bfd_seek (abfd, section->reloff, SEEK_SET) != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -2075,6 +2067,25 @@ bfd_mach_o_build_seg_command (const char *segment,
|
|||||||
}
|
}
|
||||||
|
|
||||||
seg->filesize = mdata->filelen - seg->fileoff;
|
seg->filesize = mdata->filelen - seg->fileoff;
|
||||||
|
seg->filesize = FILE_ALIGN(seg->filesize, 2);
|
||||||
|
|
||||||
|
/* Allocate relocation room. */
|
||||||
|
mdata->filelen = FILE_ALIGN(mdata->filelen, 2);
|
||||||
|
|
||||||
|
for (i = 0; i < mdata->nsects; ++i)
|
||||||
|
{
|
||||||
|
bfd_mach_o_section *ms = mdata->sections[i];
|
||||||
|
asection *sec = ms->bfdsection;
|
||||||
|
|
||||||
|
if ((ms->nreloc = sec->reloc_count) == 0)
|
||||||
|
{
|
||||||
|
ms->reloff = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
sec->rel_filepos = mdata->filelen;
|
||||||
|
ms->reloff = sec->rel_filepos;
|
||||||
|
mdata->filelen += sec->reloc_count * BFD_MACH_O_RELENT_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user