* elf.c (_bfd_elf_assign_file_position_for_section): Always
align to the section's alignment. "align" argument removed; all callers changed. Loosely based on a patch from dupuy@smarts.com; keeps dbx from losing when debugging programs that have been objcopy'd.
This commit is contained in:
parent
42ac8fa83d
commit
8cd2f4fe43
49
bfd/elf.c
49
bfd/elf.c
|
@ -685,16 +685,9 @@ bfd_section_from_shdr (abfd, shindex)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHT_NOTE:
|
case SHT_NOTE:
|
||||||
#if 0
|
|
||||||
fprintf (stderr, "Note Sections not yet supported.\n");
|
|
||||||
BFD_FAIL ();
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHT_SHLIB:
|
case SHT_SHLIB:
|
||||||
#if 0
|
|
||||||
fprintf (stderr, "SHLIB Sections not supported (and non conforming.)\n");
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1427,23 +1420,21 @@ align_file_position (off, align)
|
||||||
return (off + align - 1) & ~(align - 1);
|
return (off + align - 1) & ~(align - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assign a file position to a section, optionally aligning to the
|
/* Assign a file position to a section, aligning to the required
|
||||||
required section alignment. */
|
section alignment. */
|
||||||
|
|
||||||
INLINE file_ptr
|
INLINE file_ptr
|
||||||
_bfd_elf_assign_file_position_for_section (i_shdrp, offset, align)
|
_bfd_elf_assign_file_position_for_section (i_shdrp, offset)
|
||||||
Elf_Internal_Shdr *i_shdrp;
|
Elf_Internal_Shdr *i_shdrp;
|
||||||
file_ptr offset;
|
file_ptr offset;
|
||||||
boolean align;
|
|
||||||
{
|
{
|
||||||
if (align)
|
unsigned int al;
|
||||||
{
|
|
||||||
unsigned int al;
|
/* Align the offst. */
|
||||||
|
al = i_shdrp->sh_addralign;
|
||||||
|
if (al > 1)
|
||||||
|
offset = BFD_ALIGN (offset, al);
|
||||||
|
|
||||||
al = i_shdrp->sh_addralign;
|
|
||||||
if (al > 1)
|
|
||||||
offset = BFD_ALIGN (offset, al);
|
|
||||||
}
|
|
||||||
i_shdrp->sh_offset = offset;
|
i_shdrp->sh_offset = offset;
|
||||||
if (i_shdrp->bfd_section != NULL)
|
if (i_shdrp->bfd_section != NULL)
|
||||||
i_shdrp->bfd_section->filepos = offset;
|
i_shdrp->bfd_section->filepos = offset;
|
||||||
|
@ -1892,7 +1883,7 @@ assign_file_positions_except_relocs (abfd, dosyms)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
|
off = _bfd_elf_assign_file_position_for_section (hdr, off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1962,8 +1953,7 @@ assign_file_positions_except_relocs (abfd, dosyms)
|
||||||
hdr->sh_offset = -1;
|
hdr->sh_offset = -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
off = _bfd_elf_assign_file_position_for_section (hdr, off,
|
off = _bfd_elf_assign_file_position_for_section (hdr, off);
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1974,8 +1964,7 @@ assign_file_positions_except_relocs (abfd, dosyms)
|
||||||
the page size. This is required by the program
|
the page size. This is required by the program
|
||||||
header. */
|
header. */
|
||||||
off += (hdr->sh_addr - off) % maxpagesize;
|
off += (hdr->sh_addr - off) % maxpagesize;
|
||||||
off = _bfd_elf_assign_file_position_for_section (hdr, off,
|
off = _bfd_elf_assign_file_position_for_section (hdr, off);
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2191,7 +2180,7 @@ _bfd_elf_assign_file_positions_for_relocs (abfd)
|
||||||
shdrp = *shdrpp;
|
shdrp = *shdrpp;
|
||||||
if ((shdrp->sh_type == SHT_REL || shdrp->sh_type == SHT_RELA)
|
if ((shdrp->sh_type == SHT_REL || shdrp->sh_type == SHT_RELA)
|
||||||
&& shdrp->sh_offset == -1)
|
&& shdrp->sh_offset == -1)
|
||||||
off = _bfd_elf_assign_file_position_for_section (shdrp, off, true);
|
off = _bfd_elf_assign_file_position_for_section (shdrp, off);
|
||||||
}
|
}
|
||||||
|
|
||||||
elf_tdata (abfd)->next_file_pos = off;
|
elf_tdata (abfd)->next_file_pos = off;
|
||||||
|
@ -2632,9 +2621,7 @@ _bfd_elf_get_lineno (ignore_abfd, symbol)
|
||||||
bfd *ignore_abfd;
|
bfd *ignore_abfd;
|
||||||
asymbol *symbol;
|
asymbol *symbol;
|
||||||
{
|
{
|
||||||
fprintf (stderr, "elf_get_lineno unimplemented\n");
|
abort ();
|
||||||
fflush (stderr);
|
|
||||||
BFD_FAIL ();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2761,9 +2748,7 @@ _bfd_elf_no_info_to_howto (abfd, cache_ptr, dst)
|
||||||
arelent *cache_ptr;
|
arelent *cache_ptr;
|
||||||
Elf_Internal_Rela *dst;
|
Elf_Internal_Rela *dst;
|
||||||
{
|
{
|
||||||
fprintf (stderr, "elf RELA relocation support for target machine unimplemented\n");
|
abort ();
|
||||||
fflush (stderr);
|
|
||||||
BFD_FAIL ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -2773,8 +2758,6 @@ _bfd_elf_no_info_to_howto_rel (abfd, cache_ptr, dst)
|
||||||
arelent *cache_ptr;
|
arelent *cache_ptr;
|
||||||
Elf_Internal_Rel *dst;
|
Elf_Internal_Rel *dst;
|
||||||
{
|
{
|
||||||
fprintf (stderr, "elf REL relocation support for target machine unimplemented\n");
|
abort ();
|
||||||
fflush (stderr);
|
|
||||||
BFD_FAIL ();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue