summaryrefslogtreecommitdiff
path: root/bfd/elf-eh-frame.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2006-08-22 15:08:47 +0000
committerJoseph Myers <jsm@polyomino.org.uk>2006-08-22 15:08:47 +0000
commit150ddb4e15daf7b71cc7f30cbad13dfff6cd6d76 (patch)
tree2270c98b8ad371d2e747aa35fc18d76e2b13ae02 /bfd/elf-eh-frame.c
parentdd18ff9757a447d2ba98b72021af4533058b0d83 (diff)
downloadgdb-150ddb4e15daf7b71cc7f30cbad13dfff6cd6d76.tar.gz
Merge changes between binutils-csl-2_17-branchpoint and
binutils-2_17, except for the addition of generated files to CVS.
Diffstat (limited to 'bfd/elf-eh-frame.c')
-rw-r--r--bfd/elf-eh-frame.c51
1 files changed, 12 insertions, 39 deletions
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index ab0b995c0c2..5100e72938d 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -1076,12 +1076,12 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
end = buf + ent->size;
new_size = size_of_output_cie_fde (ent, ptr_size);
- /* Install the new size, filling the extra bytes with DW_CFA_nops. */
+ /* Update the size. It may be shrinked. */
+ bfd_put_32 (abfd, new_size - 4, buf);
+
+ /* Filling the extra bytes with DW_CFA_nops. */
if (new_size != ent->size)
- {
- memset (end, 0, new_size - ent->size);
- bfd_put_32 (abfd, new_size - 4, buf);
- }
+ memset (end, 0, new_size - ent->size);
if (ent->cie)
{
@@ -1263,40 +1263,13 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
}
}
- {
- unsigned int alignment = 1 << sec->alignment_power;
- unsigned int pad = sec->size % alignment;
-
- /* Don't pad beyond the raw size of the output section. It
- can happen at the last input section. */
- if (pad
- && ((sec->output_offset + sec->size + pad)
- <= sec->output_section->size))
- {
- bfd_byte *buf;
- unsigned int new_size;
-
- /* Find the last CIE/FDE. */
- ent = sec_info->entry + sec_info->count;
- while (--ent != sec_info->entry)
- if (!ent->removed)
- break;
-
- /* The size of the last CIE/FDE must be at least 4. */
- if (ent->removed || ent->size < 4)
- abort ();
-
- pad = alignment - pad;
- buf = contents + ent->new_offset - sec->output_offset;
- new_size = size_of_output_cie_fde (ent, ptr_size);
-
- /* Pad it with DW_CFA_nop */
- memset (buf + new_size, 0, pad);
- bfd_put_32 (abfd, new_size + pad - 4, buf);
-
- sec->size += pad;
- }
- }
+ /* We don't align the section to its section alignment since the
+ runtime library only expects all CIE/FDE records aligned at
+ the pointer size. _bfd_elf_discard_section_eh_frame should
+ have padded CIE/FDE records to multiple of pointer size with
+ size_of_output_cie_fde. */
+ if ((sec->size % ptr_size) != 0)
+ abort ();
return bfd_set_section_contents (abfd, sec->output_section,
contents, (file_ptr) sec->output_offset,