(_bfd_elf_eh_frame_address_size): Declare.
* elfxx-target.h (elf_backend_eh_frame_address_size): Define a default.
(elfNN_bed): Initialize elf_backend_eh_frame_address_size.
* elfxx-mips.h (_bfd_mips_elf_eh_frame_address_size): Declare.
(elf_backend_eh_frame_address_size): Define.
* elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): New function.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Get the address
size from the new backend hook.
(_bfd_elf_write_section_eh_frame): Likewise.
(_bfd_elf_eh_frame_address_size): New function.
(_bfd_elf_discard_section_eh_frame): Use them to interpret the CFA
instructions. If the amount of padding is known, reduce the size
of the CIE or FDE by that amount.
augmentation_size. Use bfd_signed_vmas for data_align.
* elf-eh-frame.c (read_uleb128, read_sleb128): Delete in favor of...
(read_byte, skip_leb128, read_uleb128, read_sleb128): ...these new
functions. Don't read past the end of the enclosing CIE or FDE.
(skip_bytes): New utility function.
(_bfd_elf_discard_section_eh_frame): Use new functions, adding more
sanity checking.
(_bfd_elf_write_section_eh_frame): Use new functions.
* dwarf2.c (dwarf2_debug): Move info_ptr_unit to ...
(comp_unit): Here.
(read_unsigned_leb128): Removed.
(read_signed_leb128): Removed.
(find_abstract_instance_name): Updated.
(parse_comp_unit): Accept info_ptr_unit.
(_bfd_dwarf2_find_nearest_line): Set info_ptr_unit for each
comp unit and pass it to parse_comp_unit.
* elf-eh-frame.c (read_unsigned_leb128): Moved to ...
(read_signed_leb128): Moved to ...
* libbfd.c: Here.
* libbfd-in.h (read_unsigned_leb128): New prototype.
(read_signed_leb128): Likewise.
* libbfd.h: Regenerated.
add_fde_encoding. Remove need_relative.
* elf-eh-frame.c (extra_augmentation_string_bytes)
(extra_augmentation_data_bytes, size_of_output_cie_fde): New functions.
(_bfd_elf_discard_section_eh_frame): Consider changing the FDE encoding
in cases where the CIE has no existing 'R' augmentation. Use
size_of_output_cie_fde when assigning offsets. Use the final offset
as the new section size.
(_bfd_elf_eh_frame_section_offset): Remove need_relative handling.
Account for any extra augmentation bytes in the returned offset.
(_bfd_elf_write_section_eh_frame): Rework so that the entries are
moved before being modified. Pad growing entries with DW_CFA_nops.
Add 'z' and 'R' augmentations as directed by add_augmentation_size
and add_fde_encoding.
parameter. If called after _bfd_elf_write_section_eh_frame,
don't allow a -2 return unless need_* bit is already set, and
handle offsets adjusted for output_offset.
* elf-bfd.h (_bfd_elf_eh_frame_section_offset): Update prototype.
* elf.c (_bfd_elf_section_offset): Update call.
(struct eh_frame_hdr_info): Add last_cie_inf, remove last_cie_offset.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete code
setting offsets for removed CIEs. Don't set "sec", instead set
cie_inf for FDEs. Keep a pointer to last struct eh_cie_fde for a
CIE in hdr_info. Only set make_relative and make_lsda_relative
for CIEs. Use pointers rather than array indices.
(_bfd_elf_eh_frame_section_offset): Test/set make_relative,
make_lsda_relative, need_* on cie_inf for FDEs.
(_bfd_elf_write_section_eh_frame): Adjust offset and new_offset for
section output_offset. Delete cie_offset, instead use cie_inf
pointer to CIE entry. Use need_relative and need_lsda_relative on
CIE entry for FDEs. Use pointers rather than array indices.
need_lsda_relative.
* elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Set
need_relative or need_lsda_relative if we are processing an
offset for a reloc on a FDE initial loc or LSDA field
respectively.
(_bfd_elf_write_section_eh_frame): Test need_relative and
need_lsda_relative in place of corresponding make_* field
when deciding to use pc-relative encodings.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't
use the last CIE from a different section.
(_bfd_elf_write_section_eh_frame): Don't pad beyond the raw
size of the output section.
(read_value): Add parameter is_signed, use signed extraction if
the value is signed.
(_bfd_elf_write_section_eh_frame): Pass signed flag of the
encoding to read_value.
(_bfd_elf_discard_section_eh_frame): Don't discard duplicate CIEs
on a relocatable link. Comment typos.
* elf.c (_bfd_elf_link_hash_newfunc): Assign elements of structure
in the order they are declared. Clear elf_hash_value too.
(_bfd_elf_link_hash_table_init): Likewise assign in order. Clear
eh_info and tls_segment.
* elflink.h (elf_link_input_bfd <emit_relocs>): Keep reloc offsets
sorted when discarding relocs by turning them into R_*_NONE.
* libbfd.c (warn_deprecated): Comment spelling.
* po/SRC-POTFILES.in: Regenerate.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't mix
signed and unsigned in comparison.
Approved by: Alan Modra <amodra@bigpond.net.au>
Message-ID: <20021012185224.Y979@bubble.sa.bigpond.net.au>
(_bfd_elf_discard_section_eh_frame): Set it for CIEs with pcrel
encoded personality.
(_bfd_elf_write_section_eh_frame): Adjust pcrel encoded personality
for CIE/FDE removal.
before looking for .eh_frame_hdr section.
* elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): If
.eh_frame_hdr section is being stripped from output, don't do
anything.
is 0, temporarily grow it to minimal CIE size.
(_bfd_elf_write_section_eh_frame): If input .eh_frame section would
end up empty, build a fake minimal CIE.
(struct eh_cie_fde): Add lsda_encoding, lsda_offset,
make_lsda_relative.
(read_value, write_value): New.
(_bfd_elf_discard_section_eh_frame): Inicialize
lsda_encoding, lsda_offset and make_lsda_relative.
(_bfd_elf_eh_frame_section_offset): If make_lsda_relative,
request no dynamic reloc for LSDA field of FDE.
(_bfd_elf_write_section_eh_frame): Handle make_lsda_relative.
If a non-DW_EH_PE_absptr value is 0, don't adjust it by base
or pcrel. Fix address computation for DW_EH_PE_pcrel relocs.
Update LSDA field if LSDA encoding is DW_EH_PE_pcrel, because
. might have changed due to deleted FDE or CIEs.