From 36192a8d549d934534b43e9be4948d90daa6981c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 8 Apr 2013 20:08:21 +0000 Subject: PR symtab/8423: * solib-som.c (som_solib_section_offsets): Use BFD section indices. Set offsets for all sections. * somread.c (som_symtab_read): Compute BFD section for symbol. Use prim_record_minimal_symbol_and_info. (som_symfile_read): Fix comment. (struct find_section_offset_arg): New. (find_section_offset, set_section_index): New functions. (som_symfile_offsets): Use set_section_index to compute section indices. bfd/ * som.c (bfd_section_from_som_symbol): No longer static. * som.h (bfd_section_from_som_symbol): Declare. --- gdb/solib-som.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'gdb/solib-som.c') diff --git a/gdb/solib-som.c b/gdb/solib-som.c index ff7fbaa..650e3df 100644 --- a/gdb/solib-som.c +++ b/gdb/solib-som.c @@ -840,13 +840,12 @@ som_solib_section_offsets (struct objfile *objfile, if (strstr (objfile->name, so_list->so_name)) { asection *private_section; + struct obj_section *sect; /* The text offset is easy. */ offsets->offsets[SECT_OFF_TEXT (objfile)] = (so_list->lm_info->text_addr - so_list->lm_info->text_link_addr); - offsets->offsets[SECT_OFF_RODATA (objfile)] - = ANOFFSET (offsets, SECT_OFF_TEXT (objfile)); /* We should look at presumed_dp in the SOM header, but that's not easily available. This should be OK though. */ @@ -859,10 +858,28 @@ som_solib_section_offsets (struct objfile *objfile, offsets->offsets[SECT_OFF_BSS (objfile)] = 0; return 1; } - offsets->offsets[SECT_OFF_DATA (objfile)] - = (so_list->lm_info->data_start - private_section->vma); - offsets->offsets[SECT_OFF_BSS (objfile)] - = ANOFFSET (offsets, SECT_OFF_DATA (objfile)); + if (objfile->sect_index_data != -1) + { + offsets->offsets[SECT_OFF_DATA (objfile)] + = (so_list->lm_info->data_start - private_section->vma); + if (objfile->sect_index_bss != -1) + offsets->offsets[SECT_OFF_BSS (objfile)] + = ANOFFSET (offsets, SECT_OFF_DATA (objfile)); + } + + ALL_OBJFILE_OSECTIONS (objfile, sect) + { + flagword flags = bfd_get_section_flags (objfile->obfd, + sect->the_bfd_section); + + if ((flags & SEC_CODE) != 0) + offsets->offsets[sect->the_bfd_section->index] + = offsets->offsets[SECT_OFF_TEXT (objfile)]; + else + offsets->offsets[sect->the_bfd_section->index] + = offsets->offsets[SECT_OFF_DATA (objfile)]; + } + return 1; } so_list = so_list->next; -- cgit v1.1