[PATCH] Make SECT_OFF_* objfile specific

Elena Zannoni ezannoni@cygnus.com
Wed May 3 07:02:00 GMT 2000


If I hear no objections, this is going in tomorrow morning.

Elena


Elena Zannoni writes:
 > 
 > This patch makes SECT_OFF_TEXT, SECT_OFF_DATA, SECT_OFF_BSS and
 > SECT_OFF_RODATA dependent on a given specific objfile.  This is
 > because the numbering of the sections can vary depending on each
 > objfile.
 > 
 > The corresponding indexes are initialized in the functions
 > default_symfile_offsets, som_symfile_offsets, xcoff_symfile_offsets,
 > based on the bfd indexes for sections.  The indexes are now members of
 > the objfile structure.
 > 
 > This patch supersedes the one in 
 > http://sourceware.cygnus.com/ml/gdb-patches/2000-04/msg00402.html
 > 
 > I tested it on a som platform (hpux 10.20), an xcoff platform (aix)
 > and a stabs/elf platform (solaris). If somebody wants to try it on
 > some other system that would be extremely helpful.
 > 
 > Thanks
 > Elena
 > 
 > 2000-04-30  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
 > 
 > 	* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
 > 	SECT_OFF_RODATA): Define as functions of OBJFILE.  Add
 > 	sect_index_text, sect_index_data, sect_index_rodata,
 >  	sect_index_bss to objfile structure.  
 > 	* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
 >  	SECT_OFF_RODATA): Remove.
 > 	* objfiles.c (allocate_objfile): Initialize
 >  	sect_index_{text,data,bss,rodata} to -1, for error detection.
 > 
 > 	* symfile.c (default_symfile_offsets): Initialize
 >  	sect_index_{text,data,bss,rodata} from bfd information.
 > 	* xcoffread.c (xcoff_symfile_offsets): Ditto.
 > 	* somread.c (som_symfile_offsets): Initialize
 >  	sect_index_{text,data,bss,rodata}.
 > 
 >  	* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
 >         hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
 >         mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
 >         remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
 >         stabsread.c, symfile.c, xcoffread.c:
 >  	Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
 >  	current objfile.
 > 
 >         * xcoffread.c: Add new field objfile to find_targ_sec_arg.
 > 
 > Index: coffread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/coffread.c,v
 > retrieving revision 1.3
 > diff -u -p -r1.3 coffread.c
 > --- coffread.c	2000/04/26 12:41:48	1.3
 > +++ coffread.c	2000/04/30 14:43:39
 > @@ -340,7 +340,7 @@ cs_to_section (cs, objfile)
 >  {
 >    asection *sect = NULL;
 >    struct find_targ_sec_arg args;
 > -  int off = SECT_OFF_TEXT;
 > +  int off = SECT_OFF_TEXT (objfile);
 >  
 >    args.targ_index = cs->c_secnum;
 >    args.resultp = §
 > @@ -349,11 +349,11 @@ cs_to_section (cs, objfile)
 >      {
 >        /* This is the section.  Figure out what SECT_OFF_* code it is.  */
 >        if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
 > -	off = SECT_OFF_TEXT;
 > +	off = SECT_OFF_TEXT (objfile);
 >        else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
 > -	off = SECT_OFF_DATA;
 > +	off = SECT_OFF_DATA (objfile);
 >        else
 > -	off = SECT_OFF_BSS;
 > +	off = SECT_OFF_BSS (objfile);
 >      }
 >    return off;
 >  }
 > @@ -843,7 +843,7 @@ coff_symtab_read (symtab_offset, nsyms, 
 >        if (ISFCN (cs->c_type) && cs->c_sclass != C_TPDEF)
 >  	{
 >  	  /* Record all functions -- external and static -- in minsyms. */
 > -	  tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	  tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	  record_minimal_symbol (cs->c_name, tmpaddr, mst_text, objfile);
 >  
 >  	  fcn_line_ptr = main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr;
 > @@ -908,7 +908,7 @@ coff_symtab_read (symtab_offset, nsyms, 
 >  		     followed by a later file with no symbols.  */
 >  		  if (in_source_file)
 >  		    complete_symtab (filestring,
 > -		    cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
 > +		    cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
 >  				     main_aux.x_scn.x_scnlen);
 >  		  in_source_file = 0;
 >  		}
 > @@ -969,10 +969,8 @@ coff_symtab_read (symtab_offset, nsyms, 
 >  		    || cs->c_sclass == C_THUMBEXT)
 >  		  tmpaddr += ANOFFSET (objfile->section_offsets, sec);
 >  
 > -		switch (sec)
 > +		if (sec == SECT_OFF_TEXT (objfile) || sec == SECT_OFF_RODATA (objfile))
 >  		  {
 > -		  case SECT_OFF_TEXT:
 > -		  case SECT_OFF_RODATA:
 >  		    ms_type =
 >  		      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
 >  		      || cs->c_sclass == C_THUMBEXT ?
 > @@ -981,21 +979,23 @@ coff_symtab_read (symtab_offset, nsyms, 
 >  		    if (tmpaddr & 1)	/* FIXME: delete this line */
 >  		      SMASH_TEXT_ADDRESS (tmpaddr);
 >  #endif
 > -		    break;
 > -		  case SECT_OFF_DATA:
 > +		  }
 > +		else
 > +		  if  (sec == SECT_OFF_DATA (objfile))
 > +		    {
 >  		    ms_type =
 >  		      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
 >  		      mst_data : mst_file_data;
 > -		    break;
 > -		  case SECT_OFF_BSS:
 > +		    }
 > +		  else
 > +		    if (sec == SECT_OFF_BSS (objfile))
 > +		      {
 >  		    ms_type =
 >  		      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
 >  		      mst_data : mst_file_data;
 > -		    break;
 > -		  default:
 > -		    ms_type = mst_unknown;
 > -		    break;
 > -		  }
 > +		      }
 > +		    else
 > +		      ms_type = mst_unknown;
 >  	      }
 >  
 >  	    if (cs->c_name[0] != '@' /* Skip tdesc symbols */ )
 > @@ -1099,11 +1099,11 @@ coff_symtab_read (symtab_offset, nsyms, 
 >  	         of the epilogue.  */
 >  			    cs->c_value
 >  			    + FUNCTION_EPILOGUE_SIZE
 > -			    + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
 > +			    + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
 >  #else
 >  			    fcn_cs_saved.c_value
 >  			    + fcn_aux_saved.x_sym.x_misc.x_fsize
 > -			    + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
 > +			    + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
 >  #endif
 >  			    objfile
 >  		);
 > @@ -1115,7 +1115,7 @@ coff_symtab_read (symtab_offset, nsyms, 
 >  	  if (STREQ (cs->c_name, ".bb"))
 >  	    {
 >  	      tmpaddr = cs->c_value;
 > -	      tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	      tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	      push_context (++depth, tmpaddr);
 >  	    }
 >  	  else if (STREQ (cs->c_name, ".eb"))
 > @@ -1135,7 +1135,7 @@ coff_symtab_read (symtab_offset, nsyms, 
 >  	      if (local_symbols && context_stack_depth > 0)
 >  		{
 >  		  tmpaddr =
 > -		    cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		    cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  		  /* Make a block for the local symbols within.  */
 >  		  finish_block (0, &local_symbols, new->old_blocks,
 >  				new->start_addr, tmpaddr, objfile);
 > @@ -1427,7 +1427,7 @@ enter_linenos (file_offset, first_line, 
 >        if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
 >  	record_line (current_subfile, first_line + L_LNNO32 (&lptr),
 >  		     lptr.l_addr.l_paddr
 > -		     + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT));
 > +		     + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)));
 >        else
 >  	break;
 >      }
 > @@ -1547,7 +1547,7 @@ process_coff_symbol (cs, aux, objfile)
 >  
 >    if (ISFCN (cs->c_type))
 >      {
 > -      SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +      SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >        SYMBOL_TYPE (sym) =
 >  	lookup_function_type (decode_function_type (cs, cs->c_type, aux));
 >  
 > @@ -1577,7 +1577,7 @@ process_coff_symbol (cs, aux, objfile)
 >  	case C_EXT:
 >  	  SYMBOL_CLASS (sym) = LOC_STATIC;
 >  	  SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
 > -	  SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	  SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	  add_symbol_to_list (sym, &global_symbols);
 >  	  break;
 >  
 > @@ -1586,7 +1586,7 @@ process_coff_symbol (cs, aux, objfile)
 >  	case C_STAT:
 >  	  SYMBOL_CLASS (sym) = LOC_STATIC;
 >  	  SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
 > -	  SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	  SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	  if (within_function)
 >  	    {
 >  	      /* Static symbol of local scope */
 > Index: dbxread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/dbxread.c,v
 > retrieving revision 1.1.1.10
 > diff -u -p -r1.1.1.10 dbxread.c
 > --- dbxread.c	2000/01/06 03:06:36	1.1.1.10
 > +++ dbxread.c	2000/04/30 14:43:39
 > @@ -488,17 +488,17 @@ record_minimal_symbol (name, address, ty
 >      {
 >      case N_TEXT | N_EXT:
 >        ms_type = mst_text;
 > -      section = SECT_OFF_TEXT;
 > +      section = SECT_OFF_TEXT (objfile);
 >        bfd_section = DBX_TEXT_SECTION (objfile);
 >        break;
 >      case N_DATA | N_EXT:
 >        ms_type = mst_data;
 > -      section = SECT_OFF_DATA;
 > +      section = SECT_OFF_DATA (objfile);
 >        bfd_section = DBX_DATA_SECTION (objfile);
 >        break;
 >      case N_BSS | N_EXT:
 >        ms_type = mst_bss;
 > -      section = SECT_OFF_BSS;
 > +      section = SECT_OFF_BSS (objfile);
 >        bfd_section = DBX_BSS_SECTION (objfile);
 >        break;
 >      case N_ABS | N_EXT:
 > @@ -509,7 +509,7 @@ record_minimal_symbol (name, address, ty
 >  #ifdef N_SETV
 >      case N_SETV | N_EXT:
 >        ms_type = mst_data;
 > -      section = SECT_OFF_DATA;
 > +      section = SECT_OFF_DATA (objfile);
 >        bfd_section = DBX_DATA_SECTION (objfile);
 >        break;
 >      case N_SETV:
 > @@ -517,7 +517,7 @@ record_minimal_symbol (name, address, ty
 >           of going over many .o files, it doesn't make sense to have one
 >           file local.  */
 >        ms_type = mst_file_data;
 > -      section = SECT_OFF_DATA;
 > +      section = SECT_OFF_DATA (objfile);
 >        bfd_section = DBX_DATA_SECTION (objfile);
 >        break;
 >  #endif
 > @@ -526,7 +526,7 @@ record_minimal_symbol (name, address, ty
 >      case N_FN:
 >      case N_FN_SEQ:
 >        ms_type = mst_file_text;
 > -      section = SECT_OFF_TEXT;
 > +      section = SECT_OFF_TEXT (objfile);
 >        bfd_section = DBX_TEXT_SECTION (objfile);
 >        break;
 >      case N_DATA:
 > @@ -547,12 +547,12 @@ record_minimal_symbol (name, address, ty
 >  	if (VTBL_PREFIX_P ((tempstring)))
 >  	  ms_type = mst_data;
 >        }
 > -      section = SECT_OFF_DATA;
 > +      section = SECT_OFF_DATA (objfile);
 >        bfd_section = DBX_DATA_SECTION (objfile);
 >        break;
 >      case N_BSS:
 >        ms_type = mst_file_bss;
 > -      section = SECT_OFF_BSS;
 > +      section = SECT_OFF_BSS (objfile);
 >        bfd_section = DBX_BSS_SECTION (objfile);
 >        break;
 >      default:
 > @@ -1157,17 +1157,17 @@ read_dbx_dynamic_symtab (objfile)
 >  
 >  	  if (bfd_get_section_flags (abfd, sec) & SEC_CODE)
 >  	    {
 > -	      sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	      sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	      type = N_TEXT;
 >  	    }
 >  	  else if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
 >  	    {
 > -	      sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +	      sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  	      type = N_DATA;
 >  	    }
 >  	  else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
 >  	    {
 > -	      sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
 > +	      sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
 >  	      type = N_BSS;
 >  	    }
 >  	  else
 > @@ -1208,7 +1208,7 @@ read_dbx_dynamic_symtab (objfile)
 >      {
 >        arelent *rel = *relptr;
 >        CORE_ADDR address =
 > -      rel->address + ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +      rel->address + ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  
 >        switch (bfd_get_arch (abfd))
 >  	{
 > @@ -1382,7 +1382,7 @@ read_dbx_symtab (objfile)
 >        /* Don't set pst->texthigh lower than it already is.  */
 >        CORE_ADDR text_end =
 >        (lowest_text_address == (CORE_ADDR) -1
 > -       ? (text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT))
 > +       ? (text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))
 >         : lowest_text_address)
 >        + text_size;
 >  
 > @@ -1558,6 +1558,7 @@ end_psymtab (pst, include_list, num_incl
 >        struct partial_symtab *subpst =
 >        allocate_psymtab (include_list[i], objfile);
 >  
 > +      /* Copy the sesction_offsets array from the main psymtab. */
 >        subpst->section_offsets = pst->section_offsets;
 >        subpst->read_symtab_private =
 >  	(char *) obstack_alloc (&objfile->psymbol_obstack,
 > @@ -1738,6 +1739,10 @@ read_ofile_symtab (pst)
 >    sym_size = LDSYMLEN (pst);
 >    text_offset = pst->textlow;
 >    text_size = pst->texthigh - pst->textlow;
 > +  /* This cannot be simply objfile->section_offsets because of
 > +     elfstab_offset_sections() which initializes the psymtab section
 > +     offsets information in a special way, and that is different from
 > +     objfile->section_offsets. */ 
 >    section_offsets = pst->section_offsets;
 >  
 >    current_objfile = objfile;
 > @@ -1880,7 +1885,7 @@ read_ofile_symtab (pst)
 >    if (last_source_start_addr > text_offset)
 >      last_source_start_addr = text_offset;
 >  
 > -  pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT);
 > +  pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
 >  
 >    /* Process items which we had to "process_later" due to dependancies 
 >       on other stabs.  */
 > @@ -1899,6 +1904,8 @@ read_ofile_symtab (pst)
 >     NAME is the symbol name, in our address space.
 >     SECTION_OFFSETS is a set of amounts by which the sections of this object
 >     file were relocated when it was loaded into memory.
 > +   Note that these section_offsets are not the 
 > +   objfile->section_offsets but the pst->section_offsets.
 >     All symbols that refer
 >     to memory locations need to be offset by these amounts.
 >     OBJFILE is the object file from which we are reading symbols.
 > @@ -1942,7 +1949,7 @@ process_one_symbol (type, desc, valu, na
 >    if (!block_address_function_relative)
 >      /* N_LBRAC, N_RBRAC and N_SLINE entries are not relative to the
 >         function start address, so just use the text offset.  */
 > -    function_start_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +    function_start_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >  
 >    /* Something is wrong if we see real data before
 >       seeing a source file name.  */
 > @@ -1982,7 +1989,7 @@ process_one_symbol (type, desc, valu, na
 >  	}
 >  
 >        /* Relocate for dynamic loading */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >  #ifdef SMASH_TEXT_ADDRESS
 >        SMASH_TEXT_ADDRESS (valu);
 >  #endif
 > @@ -2090,7 +2097,7 @@ process_one_symbol (type, desc, valu, na
 >      case N_FN_SEQ:
 >        /* This kind of symbol indicates the start of an object file.  */
 >        /* Relocate for dynamic loading */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >        break;
 >  
 >      case N_SO:
 > @@ -2099,7 +2106,7 @@ process_one_symbol (type, desc, valu, na
 >           Finish the symbol table of the previous source file
 >           (if any) and start accumulating a new symbol table.  */
 >        /* Relocate for dynamic loading */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >  
 >        n_opt_found = 0;
 >  
 > @@ -2126,7 +2133,7 @@ process_one_symbol (type, desc, valu, na
 >  	      patch_subfile_names (current_subfile, name);
 >  	      break;		/* Ignore repeated SOs */
 >  	    }
 > -	  end_symtab (valu, objfile, SECT_OFF_TEXT);
 > +	  end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));
 >  	  end_stabs ();
 >  	}
 >  
 > @@ -2149,7 +2156,7 @@ process_one_symbol (type, desc, valu, na
 >           included in the compilation of the main source file
 >           (whose name was given in the N_SO symbol.)  */
 >        /* Relocate for dynamic loading */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >        start_subfile (name, current_subfile->dirname);
 >        break;
 >  
 > @@ -2227,7 +2234,7 @@ process_one_symbol (type, desc, valu, na
 >  		   elfstab_offset_sections ever starts dealing with the
 >  		   text offset, and we still need to do this, we need to
 >  		   invent a SECT_OFF_ADDR_KLUDGE or something.  */
 > -		valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +		valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >  		goto define_a_symbol;
 >  	      }
 >  	  }
 > @@ -2247,22 +2254,22 @@ process_one_symbol (type, desc, valu, na
 >  
 >      case_N_STSYM:		/* Static symbol in data seg */
 >      case N_DSLINE:		/* Source line number, data seg */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_DATA);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
 >        goto define_a_symbol;
 >  
 >      case_N_LCSYM:		/* Static symbol in BSS seg */
 >      case N_BSLINE:		/* Source line number, bss seg */
 >        /*   N_BROWS:       overlaps with N_BSLINE */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_BSS);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
 >        goto define_a_symbol;
 >  
 >      case_N_ROSYM:		/* Static symbol in Read-only data seg */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_RODATA);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_RODATA (objfile));
 >        goto define_a_symbol;
 >  
 >      case N_ENTRY:		/* Alternate entry point */
 >        /* Relocate for dynamic loading */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >        goto define_a_symbol;
 >  
 >        /* The following symbol types we don't know how to process.  Handle
 > @@ -2314,7 +2321,7 @@ process_one_symbol (type, desc, valu, na
 >  	      /* Deal with the SunPRO 3.0 compiler which omits the address
 >  	         from N_FUN symbols.  */
 >  	      if (type == N_FUN
 > -		  && valu == ANOFFSET (section_offsets, SECT_OFF_TEXT))
 > +		  && valu == ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)))
 >  		valu = 
 >  		  find_stab_function_addr (name, last_source_file, objfile);
 >  #endif
 > Index: elfread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/elfread.c,v
 > retrieving revision 1.4
 > diff -u -p -r1.4 elfread.c
 > --- elfread.c	2000/02/15 04:48:23	1.4
 > +++ elfread.c	2000/04/30 14:43:39
 > @@ -191,18 +191,18 @@ record_minimal_symbol_and_info (name, ad
 >      {
 >      case mst_text:
 >      case mst_file_text:
 > -      section = SECT_OFF_TEXT;
 > +      section = SECT_OFF_TEXT (objfile);
 >  #ifdef SMASH_TEXT_ADDRESS
 >        SMASH_TEXT_ADDRESS (address);
 >  #endif
 >        break;
 >      case mst_data:
 >      case mst_file_data:
 > -      section = SECT_OFF_DATA;
 > +      section = SECT_OFF_DATA (objfile);
 >        break;
 >      case mst_bss:
 >      case mst_file_bss:
 > -      section = SECT_OFF_BSS;
 > +      section = SECT_OFF_BSS (objfile);
 >        break;
 >      default:
 >        section = -1;
 > @@ -294,7 +294,7 @@ elf_symtab_read (objfile, dynamic)
 >  	error ("Can't read symbols from %s: %s", bfd_get_filename (objfile->obfd),
 >  	       bfd_errmsg (bfd_get_error ()));
 >        /* FIXME: Should use section specific offset, not SECT_OFF_TEXT. */
 > -      offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +      offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >        for (i = 0; i < number_of_symbols; i++)
 >  	{
 >  	  sym = symbol_table[i];
 > @@ -460,15 +460,15 @@ elf_symtab_read (objfile, dynamic)
 >  		      index = SECT_OFF_MAX;
 >  		      if (STREQ ("Bbss.bss", sym->name))
 >  			{
 > -			  index = SECT_OFF_BSS;
 > +			  index = SECT_OFF_BSS (objfile);
 >  			}
 >  		      else if (STREQ ("Ddata.data", sym->name))
 >  			{
 > -			  index = SECT_OFF_DATA;
 > +			  index = SECT_OFF_DATA (objfile);
 >  			}
 >  		      else if (STREQ ("Drodata.rodata", sym->name))
 >  			{
 > -			  index = SECT_OFF_RODATA;
 > +			  index = SECT_OFF_RODATA (objfile);
 >  			}
 >  		      if (index != SECT_OFF_MAX)
 >  			{
 > Index: gdb-stabs.h
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/gdb-stabs.h,v
 > retrieving revision 1.2
 > diff -u -p -r1.2 gdb-stabs.h
 > --- gdb-stabs.h	2000/04/21 14:33:33	1.2
 > +++ gdb-stabs.h	2000/04/30 14:43:39
 > @@ -28,15 +28,6 @@
 >  #if !defined (GDBSTABS_H)
 >  #define GDBSTABS_H
 >  
 > -/* Offsets in the psymtab's section_offsets array for various kinds of
 > -   stabs symbols.  Every psymtab built from stabs will have these offsets
 > -   filled in by these guidelines, so that when actually reading symbols, the
 > -   proper offset can simply be selected and added to the symbol value.  */
 > -
 > -#define	SECT_OFF_TEXT	0
 > -#define	SECT_OFF_DATA	1
 > -#define	SECT_OFF_BSS	2
 > -#define	SECT_OFF_RODATA	3
 >  #define	SECT_OFF_MAX	40	/* Count of possible values */
 >  
 >  /* The stab_section_info chain remembers info from the ELF symbol table,
 > Index: hp-psymtab-read.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/hp-psymtab-read.c,v
 > retrieving revision 1.1.1.6
 > diff -u -p -r1.1.1.6 hp-psymtab-read.c
 > --- hp-psymtab-read.c	1999/12/22 21:45:06	1.1.1.6
 > +++ hp-psymtab-read.c	2000/04/30 14:43:39
 > @@ -601,7 +601,7 @@ scan_procs (curr_pd_p, qPD, max_procs, s
 >  					   LOC_BLOCK,	/* "I am a routine"        */
 >  					   &objfile->global_psymbols,
 >  					   (qPD[curr_pd].adrStart +	/* Starting address of rtn */
 > -				 ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT)),
 > +				 ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))),
 >  					   0,	/* core addr?? */
 >  		      trans_lang ((enum hp_language) qPD[curr_pd].language),
 >  					   objfile);
 > @@ -614,7 +614,7 @@ scan_procs (curr_pd_p, qPD, max_procs, s
 >  					   LOC_BLOCK,	/* "I am a routine"        */
 >  					   &objfile->static_psymbols,
 >  					   (qPD[curr_pd].adrStart +	/* Starting address of rtn */
 > -				 ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT)),
 > +				 ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))),
 >  					   0,	/* core addr?? */
 >  		      trans_lang ((enum hp_language) qPD[curr_pd].language),
 >  					   objfile);
 > @@ -1816,7 +1816,7 @@ hpread_build_psymtabs (objfile, mainline
 >  		  past_first_source_file = 1;
 >  
 >  		valu = hpread_get_textlow (i, hp_symnum, objfile, symcount);
 > -		valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  		pst = hpread_start_psymtab (objfile,
 >  					    namestring, valu,
 >  					    (hp_symnum
 > @@ -1850,7 +1850,7 @@ hpread_build_psymtabs (objfile, mainline
 >  	      /* Now begin a new module and a new psymtab for it */
 >  	      SET_NAMESTRING (dn_bufp, &namestring, objfile);
 >  	      valu = hpread_get_textlow (i, hp_symnum, objfile, symcount);
 > -	      valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	      valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	      if (!pst)
 >  		{
 >  		  pst = hpread_start_psymtab (objfile,
 > @@ -1869,11 +1869,11 @@ hpread_build_psymtabs (objfile, mainline
 >  	      /* The beginning of a function.  DNTT_TYPE_ENTRY may also denote
 >  	         a secondary entry point.  */
 >  	      valu = dn_bufp->dfunc.hiaddr + ANOFFSET (objfile->section_offsets,
 > -						       SECT_OFF_TEXT);
 > +						       SECT_OFF_TEXT (objfile));
 >  	      if (valu > texthigh)
 >  		texthigh = valu;
 >  	      valu = dn_bufp->dfunc.lowaddr +
 > -		ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	      SET_NAMESTRING (dn_bufp, &namestring, objfile);
 >  	      if (dn_bufp->dfunc.global)
 >  		add_psymbol_to_list (namestring, strlen (namestring),
 > @@ -1890,11 +1890,11 @@ hpread_build_psymtabs (objfile, mainline
 >  
 >  	    case DNTT_TYPE_DOC_FUNCTION:
 >  	      valu = dn_bufp->ddocfunc.hiaddr + ANOFFSET (objfile->section_offsets,
 > -							  SECT_OFF_TEXT);
 > +							  SECT_OFF_TEXT (objfile));
 >  	      if (valu > texthigh)
 >  		texthigh = valu;
 >  	      valu = dn_bufp->ddocfunc.lowaddr +
 > -		ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	      SET_NAMESTRING (dn_bufp, &namestring, objfile);
 >  	      if (dn_bufp->ddocfunc.global)
 >  		add_psymbol_to_list (namestring, strlen (namestring),
 > @@ -1984,7 +1984,7 @@ hpread_build_psymtabs (objfile, mainline
 >  		valu = dn_bufp->dsvar.location;
 >  		/* Relocate in case it's in a shared library */
 >  		if (storage == LOC_STATIC)
 > -		  valu += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +		  valu += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  
 >  		/* Luckily, dvar, svar, typedef, and tagdef all
 >  		   have their "global" bit in the same place, so it works
 > @@ -2208,7 +2208,7 @@ hpread_start_psymtab (objfile,
 >       struct partial_symbol **global_syms;
 >       struct partial_symbol **static_syms;
 >  {
 > -  int offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +  int offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >    extern void hpread_psymtab_to_symtab ();
 >    struct partial_symtab *result =
 >    start_psymtab_common (objfile, objfile->section_offsets,
 > @@ -2246,7 +2246,7 @@ hpread_end_psymtab (pst, include_list, n
 >  {
 >    int i;
 >    struct objfile *objfile = pst->objfile;
 > -  int offset = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT);
 > +  int offset = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile));
 >  
 >  #ifdef DUMPING
 >    /* Turn on to see what kind of a psymtab we've built. */
 > Index: hp-symtab-read.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/hp-symtab-read.c,v
 > retrieving revision 1.1.1.3
 > diff -u -p -r1.1.1.3 hp-symtab-read.c
 > --- hp-symtab-read.c	1999/08/16 19:52:47	1.1.1.3
 > +++ hp-symtab-read.c	2000/04/30 14:43:39
 > @@ -2823,8 +2823,8 @@ hpread_process_one_debug_symbol (dn_bufp
 >    unsigned long desc;
 >    int type;
 >    CORE_ADDR valu;
 > -  int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > -  int data_offset = ANOFFSET (section_offsets, SECT_OFF_DATA);
 > +  int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 > +  int data_offset = ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
 >    union dnttentry *dn_temp;
 >    dnttpointer hp_type;
 >    struct symbol *sym;
 > Index: hpread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/hpread.c,v
 > retrieving revision 1.1.1.3
 > diff -u -p -r1.1.1.3 hpread.c
 > --- hpread.c	1999/09/08 23:59:15	1.1.1.3
 > +++ hpread.c	2000/04/30 14:43:40
 > @@ -466,7 +466,7 @@ hpread_build_psymtabs (objfile, mainline
 >  		  past_first_source_file = 1;
 >  
 >  		valu = hpread_get_textlow (i, hp_symnum, objfile);
 > -		valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  		pst = hpread_start_psymtab (objfile,
 >  					    namestring, valu,
 >  					    (hp_symnum
 > @@ -484,7 +484,7 @@ hpread_build_psymtabs (objfile, mainline
 >  	         is supposed to be.  */
 >  	      SET_NAMESTRING (dn_bufp, &namestring, objfile);
 >  	      valu = hpread_get_textlow (i, hp_symnum, objfile);
 > -	      valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	      valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	      if (!pst)
 >  		{
 >  		  pst = hpread_start_psymtab (objfile,
 > @@ -502,11 +502,11 @@ hpread_build_psymtabs (objfile, mainline
 >  	      /* The beginning of a function.  DNTT_TYPE_ENTRY may also denote
 >  	         a secondary entry point.  */
 >  	      valu = dn_bufp->dfunc.hiaddr + ANOFFSET (objfile->section_offsets,
 > -						       SECT_OFF_TEXT);
 > +						       SECT_OFF_TEXT (objfile));
 >  	      if (valu > texthigh)
 >  		texthigh = valu;
 >  	      valu = dn_bufp->dfunc.lowaddr +
 > -		ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	      SET_NAMESTRING (dn_bufp, &namestring, objfile);
 >  	      add_psymbol_to_list (namestring, strlen (namestring),
 >  				   VAR_NAMESPACE, LOC_BLOCK,
 > @@ -1775,7 +1775,7 @@ hpread_process_one_debug_symbol (dn_bufp
 >    unsigned long desc;
 >    int type;
 >    CORE_ADDR valu;
 > -  int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +  int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >    union dnttentry *dn_temp;
 >    dnttpointer hp_type;
 >    struct symbol *sym;
 > Index: mdebugread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/mdebugread.c,v
 > retrieving revision 1.1.1.5
 > diff -u -p -r1.1.1.5 mdebugread.c
 > --- mdebugread.c	1999/09/08 23:59:21	1.1.1.5
 > +++ mdebugread.c	2000/04/30 14:43:40
 > @@ -384,7 +384,7 @@ static struct blockvector *
 >    new_bvect PARAMS ((int));
 >  
 >  static int
 > -parse_symbol PARAMS ((SYMR *, union aux_ext *, char *, int, struct section_offsets *));
 > +parse_symbol PARAMS ((SYMR *, union aux_ext *, char *, int, struct section_offsets *, struct objfile *));
 >  
 >  static struct type *
 >    parse_type PARAMS ((int, union aux_ext *, unsigned int, int *, int, char *));
 > @@ -716,12 +716,13 @@ add_pending (fh, sh, t)
 >     SYMR's handled (normally one).  */
 >  
 >  static int
 > -parse_symbol (sh, ax, ext_sh, bigend, section_offsets)
 > +parse_symbol (sh, ax, ext_sh, bigend, section_offsets, objfile)
 >       SYMR *sh;
 >       union aux_ext *ax;
 >       char *ext_sh;
 >       int bigend;
 >       struct section_offsets *section_offsets;
 > +     struct objfile *objfile;
 >  {
 >    const bfd_size_type external_sym_size = debug_swap->external_sym_size;
 >    void (*const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *)) =
 > @@ -753,18 +754,18 @@ parse_symbol (sh, ax, ext_sh, bigend, se
 >           The value of a stBlock symbol is the displacement from the
 >           procedure address.  */
 >        if (sh->st != stEnd && sh->st != stBlock)
 > -	sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +	sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >        break;
 >      case scData:
 >      case scSData:
 >      case scRData:
 >      case scPData:
 >      case scXData:
 > -      sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA);
 > +      sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
 >        break;
 >      case scBss:
 >      case scSBss:
 > -      sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS);
 > +      sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
 >        break;
 >      }
 >  
 > @@ -2042,7 +2043,7 @@ parse_procedure (pr, search_symtab, pst)
 >           procedure descriptor in e->pdr.adr.
 >           As the address in the procedure descriptor is usually relative,
 >           we would have to relocate e->pdr.adr with cur_fdr->adr and
 > -         ANOFFSET (pst->section_offsets, SECT_OFF_TEXT).
 > +         ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile)).
 >           Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
 >           in shared libraries on some systems, and on other systems
 >           e->pdr.adr is sometimes offset by a bogus value.
 > @@ -2102,13 +2103,14 @@ ecoff_relocate_efi (sym, delta)
 >  
 >     This routine clobbers top_stack->cur_block and ->cur_st. */
 >  
 > -static void parse_external PARAMS ((EXTR *, int, struct section_offsets *));
 > +static void parse_external PARAMS ((EXTR *, int, struct section_offsets *, struct objfile *));
 >  
 >  static void
 > -parse_external (es, bigend, section_offsets)
 > +parse_external (es, bigend, section_offsets, objfile)
 >       EXTR *es;
 >       int bigend;
 >       struct section_offsets *section_offsets;
 > +     struct objfile *objfile;
 >  {
 >    union aux_ext *ax;
 >  
 > @@ -2183,7 +2185,7 @@ parse_external (es, bigend, section_offs
 >  
 >        /* Note that the case of a symbol with indexNil must be handled
 >           anyways by parse_symbol().  */
 > -      parse_symbol (&es->asym, ax, (char *) NULL, bigend, section_offsets);
 > +      parse_symbol (&es->asym, ax, (char *) NULL, bigend, section_offsets, objfile);
 >        break;
 >      default:
 >        break;
 > @@ -2474,12 +2476,12 @@ parse_partial_symbols (objfile)
 >  	{
 >  	case stProc:
 >  	  /* Beginnning of Procedure */
 > -	  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	  break;
 >  	case stStaticProc:
 >  	  /* Load time only static procs */
 >  	  ms_type = mst_file_text;
 > -	  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	  break;
 >  	case stGlobal:
 >  	  /* External symbol */
 > @@ -2492,12 +2494,12 @@ parse_partial_symbols (objfile)
 >  	  else if (SC_IS_DATA (ext_in->asym.sc))
 >  	    {
 >  	      ms_type = mst_data;
 > -	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  	    }
 >  	  else if (SC_IS_BSS (ext_in->asym.sc))
 >  	    {
 >  	      ms_type = mst_bss;
 > -	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
 > +	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
 >  	    }
 >  	  else
 >  	    ms_type = mst_abs;
 > @@ -2507,17 +2509,17 @@ parse_partial_symbols (objfile)
 >  	  if (SC_IS_TEXT (ext_in->asym.sc))
 >  	    {
 >  	      ms_type = mst_file_text;
 > -	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	    }
 >  	  else if (SC_IS_DATA (ext_in->asym.sc))
 >  	    {
 >  	      ms_type = mst_file_data;
 > -	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  	    }
 >  	  else if (SC_IS_BSS (ext_in->asym.sc))
 >  	    {
 >  	      ms_type = mst_file_bss;
 > -	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
 > +	      svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
 >  	    }
 >  	  else
 >  	    ms_type = mst_abs;
 > @@ -2561,7 +2563,7 @@ parse_partial_symbols (objfile)
 >  	{
 >  	  textlow = fh->adr;
 >  	  if (relocatable || textlow != 0)
 > -	    textlow += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	    textlow += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	}
 >        else
 >  	textlow = 0;
 > @@ -2649,7 +2651,7 @@ parse_partial_symbols (objfile)
 >  		      CORE_ADDR procaddr;
 >  		      long isym;
 >  
 > -		      sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		      sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  		      if (sh.st == stStaticProc)
 >  			{
 >  			  namestring = debug_info->ss + fh->issBase + sh.iss;
 > @@ -2657,7 +2659,7 @@ parse_partial_symbols (objfile)
 >  							       sh.value,
 >  							       mst_file_text,
 >  							       NULL,
 > -							       SECT_OFF_TEXT,
 > +							       SECT_OFF_TEXT (objfile),
 >  							       NULL,
 >  							       objfile);
 >  			}
 > @@ -2700,12 +2702,12 @@ parse_partial_symbols (objfile)
 >  			case scPData:
 >  			case scXData:
 >  			  namestring = debug_info->ss + fh->issBase + sh.iss;
 > -			  sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +			  sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  			  prim_record_minimal_symbol_and_info (namestring,
 >  							       sh.value,
 >  							       mst_file_data,
 >  							       NULL,
 > -							       SECT_OFF_DATA,
 > +							       SECT_OFF_DATA (objfile),
 >  							       NULL,
 >  							       objfile);
 >  			  break;
 > @@ -2714,12 +2716,12 @@ parse_partial_symbols (objfile)
 >  			  /* FIXME!  Shouldn't this use cases for bss, 
 >  			     then have the default be abs? */
 >  			  namestring = debug_info->ss + fh->issBase + sh.iss;
 > -			  sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
 > +			  sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
 >  			  prim_record_minimal_symbol_and_info (namestring,
 >  							       sh.value,
 >  							       mst_file_bss,
 >  							       NULL,
 > -							       SECT_OFF_BSS,
 > +							       SECT_OFF_BSS (objfile),
 >  							       NULL,
 >  							       objfile);
 >  			  break;
 > @@ -2818,18 +2820,18 @@ parse_partial_symbols (objfile)
 >  		  /* The value of a stEnd symbol is the displacement from the
 >  		     corresponding start symbol value, do not relocate it.  */
 >  		  if (sh.st != stEnd)
 > -		    sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		    sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  		  break;
 >  		case scData:
 >  		case scSData:
 >  		case scRData:
 >  		case scPData:
 >  		case scXData:
 > -		  sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +		  sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  		  break;
 >  		case scBss:
 >  		case scSBss:
 > -		  sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
 > +		  sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
 >  		  break;
 >  		}
 >  
 > @@ -2842,7 +2844,7 @@ parse_partial_symbols (objfile)
 >  		case stStaticProc:
 >  		  prim_record_minimal_symbol_and_info (name, sh.value,
 >  						       mst_file_text, NULL,
 > -						       SECT_OFF_TEXT, NULL,
 > +						       SECT_OFF_TEXT (objfile), NULL,
 >  						       objfile);
 >  
 >  		  /* FALLTHROUGH */
 > @@ -2915,13 +2917,13 @@ parse_partial_symbols (objfile)
 >  		  if (SC_IS_DATA (sh.sc))
 >  		    prim_record_minimal_symbol_and_info (name, sh.value,
 >  							 mst_file_data, NULL,
 > -							 SECT_OFF_DATA,
 > +							 SECT_OFF_DATA (objfile),
 >  							 NULL,
 >  							 objfile);
 >  		  else
 >  		    prim_record_minimal_symbol_and_info (name, sh.value,
 >  							 mst_file_bss, NULL,
 > -							 SECT_OFF_BSS,
 > +							 SECT_OFF_BSS (objfile),
 >  							 NULL,
 >  							 objfile);
 >  		  class = LOC_STATIC;
 > @@ -3026,18 +3028,18 @@ parse_partial_symbols (objfile)
 >  		{
 >  		case scText:
 >  		case scRConst:
 > -		  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  		  break;
 >  		case scData:
 >  		case scSData:
 >  		case scRData:
 >  		case scPData:
 >  		case scXData:
 > -		  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +		  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  		  break;
 >  		case scBss:
 >  		case scSBss:
 > -		  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
 > +		  svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
 >  		  break;
 >  		}
 >  
 > @@ -3435,7 +3437,7 @@ psymtab_to_symtab_1 (pst, filename)
 >  	      else
 >  		{
 >  		  /* Handle encoded stab line number. */
 > -		  valu += ANOFFSET (pst->section_offsets, SECT_OFF_TEXT);
 > +		  valu += ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile));
 >  		  record_line (current_subfile, sh.index, valu);
 >  		}
 >  	    }
 > @@ -3446,7 +3448,7 @@ psymtab_to_symtab_1 (pst, filename)
 >  	  else
 >  	    complain (&stab_unknown_complaint, name);
 >  	}
 > -      st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT);
 > +      st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT (pst->objfile));
 >        end_stabs ();
 >  
 >        /* Sort the symbol table now, we are done adding symbols to it.
 > @@ -3561,7 +3563,7 @@ psymtab_to_symtab_1 (pst, filename)
 >  	      (*swap_sym_in) (cur_bfd, sym_ptr, &sh);
 >  	      c = parse_symbol (&sh,
 >  				debug_info->external_aux + fh->iauxBase,
 > -				sym_ptr, fh->fBigendian, pst->section_offsets);
 > +				sym_ptr, fh->fBigendian, pst->section_offsets, pst->objfile);
 >  	      sym_ptr += c * external_sym_size;
 >  	    }
 >  
 > @@ -3629,7 +3631,7 @@ psymtab_to_symtab_1 (pst, filename)
 >  
 >        ext_ptr = PST_PRIVATE (pst)->extern_tab;
 >        for (i = PST_PRIVATE (pst)->extern_count; --i >= 0; ext_ptr++)
 > -	parse_external (ext_ptr, fh->fBigendian, pst->section_offsets);
 > +	parse_external (ext_ptr, fh->fBigendian, pst->section_offsets, pst->objfile);
 >  
 >        /* If there are undefined symbols, tell the user.
 >           The alpha has an undefined symbol for every symbol that is
 > Index: minsyms.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/minsyms.c,v
 > retrieving revision 1.6
 > diff -u -p -r1.6 minsyms.c
 > --- minsyms.c	2000/04/19 21:13:09	1.6
 > +++ minsyms.c	2000/04/30 14:43:40
 > @@ -609,15 +609,15 @@ prim_record_minimal_symbol (name, addres
 >      case mst_text:
 >      case mst_file_text:
 >      case mst_solib_trampoline:
 > -      section = SECT_OFF_TEXT;
 > +      section = SECT_OFF_TEXT (objfile);
 >        break;
 >      case mst_data:
 >      case mst_file_data:
 > -      section = SECT_OFF_DATA;
 > +      section = SECT_OFF_DATA (objfile);
 >        break;
 >      case mst_bss:
 >      case mst_file_bss:
 > -      section = SECT_OFF_BSS;
 > +      section = SECT_OFF_BSS (objfile);
 >        break;
 >      default:
 >        section = -1;
 > Index: mipsread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/mipsread.c,v
 > retrieving revision 1.1.1.5
 > diff -u -p -r1.1.1.5 mipsread.c
 > --- mipsread.c	1999/09/08 23:59:22	1.1.1.5
 > +++ mipsread.c	2000/04/30 14:43:40
 > @@ -402,7 +402,7 @@ read_alphacoff_dynamic_symtab (section_o
 >  		ms_type = mst_text;
 >  	      else
 >  		ms_type = mst_file_text;
 > -	      sym_value += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +	      sym_value += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >  	    }
 >  	  else if (sym_shndx == SHN_MIPS_DATA)
 >  	    {
 > @@ -410,7 +410,7 @@ read_alphacoff_dynamic_symtab (section_o
 >  		ms_type = mst_data;
 >  	      else
 >  		ms_type = mst_file_data;
 > -	      sym_value += ANOFFSET (section_offsets, SECT_OFF_DATA);
 > +	      sym_value += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
 >  	    }
 >  	  else if (sym_shndx == SHN_MIPS_ACOMMON)
 >  	    {
 > @@ -418,7 +418,7 @@ read_alphacoff_dynamic_symtab (section_o
 >  		ms_type = mst_bss;
 >  	      else
 >  		ms_type = mst_file_bss;
 > -	      sym_value += ANOFFSET (section_offsets, SECT_OFF_BSS);
 > +	      sym_value += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
 >  	    }
 >  	  else if (sym_shndx == SHN_ABS)
 >  	    {
 > Index: objfiles.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/objfiles.c,v
 > retrieving revision 1.3
 > diff -u -p -r1.3 objfiles.c
 > --- objfiles.c	2000/03/15 16:55:07	1.3
 > +++ objfiles.c	2000/04/30 14:43:40
 > @@ -305,6 +305,14 @@ allocate_objfile (abfd, flags)
 >  	}
 >      }
 >  
 > +  /* Initialize the section indexes for this objfile, so that we can
 > +     later detect if they are used w/o being properly assigned to. */
 > +
 > +    objfile->sect_index_text = -1;
 > +    objfile->sect_index_data = -1;
 > +    objfile->sect_index_bss = -1;
 > +    objfile->sect_index_rodata = -1;
 > +
 >    /* Add this file onto the tail of the linked list of other such files. */
 >  
 >    objfile->next = NULL;
 > @@ -591,8 +599,8 @@ objfile_relocate (objfile, new_offsets)
 >  
 >      ALL_OBJFILE_PSYMTABS (objfile, p)
 >      {
 > -      p->textlow += ANOFFSET (delta, SECT_OFF_TEXT);
 > -      p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT);
 > +      p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 > +      p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 >      }
 >    }
 >  
 > @@ -643,41 +651,41 @@ objfile_relocate (objfile, new_offsets)
 >  
 >  	if (flags & SEC_CODE)
 >  	  {
 > -	    s->addr += ANOFFSET (delta, SECT_OFF_TEXT);
 > -	    s->endaddr += ANOFFSET (delta, SECT_OFF_TEXT);
 > +	    s->addr += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 > +	    s->endaddr += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 >  	  }
 >  	else if (flags & (SEC_DATA | SEC_LOAD))
 >  	  {
 > -	    s->addr += ANOFFSET (delta, SECT_OFF_DATA);
 > -	    s->endaddr += ANOFFSET (delta, SECT_OFF_DATA);
 > +	    s->addr += ANOFFSET (delta, SECT_OFF_DATA (objfile));
 > +	    s->endaddr += ANOFFSET (delta, SECT_OFF_DATA (objfile));
 >  	  }
 >  	else if (flags & SEC_ALLOC)
 >  	  {
 > -	    s->addr += ANOFFSET (delta, SECT_OFF_BSS);
 > -	    s->endaddr += ANOFFSET (delta, SECT_OFF_BSS);
 > +	    s->addr += ANOFFSET (delta, SECT_OFF_BSS (objfile));
 > +	    s->endaddr += ANOFFSET (delta, SECT_OFF_BSS (objfile));
 >  	  }
 >        }
 >    }
 >  
 >    if (objfile->ei.entry_point != ~(CORE_ADDR) 0)
 > -    objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT);
 > +    objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 >  
 >    if (objfile->ei.entry_func_lowpc != INVALID_ENTRY_LOWPC)
 >      {
 > -      objfile->ei.entry_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT);
 > -      objfile->ei.entry_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT);
 > +      objfile->ei.entry_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 > +      objfile->ei.entry_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 >      }
 >  
 >    if (objfile->ei.entry_file_lowpc != INVALID_ENTRY_LOWPC)
 >      {
 > -      objfile->ei.entry_file_lowpc += ANOFFSET (delta, SECT_OFF_TEXT);
 > -      objfile->ei.entry_file_highpc += ANOFFSET (delta, SECT_OFF_TEXT);
 > +      objfile->ei.entry_file_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 > +      objfile->ei.entry_file_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 >      }
 >  
 >    if (objfile->ei.main_func_lowpc != INVALID_ENTRY_LOWPC)
 >      {
 > -      objfile->ei.main_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT);
 > -      objfile->ei.main_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT);
 > +      objfile->ei.main_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 > +      objfile->ei.main_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
 >      }
 >  
 >    /* Relocate breakpoints as necessary, after things are relocated. */
 > Index: objfiles.h
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/objfiles.h,v
 > retrieving revision 1.2
 > diff -u -p -r1.2 objfiles.h
 > --- objfiles.h	2000/03/07 04:33:52	1.2
 > +++ objfiles.h	2000/04/30 14:43:40
 > @@ -372,6 +372,18 @@ struct objfile
 >      struct section_offsets *section_offsets;
 >      int num_sections;
 >  
 > +    /* Indexes in the section_offsets array. These are initialized by the
 > +       *_symfile_offsets() family of functions (som_symfile_offsets,
 > +       xcoff_symfile_offsets, default_symfile_offsets). In theory they
 > +       should correspond to the section indexes used by bfd for the
 > +       current objfile. The exception to this for the time being is the
 > +       SOM version. */
 > +
 > +    int sect_index_text;
 > +    int sect_index_data;
 > +    int sect_index_bss;
 > +    int sect_index_rodata;
 > +
 >      /* These pointers are used to locate the section table, which
 >         among other things, is used to map pc addresses into sections.
 >         SECTIONS points to the first entry in the table, and
 > @@ -583,5 +595,21 @@ is_in_import_list PARAMS ((char *, struc
 >  #define ALL_OBJSECTIONS(objfile, osect)		\
 >    ALL_OBJFILES (objfile)			\
 >      ALL_OBJFILE_OSECTIONS (objfile, osect)
 > +
 > +#define SECT_OFF_DATA(objfile) \
 > +     ((objfile->sect_index_data == -1) ? \
 > +      (internal_error ("sect_index_data not initialized"), -1) : objfile->sect_index_data)
 > +
 > +#define SECT_OFF_RODATA(objfile) \
 > +     ((objfile->sect_index_rodata == -1) ? \
 > +      (internal_error ("sect_index_rodata not initialized"), -1) : objfile->sect_index_rodata)
 > +
 > +#define SECT_OFF_TEXT(objfile) \
 > +     ((objfile->sect_index_text == -1) ? \
 > +      (internal_error ("sect_index_text not initialized"), -1) : objfile->sect_index_text)
 > +
 > +#define SECT_OFF_BSS(objfile) \
 > +     ((objfile->sect_index_bss == -1) ? \
 > +      (internal_error ("sect_index_bss not initialized"), -1) : objfile->sect_index_bss)
 >  
 >  #endif /* !defined (OBJFILES_H) */
 > Index: os9kread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/os9kread.c,v
 > retrieving revision 1.1.1.6
 > diff -u -p -r1.1.1.6 os9kread.c
 > --- os9kread.c	1999/09/08 23:59:23	1.1.1.6
 > +++ os9kread.c	2000/04/30 14:43:40
 > @@ -208,7 +208,7 @@ record_minimal_symbol (name, address, ty
 >      {
 >      case N_TEXT:
 >        ms_type = mst_text;
 > -      address += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +      address += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >        break;
 >      case N_DATA:
 >        ms_type = mst_data;
 > @@ -608,7 +608,7 @@ read_os9k_psymtab (objfile, text_addr, t
 >  #ifdef END_OF_TEXT_DEFAULT
 >    end_of_text_addr = END_OF_TEXT_DEFAULT;
 >  #else
 > -  end_of_text_addr = text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT)
 > +  end_of_text_addr = text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))
 >      + text_size;		/* Relocate */
 >  #endif
 >  
 > @@ -655,7 +655,7 @@ read_os9k_psymtab (objfile, text_addr, t
 >  	  continue;
 >  
 >  	case N_SYM_SE:
 > -	  CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	  CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	  if (psymfile_depth == 1 && pst)
 >  	    {
 >  	      os9k_end_psymtab (pst, psymtab_include_list, includes_used,
 > @@ -692,7 +692,7 @@ read_os9k_psymtab (objfile, text_addr, t
 >  
 >  		valu = CUR_SYMBOL_VALUE;
 >  		if (valu)
 > -		  valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +		  valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  		past_first_source_file = 1;
 >  
 >  		p = strchr (namestring, ':');
 > @@ -884,7 +884,7 @@ read_os9k_psymtab (objfile, text_addr, t
 >  	      continue;
 >  
 >  	    case 'f':
 > -	      CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	      CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	      if (pst && pst->textlow == 0)
 >  		pst->textlow = CUR_SYMBOL_VALUE;
 >  
 > @@ -895,7 +895,7 @@ read_os9k_psymtab (objfile, text_addr, t
 >  	      continue;
 >  
 >  	    case 'F':
 > -	      CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	      CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  	      if (pst && pst->textlow == 0)
 >  		pst->textlow = CUR_SYMBOL_VALUE;
 >  
 > @@ -933,7 +933,7 @@ read_os9k_psymtab (objfile, text_addr, t
 >  	    }
 >  
 >  	case N_SYM_RBRAC:
 > -	  CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	  CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  #ifdef HANDLE_RBRAC
 >  	  HANDLE_RBRAC (CUR_SYMBOL_VALUE);
 >  	  continue;
 > @@ -1423,7 +1423,7 @@ os9k_read_ofile_symtab (pst)
 >       which comes from pst->textlow is correct. */
 >    if (last_source_start_addr == 0)
 >      last_source_start_addr = text_offset;
 > -  pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT);
 > +  pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
 >    end_stabs ();
 >  }
 >  
 > @@ -1473,12 +1473,12 @@ os9k_process_one_symbol (type, desc, val
 >      case N_SYM_LBRAC:
 >        /* On most machines, the block addresses are relative to the
 >           N_SO, the linker did not relocate them (sigh).  */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >        new = push_context (desc, valu);
 >        break;
 >  
 >      case N_SYM_RBRAC:
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >        new = pop_context ();
 >  
 >  #if !defined (OS9K_VARIABLES_INSIDE_BLOCK)
 > @@ -1547,7 +1547,7 @@ os9k_process_one_symbol (type, desc, val
 >           one line-number -- core-address correspondence.
 >           Enter it in the line list for this symbol table. */
 >        /* Relocate for dynamic loading and for ELF acc fn-relative syms.  */
 > -      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >        /* FIXME: loses if sizeof (char *) > sizeof (int) */
 >        record_line (current_subfile, (int) name, valu);
 >        break;
 > @@ -1570,7 +1570,7 @@ os9k_process_one_symbol (type, desc, val
 >  	  switch (deftype)
 >  	    {
 >  	    case 'S':
 > -	      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +	      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >  	      n = strrchr (name, '/');
 >  	      if (n != NULL)
 >  		{
 > @@ -1588,7 +1588,7 @@ os9k_process_one_symbol (type, desc, val
 >  		{
 >  		  if (last_source_file)
 >  		    {
 > -		      end_symtab (valu, objfile, SECT_OFF_TEXT);
 > +		      end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));
 >  		      end_stabs ();
 >  		    }
 >  		  start_stabs ();
 > @@ -1605,7 +1605,7 @@ os9k_process_one_symbol (type, desc, val
 >  
 >  	    case 'f':
 >  	    case 'F':
 > -	      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
 > +	      valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
 >  	      function_stab_type = type;
 >  
 >  	      within_function = 1;
 > @@ -1615,7 +1615,7 @@ os9k_process_one_symbol (type, desc, val
 >  
 >  	    case 'V':
 >  	    case 'v':
 > -	      valu += ANOFFSET (section_offsets, SECT_OFF_DATA);
 > +	      valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
 >  	      define_symbol (valu, name, desc, type, objfile);
 >  	      break;
 >  
 > Index: pa64solib.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/pa64solib.c,v
 > retrieving revision 1.2
 > diff -u -p -r1.2 pa64solib.c
 > --- pa64solib.c	2000/04/27 15:11:13	1.2
 > +++ pa64solib.c	2000/04/30 14:43:40
 > @@ -328,9 +328,9 @@ pa64_solib_load_symbols (so, name, from_
 >        return;
 >      }
 >  
 > -  ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT)
 > +  ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT (so->objfile))
 >      = so->pa64_solib_desc.text_base;
 > -  ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA)
 > +  ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA (so->objfile))
 >      = so->pa64_solib_desc.data_base;
 >  
 >    /* Relocate all the sections based on where they got loaded.  */
 > @@ -338,13 +338,13 @@ pa64_solib_load_symbols (so, name, from_
 >      {
 >        if (p->the_bfd_section->flags & SEC_CODE)
 >  	{
 > -	  p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT);
 > -	  p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT);
 > +	  p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT (so->objfile));
 > +	  p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT (so->objfile));
 >  	}
 >        else if (p->the_bfd_section->flags & SEC_DATA)
 >  	{
 > -	  p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA);
 > -	  p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA);
 > +	  p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA (so->objfile));
 > +	  p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA (so->objfile));
 >  	}
 >      }
 >  
 > Index: partial-stab.h
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/partial-stab.h,v
 > retrieving revision 1.2
 > diff -u -p -r1.2 partial-stab.h
 > --- partial-stab.h	2000/03/28 17:44:53	1.2
 > +++ partial-stab.h	2000/04/30 14:43:40
 > @@ -46,19 +46,19 @@ switch (CUR_SYMBOL_TYPE)
 >  
 >    case N_TEXT | N_EXT:
 >    case N_NBTEXT | N_EXT:
 > -    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >      goto record_it;
 >  
 >    case N_DATA | N_EXT:
 >    case N_NBDATA | N_EXT:
 > -    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >      goto record_it;
 >  
 >    case N_BSS:
 >    case N_BSS | N_EXT:
 >    case N_NBBSS | N_EXT:
 >    case N_SETV | N_EXT:		/* FIXME, is this in BSS? */
 > -    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
 > +    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
 >      goto record_it;
 >  
 >    case N_ABS | N_EXT:
 > @@ -85,7 +85,7 @@ switch (CUR_SYMBOL_TYPE)
 >    case N_FN_SEQ:
 >    case N_TEXT:
 >  #ifdef DBXREAD_ONLY
 > -    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >      SET_NAMESTRING ();
 >      if ((namestring[0] == '-' && namestring[1] == 'l')
 >  	|| (namestring[(nsl = strlen (namestring)) - 1] == 'o'
 > @@ -121,7 +121,7 @@ switch (CUR_SYMBOL_TYPE)
 >      continue;
 >  
 >    case N_DATA:
 > -    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +    CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >      goto record_it;
 >  
 >    case N_UNDF | N_EXT:
 > @@ -203,7 +203,7 @@ switch (CUR_SYMBOL_TYPE)
 >        char *p;
 >        int prev_textlow_not_set;
 >  
 > -      valu = CUR_SYMBOL_VALUE + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +      valu = CUR_SYMBOL_VALUE + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  
 >        prev_textlow_not_set = textlow_not_set;
 >  
 > @@ -423,7 +423,7 @@ switch (CUR_SYMBOL_TYPE)
 >      switch (p[1])
 >        {
 >        case 'S':
 > -	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  #ifdef STATIC_TRANSFORM_NAME
 >  	namestring = STATIC_TRANSFORM_NAME (namestring);
 >  #endif
 > @@ -434,7 +434,7 @@ switch (CUR_SYMBOL_TYPE)
 >  			     psymtab_language, objfile);
 >  	continue;
 >        case 'G':
 > -	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
 > +	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
 >  	/* The addresses in these entries are reported to be
 >  	   wrong.  See the code that reads 'G's for symtabs. */
 >  	add_psymbol_to_list (namestring, p - namestring,
 > @@ -575,7 +575,7 @@ switch (CUR_SYMBOL_TYPE)
 >  	continue;
 >  
 >        case 'f':
 > -	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  #ifdef DBXREAD_ONLY
 >  	/* Kludges for ELF/STABS with Sun ACC */
 >  	last_function_name = namestring;
 > @@ -602,7 +602,7 @@ switch (CUR_SYMBOL_TYPE)
 >  	if (textlow_not_set
 >  	    || (CUR_SYMBOL_VALUE < pst->textlow
 >  		&& CUR_SYMBOL_VALUE
 > -		!= ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT)))
 > +		!= ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))))
 >  	  {
 >  	    pst->textlow = CUR_SYMBOL_VALUE;
 >  	    textlow_not_set = 0;
 > @@ -619,7 +619,7 @@ switch (CUR_SYMBOL_TYPE)
 >  	   are put into the global psymtab like one would expect.
 >  	   They're also in the minimal symbol table.  */
 >        case 'F':
 > -	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
 > +	CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 >  #ifdef DBXREAD_ONLY
 >  	/* Kludges for ELF/STABS with Sun ACC */
 >  	last_function_name = namestring;
 > @@ -627,7 +627,7 @@ switch (CUR_SYMBOL_TYPE)
 >  	/* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
 >  	   value for the bottom of the text seg in those cases. */
 >  	if (CUR_SYMBOL_VALUE == ANOFFSET (objfile->section_offsets, 
 > -	                                  SECT_OFF_TEXT))
 > +	                                  SECT_OFF_TEXT (objfile)))
 >  	  CUR_SYMBOL_VALUE = 
 >  	    find_stab_function_addr (namestring, pst->filename, objfile);
 >  	if (pst && textlow_not_set)
 > @@ -649,7 +649,7 @@ switch (CUR_SYMBOL_TYPE)
 >  	if (textlow_not_set
 >  	    || (CUR_SYMBOL_VALUE < pst->textlow
 >  		&& CUR_SYMBOL_VALUE
 > -		!= ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT)))
 > +		!= ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))))
 >  	  {
 >  	    pst->textlow = CUR_SYMBOL_VALUE;
 >  	    textlow_not_set = 0;
 > Index: remote-os9k.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/remote-os9k.c,v
 > retrieving revision 1.2
 > diff -u -p -r1.2 remote-os9k.c
 > --- remote-os9k.c	2000/02/09 08:52:47	1.2
 > +++ remote-os9k.c	2000/04/30 14:43:40
 > @@ -514,8 +514,8 @@ rombug_wait (pid, status)
 >  	new_symfile_objfile (obj_sec->objfile, 1, 0);
 >        offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
 >        memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
 > -      ANOFFSET (offs, SECT_OFF_DATA) = addr;
 > -      ANOFFSET (offs, SECT_OFF_BSS) = addr;
 > +      ANOFFSET (offs, SECT_OFF_DATA (symfile_objfile)) = addr;
 > +      ANOFFSET (offs, SECT_OFF_BSS (symfile_objfile)) = addr;
 >  
 >        objfile_relocate (symfile_objfile, offs);
 >      }
 > Index: remote-vx.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/remote-vx.c,v
 > retrieving revision 1.2
 > diff -u -p -r1.2 remote-vx.c
 > --- remote-vx.c	2000/02/09 08:52:47	1.2
 > +++ remote-vx.c	2000/04/30 14:43:40
 > @@ -717,9 +717,9 @@ vx_add_symbols (name, from_tty, text_add
 >    bfd_map_over_sections (objfile->obfd, find_sect, &ss);
 >  
 >    /* Both COFF and b.out frontends use these SECT_OFF_* values.  */
 > -  ANOFFSET (offs, SECT_OFF_TEXT) = text_addr - ss.text_start;
 > -  ANOFFSET (offs, SECT_OFF_DATA) = data_addr - ss.data_start;
 > -  ANOFFSET (offs, SECT_OFF_BSS) = bss_addr - ss.bss_start;
 > +  ANOFFSET (offs, SECT_OFF_TEXT (so->objfile)) = text_addr - ss.text_start;
 > +  ANOFFSET (offs, SECT_OFF_DATA (so->objfile)) = data_addr - ss.data_start;
 > +  ANOFFSET (offs, SECT_OFF_BSS (so->objfile)) = bss_addr - ss.bss_start;
 >    objfile_relocate (objfile, offs);
 >  }
 >  
 > Index: remote.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/remote.c,v
 > retrieving revision 1.8
 > diff -u -p -r1.8 remote.c
 > --- remote.c	2000/04/17 02:27:37	1.8
 > +++ remote.c	2000/04/30 14:43:40
 > @@ -1803,14 +1803,14 @@ get_offsets ()
 >    offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
 >    memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
 >  
 > -  ANOFFSET (offs, SECT_OFF_TEXT) = text_addr;
 > +  ANOFFSET (offs, SECT_OFF_TEXT (symfile_objfile)) = text_addr;
 >  
 >    /* This is a temporary kludge to force data and bss to use the same offsets
 >       because that's what nlmconv does now.  The real solution requires changes
 >       to the stub and remote.c that I don't have time to do right now.  */
 >  
 > -  ANOFFSET (offs, SECT_OFF_DATA) = data_addr;
 > -  ANOFFSET (offs, SECT_OFF_BSS) = data_addr;
 > +  ANOFFSET (offs, SECT_OFF_DATA (symfile_objfile)) = data_addr;
 > +  ANOFFSET (offs, SECT_OFF_BSS (symfile_objfile)) = data_addr;
 >  
 >    objfile_relocate (symfile_objfile, offs);
 >  }
 > @@ -1918,9 +1918,9 @@ remote_cisco_objfile_relocate (text_off,
 >        offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
 >        memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
 >  
 > -      ANOFFSET (offs, SECT_OFF_TEXT) = text_off;
 > -      ANOFFSET (offs, SECT_OFF_DATA) = data_off;
 > -      ANOFFSET (offs, SECT_OFF_BSS) = bss_off;
 > +      ANOFFSET (offs, SECT_OFF_TEXT (symfile_objfile)) = text_off;
 > +      ANOFFSET (offs, SECT_OFF_DATA (symfile_objfile)) = data_off;
 > +      ANOFFSET (offs, SECT_OFF_BSS (symfile_objfile)) = bss_off;
 >  
 >        /* First call the standard objfile_relocate.  */
 >        objfile_relocate (symfile_objfile, offs);
 > Index: rs6000-nat.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
 > retrieving revision 1.4
 > diff -u -p -r1.4 rs6000-nat.c
 > --- rs6000-nat.c	2000/04/25 17:55:36	1.4
 > +++ rs6000-nat.c	2000/04/30 14:43:40
 > @@ -357,9 +357,9 @@ vmap_symtab (vp)
 >  
 >    /* The symbols in the object file are linked to the VMA of the section,
 >       relocate them VMA relative.  */
 > -  ANOFFSET (new_offsets, SECT_OFF_TEXT) = vp->tstart - vp->tvma;
 > -  ANOFFSET (new_offsets, SECT_OFF_DATA) = vp->dstart - vp->dvma;
 > -  ANOFFSET (new_offsets, SECT_OFF_BSS) = vp->dstart - vp->dvma;
 > +  ANOFFSET (new_offsets, SECT_OFF_TEXT (objfile)) = vp->tstart - vp->tvma;
 > +  ANOFFSET (new_offsets, SECT_OFF_DATA (objfile)) = vp->dstart - vp->dvma;
 > +  ANOFFSET (new_offsets, SECT_OFF_BSS (objfile)) = vp->dstart - vp->dvma;
 >  
 >    objfile_relocate (objfile, new_offsets);
 >  }
 > Index: somread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/somread.c,v
 > retrieving revision 1.2
 > diff -u -p -r1.2 somread.c
 > --- somread.c	2000/04/21 14:24:45	1.2
 > +++ somread.c	2000/04/30 14:43:40
 > @@ -471,10 +471,24 @@ som_symfile_offsets (objfile, addrs)
 >    objfile->section_offsets = (struct section_offsets *)
 >      obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
 >  
 > +  /* FIXME: ezannoni 2000-04-20 The section names in SOM are not
 > +     .text, .data, etc, but $TEXT$, $DATA$,... We should initialize
 > +     SET_OFF_* from bfd. (See default_symfile_offsets()). But I don't
 > +     know the correspondence between SOM sections and GDB's idea of
 > +     section names. So for now we default to what is was before these
 > +     changes.*/
 > +  objfile->sect_index_text = 0;
 > +  objfile->sect_index_data = 1;
 > +  objfile->sect_index_bss = 2;
 > +  objfile->sect_index_rodata = 3;
 > +
 >    /* First see if we're a shared library.  If so, get the section
 >       offsets from the library, else get them from addrs.  */
 >    if (!som_solib_section_offsets (objfile, objfile->section_offsets))
 >      {
 > +      /* Note: Here is OK to compare with ".text" because this is the
 > +         name that gdb itself gives to that section, not the SOM
 > +         name. */
 >        for (i = 0; i < SECT_OFF_MAX && addrs->other[i].name; i++)
 >  	if (strcmp (addrs->other[i].name, ".text") == 0)
 >  	  break;
 > Index: somsolib.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/somsolib.c,v
 > retrieving revision 1.2
 > diff -u -p -r1.2 somsolib.c
 > --- somsolib.c	2000/04/21 14:24:45	1.2
 > +++ somsolib.c	2000/04/30 14:43:40
 > @@ -355,13 +355,13 @@ som_solib_load_symbols (so, name, from_t
 >      {
 >        if (p->the_bfd_section->flags & SEC_CODE)
 >  	{
 > -	  p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT);
 > -	  p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT);
 > +	  p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT (so->objfile));
 > +	  p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT (so->objfile));
 >  	}
 >        else if (p->the_bfd_section->flags & SEC_DATA)
 >  	{
 > -	  p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA);
 > -	  p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA);
 > +	  p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA (so->objfile));
 > +	  p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA (so->objfile));
 >  	}
 >      }
 >  
 > @@ -1407,11 +1407,11 @@ som_solib_section_offsets (objfile, offs
 >  	  asection *private_section;
 >  
 >  	  /* The text offset is easy.  */
 > -	  ANOFFSET (offsets, SECT_OFF_TEXT)
 > +	  ANOFFSET (offsets, SECT_OFF_TEXT (objfile))
 >  	    = (so_list->som_solib.text_addr
 >  	       - so_list->som_solib.text_link_addr);
 > -	  ANOFFSET (offsets, SECT_OFF_RODATA)
 > -	    = ANOFFSET (offsets, SECT_OFF_TEXT);
 > +	  ANOFFSET (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.  */
 > @@ -1420,14 +1420,14 @@ som_solib_section_offsets (objfile, offs
 >  	  if (!private_section)
 >  	    {
 >  	      warning ("Unable to find $PRIVATE$ in shared library!");
 > -	      ANOFFSET (offsets, SECT_OFF_DATA) = 0;
 > -	      ANOFFSET (offsets, SECT_OFF_BSS) = 0;
 > +	      ANOFFSET (offsets, SECT_OFF_DATA (objfile)) = 0;
 > +	      ANOFFSET (offsets, SECT_OFF_BSS (objfile)) = 0;
 >  	      return 1;
 >  	    }
 > -	  ANOFFSET (offsets, SECT_OFF_DATA)
 > +	  ANOFFSET (offsets, SECT_OFF_DATA (objfile))
 >  	    = (so_list->som_solib.data_start - private_section->vma);
 > -	  ANOFFSET (offsets, SECT_OFF_BSS)
 > -	    = ANOFFSET (offsets, SECT_OFF_DATA);
 > +	  ANOFFSET (offsets, SECT_OFF_BSS (objfile))
 > +	    = ANOFFSET (offsets, SECT_OFF_DATA (objfile));
 >  	  return 1;
 >  	}
 >        so_list = so_list->next;
 > Index: stabsread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/stabsread.c,v
 > retrieving revision 1.3
 > diff -u -p -r1.3 stabsread.c
 > --- stabsread.c	2000/04/22 06:44:39	1.3
 > +++ stabsread.c	2000/04/30 14:43:41
 > @@ -1351,13 +1351,13 @@ define_symbol (valu, string, desc, type,
 >    switch (type & N_TYPE)
 >      {
 >      case N_TEXT:
 > -      SYMBOL_SECTION (sym) = SECT_OFF_TEXT;
 > +      SYMBOL_SECTION (sym) = SECT_OFF_TEXT (objfile);
 >        break;
 >      case N_DATA:
 > -      SYMBOL_SECTION (sym) = SECT_OFF_DATA;
 > +      SYMBOL_SECTION (sym) = SECT_OFF_DATA (objfile);
 >        break;
 >      case N_BSS:
 > -      SYMBOL_SECTION (sym) = SECT_OFF_BSS;
 > +      SYMBOL_SECTION (sym) = SECT_OFF_BSS (objfile);
 >        break;
 >      }
 >  
 > Index: symfile.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/symfile.c,v
 > retrieving revision 1.7
 > diff -u -p -r1.7 symfile.c
 > --- symfile.c	2000/04/17 16:09:04	1.7
 > +++ symfile.c	2000/04/30 14:43:41
 > @@ -518,33 +518,49 @@ default_symfile_offsets (objfile, addrs)
 >       struct section_addr_info *addrs;
 >  {
 >    int i;
 > +  asection *sect = NULL;
 >  
 >    objfile->num_sections = SECT_OFF_MAX;
 >    objfile->section_offsets = (struct section_offsets *)
 >      obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
 >    memset (objfile->section_offsets, 0, SIZEOF_SECTION_OFFSETS);
 >  
 > -  /* Now calculate offsets for other sections. */
 > +  /* Now calculate offsets for section that were specified by the
 > +     caller. */
 >    for (i = 0; i < MAX_SECTIONS && addrs->other[i].name; i++)
 >      {
 >        struct other_sections *osp ;
 >  
 >        osp = &addrs->other[i] ;
 > -      if (addrs->other[i].addr == 0)
 > +      if (osp->addr == 0)
 >    	continue;
 > -#if 0
 > -      if (strcmp (".text", osp->name) == 0)
 > -	SECT_OFF_TEXT = osp->sectindex ;
 > -      else if (strcmp (".data", osp->name) == 0)
 > -	SECT_OFF_DATA = osp->sectindex ;
 > -      else if (strcmp (".bss", osp->name) == 0)
 > -	SECT_OFF_BSS =  osp->sectindex ;
 > -#endif
 > +
 >        /* Record all sections in offsets */
 > +      /* The section_offsets in the objfile are here filled in using
 > +         the BFD index. */
 >        ANOFFSET (objfile->section_offsets, osp->sectindex) = osp->addr;
 >      }
 > -}
 >  
 > +  /* Remember the bfd indexes for the .text, .data, .bss and
 > +     .rodata sections. */
 > +
 > +  sect = bfd_get_section_by_name (objfile->obfd, ".text");
 > +  if (sect) 
 > +    objfile->sect_index_text = sect->index;
 > +
 > +  sect = bfd_get_section_by_name (objfile->obfd, ".data");
 > +  if (sect) 
 > +    objfile->sect_index_data = sect->index;
 > +
 > +  sect = bfd_get_section_by_name (objfile->obfd, ".bss");
 > +  if (sect) 
 > +    objfile->sect_index_bss = sect->index;
 > +
 > +  sect = bfd_get_section_by_name (objfile->obfd, ".rodata");
 > +  if (sect) 
 > +    objfile->sect_index_rodata = sect->index;
 > +
 > +}
 >  
 >  /* Process a symbol file, as either the main file or as a dynamically
 >     loaded file.
 > @@ -631,12 +647,12 @@ syms_from_objfile (objfile, addrs, mainl
 >        if (lower_sect == NULL)
 >  	warning ("no loadable sections found in added symbol-file %s",
 >  		 objfile->name);
 > -      else if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE)
 > -	       == 0)
 > -	warning ("Lowest section in %s is %s at %s",
 > -		 objfile->name,
 > -		 bfd_section_name (objfile->obfd, lower_sect),
 > -		 paddr (bfd_section_vma (objfile->obfd, lower_sect)));
 > +      else 
 > +	if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) == 0)
 > +	  warning ("Lowest section in %s is %s at %s",
 > +		   objfile->name,
 > +		   bfd_section_name (objfile->obfd, lower_sect),
 > +		   paddr (bfd_section_vma (objfile->obfd, lower_sect)));
 >        if (lower_sect != NULL)
 >   	lower_offset = bfd_section_vma (objfile->obfd, lower_sect);
 >        else
 > Index: xcoffread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/xcoffread.c,v
 > retrieving revision 1.1.1.9
 > diff -u -p -r1.1.1.9 xcoffread.c
 > --- xcoffread.c	1999/12/07 03:56:07	1.1.1.9
 > +++ xcoffread.c	2000/04/30 14:43:41
 > @@ -275,6 +275,7 @@ struct find_targ_sec_arg
 >      int targ_index;
 >      int *resultp;
 >      asection **bfd_sect;
 > +    struct objfile *objfile;
 >    };
 >  
 >  static void find_targ_sec PARAMS ((bfd *, asection *, void *));
 > @@ -286,15 +287,16 @@ find_targ_sec (abfd, sect, obj)
 >       PTR obj;
 >  {
 >    struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
 > +  struct objfile *objfile = args->objfile;
 >    if (sect->target_index == args->targ_index)
 >      {
 >        /* This is the section.  Figure out what SECT_OFF_* code it is.  */
 >        if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
 > -	*args->resultp = SECT_OFF_TEXT;
 > +	*args->resultp = SECT_OFF_TEXT (objfile);
 >        else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
 > -	*args->resultp = SECT_OFF_DATA;
 > +	*args->resultp = SECT_OFF_DATA (objfile);
 >        else
 > -	*args->resultp = SECT_OFF_BSS;
 > +	*args->resultp = SECT_OFF_BSS (objfile);
 >        *args->bfd_sect = sect;
 >      }
 >  }
 > @@ -305,12 +307,13 @@ secnum_to_section (secnum, objfile)
 >       int secnum;
 >       struct objfile *objfile;
 >  {
 > -  int off = SECT_OFF_TEXT;
 > +  int off = SECT_OFF_TEXT (objfile);
 >    asection *sect = NULL;
 >    struct find_targ_sec_arg args;
 >    args.targ_index = secnum;
 >    args.resultp = &off;
 >    args.bfd_sect = §
 > +  args.objfile = objfile;
 >    bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
 >    return off;
 >  }
 > @@ -321,7 +324,7 @@ secnum_to_bfd_section (secnum, objfile)
 >       int secnum;
 >       struct objfile *objfile;
 >  {
 > -  int off = SECT_OFF_TEXT;
 > +  int off = SECT_OFF_TEXT (objfile);
 >    asection *sect = NULL;
 >    struct find_targ_sec_arg args;
 >    args.targ_index = secnum;
 > @@ -849,7 +852,7 @@ enter_line_range (subfile, beginoffset, 
 >  	      ? int_lnno.l_addr.l_paddr
 >  	      : read_symbol_nvalue (int_lnno.l_addr.l_symndx));
 >        addr += ANOFFSET (this_symtab_psymtab->objfile->section_offsets,
 > -			SECT_OFF_TEXT);
 > +			SECT_OFF_TEXT (this_symtab_psymtab->objfile));
 >  
 >        if (addr < startaddr || (endaddr && addr >= endaddr))
 >  	return;
 > @@ -1095,7 +1098,7 @@ read_xcoff_symtab (pst)
 >  	  if (last_source_file)
 >  	    {
 >  	      pst->symtab =
 > -		end_symtab (cur_src_end_addr, objfile, SECT_OFF_TEXT);
 > +		end_symtab (cur_src_end_addr, objfile, SECT_OFF_TEXT (objfile));
 >  	      end_stabs ();
 >  	    }
 >  
 > @@ -1160,7 +1163,7 @@ read_xcoff_symtab (pst)
 >  			{
 >  			  complete_symtab (filestring, file_start_addr);
 >  			  cur_src_end_addr = file_end_addr;
 > -			  end_symtab (file_end_addr, objfile, SECT_OFF_TEXT);
 > +			  end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
 >  			  end_stabs ();
 >  			  start_stabs ();
 >  			  /* Give all csects for this source file the same
 > @@ -1180,7 +1183,7 @@ read_xcoff_symtab (pst)
 >  
 >  		      file_start_addr =
 >  			cs->c_value + ANOFFSET (objfile->section_offsets,
 > -						SECT_OFF_TEXT);
 > +						SECT_OFF_TEXT (objfile));
 >  		      file_end_addr = file_start_addr + CSECT_LEN (&main_aux);
 >  
 >  		      if (cs->c_name && cs->c_name[0] == '.')
 > @@ -1276,7 +1279,7 @@ read_xcoff_symtab (pst)
 >  
 >  	  complete_symtab (filestring, file_start_addr);
 >  	  cur_src_end_addr = file_end_addr;
 > -	  end_symtab (file_end_addr, objfile, SECT_OFF_TEXT);
 > +	  end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
 >  	  end_stabs ();
 >  
 >  	  /* XCOFF, according to the AIX 3.2 documentation, puts the filename
 > @@ -1311,7 +1314,7 @@ read_xcoff_symtab (pst)
 >  	  if (STREQ (cs->c_name, ".bf"))
 >  	    {
 >  	      CORE_ADDR off = ANOFFSET (objfile->section_offsets,
 > -					SECT_OFF_TEXT);
 > +					SECT_OFF_TEXT (objfile));
 >  	      bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
 >  				    0, cs->c_naux, &main_aux);
 >  
 > @@ -1323,7 +1326,7 @@ read_xcoff_symtab (pst)
 >  		(fcn_cs_saved.c_value + off,
 >  		 fcn_stab_saved.c_name, 0, 0, objfile);
 >  	      if (new->name != NULL)
 > -		SYMBOL_SECTION (new->name) = SECT_OFF_TEXT;
 > +		SYMBOL_SECTION (new->name) = SECT_OFF_TEXT (objfile);
 >  	    }
 >  	  else if (STREQ (cs->c_name, ".ef"))
 >  	    {
 > @@ -1356,7 +1359,7 @@ read_xcoff_symtab (pst)
 >  			    (fcn_cs_saved.c_value
 >  			     + fcn_aux_saved.x_sym.x_misc.x_fsize
 >  			     + ANOFFSET (objfile->section_offsets,
 > -					 SECT_OFF_TEXT)),
 > +					 SECT_OFF_TEXT (objfile))),
 >  			    objfile);
 >  	      within_function = 0;
 >  	    }
 > @@ -1426,7 +1429,7 @@ read_xcoff_symtab (pst)
 >  	      new = push_context (depth,
 >  				  (cs->c_value
 >  				   + ANOFFSET (objfile->section_offsets,
 > -					       SECT_OFF_TEXT)));
 > +					       SECT_OFF_TEXT (objfile))));
 >  	    }
 >  	  else if (STREQ (cs->c_name, ".eb"))
 >  	    {
 > @@ -1448,7 +1451,7 @@ read_xcoff_symtab (pst)
 >  				new->start_addr,
 >  				(cs->c_value
 >  				 + ANOFFSET (objfile->section_offsets,
 > -					     SECT_OFF_TEXT)),
 > +					     SECT_OFF_TEXT (objfile))),
 >  				objfile);
 >  		}
 >  	      local_symbols = new->locals;
 > @@ -1467,7 +1470,7 @@ read_xcoff_symtab (pst)
 >  
 >        complete_symtab (filestring, file_start_addr);
 >        cur_src_end_addr = file_end_addr;
 > -      s = end_symtab (file_end_addr, objfile, SECT_OFF_TEXT);
 > +      s = end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
 >        /* When reading symbols for the last C_FILE of the objfile, try
 >           to make sure that we set pst->symtab to the symtab for the
 >           file, not to the _globals_ symtab.  I'm not sure whether this
 > @@ -2763,22 +2766,43 @@ xcoff_symfile_offsets (objfile, addrs)
 >       struct objfile *objfile;
 >       struct section_addr_info *addrs;
 >  {
 > +  asection *sect = NULL;
 >    int i;
 >  
 >    objfile->num_sections = SECT_OFF_MAX;
 >    objfile->section_offsets = (struct section_offsets *)
 >      obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
 > +
 > +  /* Initialize the section indexes for future use. */
 > +  sect = bfd_get_section_by_name (objfile->obfd, ".text");
 > +  if (sect) 
 > +    objfile->sect_index_text = sect->index;
 > +
 > +  sect = bfd_get_section_by_name (objfile->obfd, ".data");
 > +  if (sect) 
 > +    objfile->sect_index_data = sect->index;
 > +
 > +  sect = bfd_get_section_by_name (objfile->obfd, ".bss");
 > +  if (sect) 
 > +    objfile->sect_index_bss = sect->index;
 > +
 > +  sect = bfd_get_section_by_name (objfile->obfd, ".rodata");
 > +  if (sect) 
 > +    objfile->sect_index_rodata = sect->index;
 >  
 > -  /* syms_from_objfile kindly subtracts from addr the bfd_section_vma
 > -     of the .text section.  This strikes me as wrong--whether the
 > -     offset to be applied to symbol reading is relative to the start
 > -     address of the section depends on the symbol format.  In any
 > -     event, this whole "addr" concept is pretty broken (it doesn't
 > -     handle any section but .text sensibly), so just ignore the addr
 > -     parameter and use 0.  rs6000-nat.c will set the correct section
 > -     offsets via objfile_relocate.  */
 >    for (i = 0; i < objfile->num_sections; ++i)
 > -    ANOFFSET (objfile->section_offsets, i) = 0;
 > +    {
 > +      /* syms_from_objfile kindly subtracts from addr the
 > +	 bfd_section_vma of the .text section.  This strikes me as
 > +	 wrong--whether the offset to be applied to symbol reading is
 > +	 relative to the start address of the section depends on the
 > +	 symbol format.  In any event, this whole "addr" concept is
 > +	 pretty broken (it doesn't handle any section but .text
 > +	 sensibly), so just ignore the addr parameter and use 0.
 > +	 rs6000-nat.c will set the correct section offsets via
 > +	 objfile_relocate.  */
 > +	ANOFFSET (objfile->section_offsets, i) = 0;
 > +    }
 >  }
 >  
 >  /* Register our ability to parse symbols for xcoff BFD files.  */


More information about the Gdb-patches mailing list