diff options
author | Nick Clifton <nickc@redhat.com> | 2008-11-18 14:05:00 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2008-11-18 14:05:00 +0000 |
commit | 44c0d1ebdd6460dfa40881b1cd95a9313a776aeb (patch) | |
tree | 6ad12a526407c828c986807ae6cf417352786d66 | |
parent | 3f0a9f6f891606e7cccc0636317f0eb062cb4a8c (diff) | |
download | binutils-redhat-44c0d1ebdd6460dfa40881b1cd95a9313a776aeb.tar.gz |
* dwarf2.c (read_section): Fix formatting.
(read_n_bytes): Remove unhelpful comment.
(read_indirect_string): Pass symbol table to read_section in case
the .debug_str section needs relocating.
PR 7037
* elf32-cr16.c (cr16_elf_howto_table): Zero the src_mask field of
the reloc descriptions.
-rw-r--r-- | bfd/ChangeLog | 11 | ||||
-rw-r--r-- | bfd/dwarf2.c | 39 | ||||
-rw-r--r-- | bfd/elf32-cr16.c | 58 |
3 files changed, 61 insertions, 47 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2adfb18bbc..50febf270f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +2008-11-18 Nick Clifton <nickc@redhat.com> + + * dwarf2.c (read_section): Fix formatting. + (read_n_bytes): Remove unhelpful comment. + (read_indirect_string): Pass symbol table to read_section in case + the .debug_str section needs relocating. + + PR 7037 + * elf32-cr16.c (cr16_elf_howto_table): Zero the src_mask field of + the reloc descriptions. + 2008-11-14 Eric B. Weddington <eric.weddington@atmel.com> PR 7022 diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index b53a5d45d6..f1f6c908ef 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -399,15 +399,19 @@ lookup_info_hash_table (struct info_hash_table *hash_table, const char *key) } /* Read a section into its appropriate place in the dwarf2_debug - struct (indicated by SECTION_BUFFER and SECTION_SIZE). If syms is + struct (indicated by SECTION_BUFFER and SECTION_SIZE). If SYMS is not NULL, use bfd_simple_get_relocated_section_contents to read the - section contents, otherwise use bfd_get_section_contents. */ + section contents, otherwise use bfd_get_section_contents. Fail if + the located section does not contain at least OFFSET bytes. */ static bfd_boolean -read_section (bfd *abfd, - const char* section_name, const char* compressed_section_name, - asymbol** syms, bfd_uint64_t offset, - bfd_byte **section_buffer, bfd_size_type *section_size) +read_section (bfd * abfd, + const char * section_name, + const char * compressed_section_name, + asymbol ** syms, + bfd_uint64_t offset, + bfd_byte ** section_buffer, + bfd_size_type * section_size) { asection *msec; bfd_boolean section_is_compressed = FALSE; @@ -459,11 +463,11 @@ read_section (bfd *abfd, } /* It is possible to get a bad value for the offset into the section - * that the client wants. Validate it here to avoid trouble later. */ + that the client wants. Validate it here to avoid trouble later. */ if (offset != 0 && offset >= *section_size) { (*_bfd_error_handler) (_("Dwarf Error: Offset (%lu) greater than or equal to %s size (%lu)."), - offset, section_name, *section_size); + (long) offset, section_name, *section_size); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -512,9 +516,6 @@ read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf, unsigned int size ATTRIBUTE_UNUSED) { - /* If the size of a host char is 8 bits, we can return a pointer - to the buffer, otherwise we have to copy the data to a buffer - allocated on the temporary obstack. */ return buf; } @@ -525,6 +526,7 @@ read_string (bfd *abfd ATTRIBUTE_UNUSED, { /* Return a pointer to the embedded string. */ char *str = (char *) buf; + if (*str == '\0') { *bytes_read_ptr = 1; @@ -535,10 +537,12 @@ read_string (bfd *abfd ATTRIBUTE_UNUSED, return str; } +/* END VERBATIM */ + static char * -read_indirect_string (struct comp_unit* unit, - bfd_byte *buf, - unsigned int *bytes_read_ptr) +read_indirect_string (struct comp_unit * unit, + bfd_byte * buf, + unsigned int * bytes_read_ptr) { bfd_uint64_t offset; struct dwarf2_debug *stash = unit->stash; @@ -548,12 +552,13 @@ read_indirect_string (struct comp_unit* unit, offset = read_4_bytes (unit->abfd, buf); else offset = read_8_bytes (unit->abfd, buf); + *bytes_read_ptr = unit->offset_size; if (! read_section (unit->abfd, ".debug_str", ".zdebug_str", - 0, offset, + stash->syms, offset, &stash->dwarf_str_buffer, &stash->dwarf_str_size)) - return 0; + return NULL; str = (char *) stash->dwarf_str_buffer + offset; if (*str == '\0') @@ -561,8 +566,6 @@ read_indirect_string (struct comp_unit* unit, return str; } -/* END VERBATIM */ - static bfd_uint64_t read_address (struct comp_unit *unit, bfd_byte *buf) { diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 84130b0caa..47eb2fc61d 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -93,7 +93,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_NUM8", /* name */ FALSE, /* partial_inplace */ - 0xff, /* src_mask */ + 0x0, /* src_mask */ 0xff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -107,7 +107,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_NUM16", /* name */ FALSE, /* partial_inplace */ - 0xffff, /* src_mask */ + 0x0, /* src_mask */ 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -121,7 +121,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_NUM32", /* name */ FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ + 0x0, /* src_mask */ 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -135,7 +135,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_NUM32a", /* name */ FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ + 0x0, /* src_mask */ 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -149,7 +149,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_REGREL4", /* name */ FALSE, /* partial_inplace */ - 0xf, /* src_mask */ + 0x0, /* src_mask */ 0xf, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -163,7 +163,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_REGREL4a", /* name */ FALSE, /* partial_inplace */ - 0xf, /* src_mask */ + 0x0, /* src_mask */ 0xf, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -177,7 +177,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_REGREL14", /* name */ FALSE, /* partial_inplace */ - 0x3fff, /* src_mask */ + 0x0, /* src_mask */ 0x3fff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -191,7 +191,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_REGREL14a", /* name */ FALSE, /* partial_inplace */ - 0x3fff, /* src_mask */ + 0x0, /* src_mask */ 0x3fff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -205,7 +205,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_REGREL16", /* name */ FALSE, /* partial_inplace */ - 0xffff, /* src_mask */ + 0x0, /* src_mask */ 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -219,7 +219,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_REGREL20", /* name */ FALSE, /* partial_inplace */ - 0xfffff, /* src_mask */ + 0x0, /* src_mask */ 0xfffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -233,7 +233,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_REGREL20a", /* name */ FALSE, /* partial_inplace */ - 0xfffff, /* src_mask */ + 0x0, /* src_mask */ 0xfffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -247,7 +247,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_ABS20", /* name */ FALSE, /* partial_inplace */ - 0xfffff, /* src_mask */ + 0x0, /* src_mask */ 0xfffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -261,7 +261,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_ABS24", /* name */ FALSE, /* partial_inplace */ - 0xffffff, /* src_mask */ + 0x0, /* src_mask */ 0xffffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -275,7 +275,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_IMM4", /* name */ FALSE, /* partial_inplace */ - 0xf, /* src_mask */ + 0x0, /* src_mask */ 0xf, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -289,7 +289,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_IMM8", /* name */ FALSE, /* partial_inplace */ - 0xff, /* src_mask */ + 0x0, /* src_mask */ 0xff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -303,7 +303,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_IMM16", /* name */ FALSE, /* partial_inplace */ - 0xffff, /* src_mask */ + 0x0, /* src_mask */ 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -317,7 +317,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_IMM20", /* name */ FALSE, /* partial_inplace */ - 0xfffff, /* src_mask */ + 0x0, /* src_mask */ 0xfffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -331,7 +331,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_IMM24", /* name */ FALSE, /* partial_inplace */ - 0xffffff, /* src_mask */ + 0x0, /* src_mask */ 0xffffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -345,7 +345,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_IMM32", /* name */ FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ + 0x0, /* src_mask */ 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -359,7 +359,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_IMM32a", /* name */ FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ + 0x0, /* src_mask */ 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -373,7 +373,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_DISP4", /* name */ FALSE, /* partial_inplace */ - 0xf, /* src_mask */ + 0x0, /* src_mask */ 0xf, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -387,7 +387,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_DISP8", /* name */ FALSE, /* partial_inplace */ - 0x1ff, /* src_mask */ + 0x0, /* src_mask */ 0x1ff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -401,7 +401,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_DISP16", /* name */ FALSE, /* partial_inplace */ - 0x1ffff, /* src_mask */ + 0x0, /* src_mask */ 0x1ffff, /* dst_mask */ FALSE), /* pcrel_offset */ /* REVISIT: DISP24 should be left-shift by 2 as per ISA doc @@ -416,7 +416,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_DISP24", /* name */ FALSE, /* partial_inplace */ - 0x1ffffff, /* src_mask */ + 0x0, /* src_mask */ 0x1ffffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -430,7 +430,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_DISP24a", /* name */ FALSE, /* partial_inplace */ - 0xffffff, /* src_mask */ + 0x0, /* src_mask */ 0xffffff, /* dst_mask */ FALSE), /* pcrel_offset */ @@ -447,7 +447,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_SWITCH8", /* name */ FALSE, /* partial_inplace */ - 0xff, /* src_mask */ + 0x0, /* src_mask */ 0xff, /* dst_mask */ TRUE), /* pcrel_offset */ @@ -464,7 +464,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_SWITCH16", /* name */ FALSE, /* partial_inplace */ - 0xffff, /* src_mask */ + 0x0, /* src_mask */ 0xffff, /* dst_mask */ TRUE), /* pcrel_offset */ @@ -481,7 +481,7 @@ static reloc_howto_type cr16_elf_howto_table[] = bfd_elf_generic_reloc, /* special_function */ "R_CR16_SWITCH32", /* name */ FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ + 0x0, /* src_mask */ 0xffffffff, /* dst_mask */ TRUE) /* pcrel_offset */ }; @@ -945,7 +945,7 @@ elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info, (info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0, input_bfd, input_section, rel->r_offset))) - return FALSE; + return FALSE; break; case bfd_reloc_undefined: |