From: Elena Zannoni Date: Mon, 17 Apr 2000 16:09:04 +0000 (+0000) Subject: 2000-04-17 Elena Zannoni X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e7cf9df194baf9fe94e8d3e10d61a33d67b4c808;p=binutils-gdb.git 2000-04-17 Elena Zannoni * symfile.h (struct section_addr_info ): Remove fields for special treatment of .text, .data and .bss sections. * solib.c (symbol_add_stub): The special field text_addr is not available anymore. Search for the .text field the hard way. * symfile.c (build_section_addr_info_from_section_table): Don't fill in {text, data, bss}_addr any more. (default_symfile_offsets): Don't use {text, data, bss}_addr fields to fill in section_offsets for objfile. (syms_from_objfile): Don't deal with {text, data, bss}_addr as a special case anymore. (add_symbol_file_command): Ditto. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e5be57e8dce..f92ea270c15 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2000-04-17 Elena Zannoni + + * symfile.h (struct section_addr_info ): Remove fields for special + treatment of .text, .data and .bss sections. + + * solib.c (symbol_add_stub): The special field text_addr is not + available anymore. Search for the .text field the hard way. + + * symfile.c (build_section_addr_info_from_section_table): Don't + fill in {text, data, bss}_addr any more. + (default_symfile_offsets): Don't use {text, data, bss}_addr fields + to fill in section_offsets for objfile. + (syms_from_objfile): Don't deal with {text, data, bss}_addr as a + special case anymore. + (add_symbol_file_command): Ditto. + 2000-04-17 Elena Zannoni symfile.c: (symbol_file_command): Remove support for rombug, to diff --git a/gdb/solib.c b/gdb/solib.c index ded9faee19e..fe3265e0930 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1155,6 +1155,8 @@ symbol_add_stub (arg) register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */ CORE_ADDR text_addr = 0; struct section_addr_info *sap; + int i; + asection *text_section; /* Have we already loaded this shared object? */ ALL_OBJFILES (so->objfile) @@ -1183,7 +1185,14 @@ symbol_add_stub (arg) sap = build_section_addr_info_from_section_table (so->sections, so->sections_end); - sap->text_addr = text_addr; + + /* Look for the index for the .text section in the sap structure. */ + text_section = bfd_get_section_by_name (so->abfd, ".text"); + for (i = 0; i < MAX_SECTIONS && sap->other[i].name; i++) + if (sap->other[i].sectindex == text_section->index) + break; + + sap->other[i].addr = text_addr; so->objfile = symbol_file_add (so->so_name, so->from_tty, sap, 0, OBJF_SHARED); free_section_addr_info (sap); diff --git a/gdb/symfile.c b/gdb/symfile.c index 5d847f0a8e2..108695a338e 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -478,13 +478,6 @@ build_section_addr_info_from_section_table (const struct section_table *start, for (stp = start, oidx = 0; stp != end; stp++) { - if (strcmp (stp->the_bfd_section->name, ".text") == 0) - sap->text_addr = stp->addr; - else if (strcmp (stp->the_bfd_section->name, ".data") == 0) - sap->data_addr = stp->addr; - else if (strcmp (stp->the_bfd_section->name, ".bss") == 0) - sap->bss_addr = stp->addr; - if (stp->the_bfd_section->flags & (SEC_ALLOC | SEC_LOAD) && oidx < MAX_SECTIONS) { @@ -531,15 +524,6 @@ default_symfile_offsets (objfile, addrs) obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS); memset (objfile->section_offsets, 0, SIZEOF_SECTION_OFFSETS); - /* If user explicitly specified values for data and bss, set them here. */ - - if (addrs->text_addr) - ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT) = addrs->text_addr; - if (addrs->data_addr) - ANOFFSET (objfile->section_offsets, SECT_OFF_DATA) = addrs->data_addr; - if (addrs->bss_addr) - ANOFFSET (objfile->section_offsets, SECT_OFF_BSS) = addrs->bss_addr; - /* Now calculate offsets for other sections. */ for (i = 0; i < MAX_SECTIONS && addrs->other[i].name; i++) { @@ -635,14 +619,7 @@ syms_from_objfile (objfile, addrs, mainline, verbo) We no longer warn if the lowest section is not a text segment (as happens for the PA64 port. */ - if (mainline) - { - /* No offset from objfile addresses. */ - addrs -> text_addr = 0; - addrs -> data_addr = 0; - addrs -> bss_addr = 0; - } - else + if (!mainline) { /* Find lowest loadable section to be used as starting point for continguous sections. FIXME!! won't work without call to find @@ -675,57 +652,17 @@ syms_from_objfile (objfile, addrs, mainline, verbo) (the loadable section directly below it in memory). this_offset = lower_offset = lower_addr - lower_orig_addr */ - /* FIXME: These sections will not need special treatment because ALL - sections are in the other sections table */ - - if (addrs->text_addr != 0) - { - sect = bfd_get_section_by_name (objfile->obfd, ".text"); - if (sect) - { - addrs->text_addr -= bfd_section_vma (objfile->obfd, sect); - lower_offset = addrs->text_addr; - } - } - else - /* ??? who's below me? */ - addrs->text_addr = lower_offset; - - if (addrs->data_addr != 0) - { - sect = bfd_get_section_by_name (objfile->obfd, ".data"); - if (sect) - { - addrs->data_addr -= bfd_section_vma (objfile->obfd, sect); - lower_offset = addrs->data_addr; - } - } - else - addrs->data_addr = lower_offset; - - if (addrs->bss_addr != 0) - { - sect = bfd_get_section_by_name (objfile->obfd, ".bss"); - if (sect) - { - addrs->bss_addr -= bfd_section_vma (objfile->obfd, sect); - lower_offset = addrs->bss_addr; - } - } - else - addrs->bss_addr = lower_offset; - - /* Now calculate offsets for other sections. */ + /* Calculate offsets for sections. */ for (i=0 ; i < MAX_SECTIONS && addrs->other[i].name; i++) { - - if (addrs->other[i].addr != 0) + if (addrs->other[i].addr != 0) { - sect=bfd_get_section_by_name(objfile->obfd, addrs->other[i].name); + sect = bfd_get_section_by_name (objfile->obfd, addrs->other[i].name); if (sect) { addrs->other[i].addr -= bfd_section_vma (objfile->obfd, sect); lower_offset = addrs->other[i].addr; + /* This is the index used by BFD. */ addrs->other[i].sectindex = sect->index ; } else @@ -782,13 +719,6 @@ syms_from_objfile (objfile, addrs, mainline, verbo) CORE_ADDR s_addr = 0; int i; - if (strcmp (s->the_bfd_section->name, ".text") == 0) - s_addr = addrs->text_addr; - else if (strcmp (s->the_bfd_section->name, ".data") == 0) - s_addr = addrs->data_addr; - else if (strcmp (s->the_bfd_section->name, ".bss") == 0) - s_addr = addrs->bss_addr; - else for (i = 0; !s_addr && i < MAX_SECTIONS && addrs->other[i].name; i++) @@ -1615,13 +1545,6 @@ add_symbol_file_command (args, from_tty) else addr = strtoul (val, NULL, 10); - if (strcmp (sec, ".text") == 0) - section_addrs.text_addr = addr; - else if (strcmp (sec, ".data") == 0) - section_addrs.data_addr = addr; - else if (strcmp (sec, ".bss") == 0) - section_addrs.bss_addr = addr; - /* Here we store the section offsets in the order they were entered on the command line. */ section_addrs.other[sec_num].name = sec; diff --git a/gdb/symfile.h b/gdb/symfile.h index 5d3ee1de785..35913c08cd8 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -64,10 +64,6 @@ struct psymbol_allocation_list #define MAX_SECTIONS 40 struct section_addr_info { - /* Sections whose names are always known to gdb. */ - CORE_ADDR text_addr; - CORE_ADDR data_addr; - CORE_ADDR bss_addr; /* Sections whose names are file format dependant. */ struct other_sections {