diff options
author | Alan Modra <amodra@gmail.com> | 2003-08-07 07:25:34 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-08-07 07:25:34 +0000 |
commit | c39a58e6ffd208012eda73a92c52dc65127b2581 (patch) | |
tree | dd1fad8f288d7437b0b603bb6bc59fbe75158535 /bfd/elf-eh-frame.c | |
parent | 29ceeffbdecd52296cecbc0d2d5148b204a4f930 (diff) | |
download | gdb-c39a58e6ffd208012eda73a92c52dc65127b2581.zip gdb-c39a58e6ffd208012eda73a92c52dc65127b2581.tar.gz gdb-c39a58e6ffd208012eda73a92c52dc65127b2581.tar.bz2 |
* elf-bfd.h: Remove PARAMS macro. Replace PTR with void *.
(NAME): Use ## rather than CONCAT4 macro.
* elfcode.h: Remove one remaining PARAMS macro.
* elf-eh-frame.c: Convert to C90, remove unneeded casts and prototypes.
* elf-strtab.c: Likewise.
* elf-hppa.h: Likewise.
* elf32-hppa.h: Likewise.
* elf32-hppa.c: Likewise.
(elf32_hppa_add_symbol_hook): Delete.
(elf_backend_add_symbol_hook): Don't define.
* libhppa.h: Convert to C90. Replace INLINE with inline.
Diffstat (limited to 'bfd/elf-eh-frame.c')
-rw-r--r-- | bfd/elf-eh-frame.c | 137 |
1 files changed, 46 insertions, 91 deletions
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index e422aa9..c71129e 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -26,61 +26,44 @@ #define EH_FRAME_HDR_SIZE 8 -static bfd_vma read_unsigned_leb128 - PARAMS ((bfd *, char *, unsigned int *)); -static bfd_signed_vma read_signed_leb128 - PARAMS ((bfd *, char *, unsigned int *)); -static int get_DW_EH_PE_width - PARAMS ((int, int)); -static bfd_vma read_value - PARAMS ((bfd *, bfd_byte *, int, int)); -static void write_value - PARAMS ((bfd *, bfd_byte *, bfd_vma, int)); -static int cie_compare - PARAMS ((struct cie *, struct cie *)); -static int vma_compare - PARAMS ((const PTR, const PTR)); - /* Helper function for reading uleb128 encoded data. */ static bfd_vma -read_unsigned_leb128 (abfd, buf, bytes_read_ptr) - bfd *abfd ATTRIBUTE_UNUSED; - char *buf; - unsigned int *bytes_read_ptr; +read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED, + char *buf, + unsigned int *bytes_read_ptr) { - bfd_vma result; - unsigned int num_read; - int shift; + bfd_vma result; + unsigned int num_read; + int shift; unsigned char byte; - result = 0; - shift = 0; + result = 0; + shift = 0; num_read = 0; do { byte = bfd_get_8 (abfd, (bfd_byte *) buf); - buf ++; - num_read ++; + buf++; + num_read++; result |= (((bfd_vma) byte & 0x7f) << shift); shift += 7; } while (byte & 0x80); - * bytes_read_ptr = num_read; + *bytes_read_ptr = num_read; return result; } /* Helper function for reading sleb128 encoded data. */ static bfd_signed_vma -read_signed_leb128 (abfd, buf, bytes_read_ptr) - bfd *abfd ATTRIBUTE_UNUSED; - char *buf; - unsigned int * bytes_read_ptr; +read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED, + char *buf, + unsigned int * bytes_read_ptr) { - bfd_vma result; - int shift; - int num_read; + bfd_vma result; + int shift; + int num_read; unsigned char byte; result = 0; @@ -97,7 +80,7 @@ read_signed_leb128 (abfd, buf, bytes_read_ptr) while (byte & 0x80); if (byte & 0x40) result |= (((bfd_vma) -1) << (shift - 7)) << 7; - * bytes_read_ptr = num_read; + *bytes_read_ptr = num_read; return result; } @@ -120,8 +103,7 @@ while (0) /* Return 0 if either encoding is variable width, or not yet known to bfd. */ static -int get_DW_EH_PE_width (encoding, ptr_size) - int encoding, ptr_size; +int get_DW_EH_PE_width (int encoding, int ptr_size) { /* DW_EH_PE_ values of 0x60 and 0x70 weren't defined at the time .eh_frame was added to bfd. */ @@ -146,11 +128,7 @@ int get_DW_EH_PE_width (encoding, ptr_size) /* Read a width sized value from memory. */ static bfd_vma -read_value (abfd, buf, width, is_signed) - bfd *abfd; - bfd_byte *buf; - int width; - int is_signed; +read_value (bfd *abfd, bfd_byte *buf, int width, int is_signed) { bfd_vma value; @@ -185,11 +163,7 @@ read_value (abfd, buf, width, is_signed) /* Store a width sized value to memory. */ static void -write_value (abfd, buf, value, width) - bfd *abfd; - bfd_byte *buf; - bfd_vma value; - int width; +write_value (bfd *abfd, bfd_byte *buf, bfd_vma value, int width) { switch (width) { @@ -203,8 +177,7 @@ write_value (abfd, buf, value, width) /* Return zero if C1 and C2 CIEs can be merged. */ static -int cie_compare (c1, c2) - struct cie *c1, *c2; +int cie_compare (struct cie *c1, struct cie *c2) { if (c1->hdr.length == c2->hdr.length && c1->version == c2->version @@ -218,8 +191,7 @@ int cie_compare (c1, c2) && c1->per_encoding == c2->per_encoding && c1->lsda_encoding == c2->lsda_encoding && c1->fde_encoding == c2->fde_encoding - && (c1->initial_insn_length - == c2->initial_insn_length) + && c1->initial_insn_length == c2->initial_insn_length && memcmp (c1->initial_instructions, c2->initial_instructions, c1->initial_insn_length) == 0) @@ -234,13 +206,10 @@ int cie_compare (c1, c2) deleted. */ bfd_boolean -_bfd_elf_discard_section_eh_frame (abfd, info, sec, - reloc_symbol_deleted_p, cookie) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - bfd_boolean (*reloc_symbol_deleted_p) PARAMS ((bfd_vma, PTR)); - struct elf_reloc_cookie *cookie; +_bfd_elf_discard_section_eh_frame + (bfd *abfd, struct bfd_link_info *info, asection *sec, + bfd_boolean (*reloc_symbol_deleted_p) (bfd_vma, void *), + struct elf_reloc_cookie *cookie) { bfd_byte *ehbuf = NULL, *buf; bfd_byte *last_cie, *last_fde; @@ -274,12 +243,11 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, /* Read the frame unwind information from abfd. */ - ehbuf = (bfd_byte *) bfd_malloc (sec->_raw_size); + ehbuf = bfd_malloc (sec->_raw_size); if (ehbuf == NULL) goto free_no_table; - if (! bfd_get_section_contents (abfd, sec, ehbuf, (bfd_vma) 0, - sec->_raw_size)) + if (! bfd_get_section_contents (abfd, sec, ehbuf, 0, sec->_raw_size)) goto free_no_table; if (sec->_raw_size >= 4 @@ -693,9 +661,7 @@ free_no_table: input sections. It finalizes the size of .eh_frame_hdr section. */ bfd_boolean -_bfd_elf_discard_section_eh_frame_hdr (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) { struct elf_link_hash_table *htab; struct eh_frame_hdr_info *hdr_info; @@ -723,8 +689,7 @@ _bfd_elf_discard_section_eh_frame_hdr (abfd, info) since dynamic symbol table has been sized. */ bfd_boolean -_bfd_elf_maybe_strip_eh_frame_hdr (info) - struct bfd_link_info *info; +_bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info) { asection *o; bfd *abfd; @@ -770,18 +735,16 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info) or to offset with dynamic relocation which is no longer needed. */ bfd_vma -_bfd_elf_eh_frame_section_offset (output_bfd, sec, offset) - bfd *output_bfd ATTRIBUTE_UNUSED; - asection *sec; - bfd_vma offset; +_bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, + asection *sec, + bfd_vma offset) { struct eh_frame_sec_info *sec_info; unsigned int lo, hi, mid; if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME) return offset; - sec_info = (struct eh_frame_sec_info *) - elf_section_data (sec)->sec_info; + sec_info = elf_section_data (sec)->sec_info; if (offset >= sec->_raw_size) return offset - (sec->_cooked_size - sec->_raw_size); @@ -830,11 +793,10 @@ _bfd_elf_eh_frame_section_offset (output_bfd, sec, offset) contents. */ bfd_boolean -_bfd_elf_write_section_eh_frame (abfd, info, sec, contents) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - bfd_byte *contents; +_bfd_elf_write_section_eh_frame (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + bfd_byte *contents) { struct eh_frame_sec_info *sec_info; struct elf_link_hash_table *htab; @@ -849,12 +811,9 @@ _bfd_elf_write_section_eh_frame (abfd, info, sec, contents) == ELFCLASS64) ? 8 : 4; if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME) - return bfd_set_section_contents (abfd, sec->output_section, - contents, - (file_ptr) sec->output_offset, - sec->_raw_size); - sec_info = (struct eh_frame_sec_info *) - elf_section_data (sec)->sec_info; + return bfd_set_section_contents (abfd, sec->output_section, contents, + sec->output_offset, sec->_raw_size); + sec_info = elf_section_data (sec)->sec_info; htab = elf_hash_table (info); hdr_info = &htab->eh_info; if (hdr_info->table && hdr_info->array == NULL) @@ -1079,12 +1038,10 @@ _bfd_elf_write_section_eh_frame (abfd, info, sec, contents) VMA of FDE initial location. */ static int -vma_compare (a, b) - const PTR a; - const PTR b; +vma_compare (const void *a, const void *b) { - struct eh_frame_array_ent *p = (struct eh_frame_array_ent *) a; - struct eh_frame_array_ent *q = (struct eh_frame_array_ent *) b; + const struct eh_frame_array_ent *p = a; + const struct eh_frame_array_ent *q = b; if (p->initial_loc > q->initial_loc) return 1; if (p->initial_loc < q->initial_loc) @@ -1115,9 +1072,7 @@ vma_compare (a, b) sorted by increasing initial_loc). */ bfd_boolean -_bfd_elf_write_section_eh_frame_hdr (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) { struct elf_link_hash_table *htab; struct eh_frame_hdr_info *hdr_info; |