if (objfile->ei.entry_func_lowpc != INVALID_ENTRY_LOWPC) { 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.deprecated_entry_file_lowpc != INVALID_ENTRY_LOWPC) { objfile->ei.deprecated_entry_file_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); objfile->ei.deprecated_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)); objfile->ei.main_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); }
objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets){  struct section_offsets *delta =    ((struct section_offsets *)      alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)));  {    int i;    int something_changed = 0;    for (i = 0; i < objfile->num_sections; ++i)      {	delta->offsets[i] =	  ANOFFSET (new_offsets, i) - ANOFFSET (objfile->section_offsets, i);	if (ANOFFSET (delta, i) != 0)	  something_changed = 1;      }    if (!something_changed)      return;  }  /* OK, get all the symtabs.  */  {    struct symtab *s;    ALL_OBJFILE_SYMTABS (objfile, s)    {      struct linetable *l;      struct blockvector *bv;      int i;      /* First the line table.  */      l = LINETABLE (s);      if (l)	{	  for (i = 0; i < l->nitems; ++i)	    l->item[i].pc += ANOFFSET (delta, s->block_line_section);	}      /* Don't relocate a shared blockvector more than once.  */      if (!s->primary)	continue;      bv = BLOCKVECTOR (s);      for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)	{	  struct block *b;	  struct symbol *sym;	  struct dict_iterator iter;	  b = BLOCKVECTOR_BLOCK (bv, i);	  BLOCK_START (b) += ANOFFSET (delta, s->block_line_section);	  BLOCK_END (b) += ANOFFSET (delta, s->block_line_section);	  ALL_BLOCK_SYMBOLS (b, iter, sym)	    {	      fixup_symbol_section (sym, objfile);	      /* The RS6000 code from which this was taken skipped	         any symbols in STRUCT_DOMAIN or UNDEF_DOMAIN.	         But I'm leaving out that test, on the theory that	         they can't possibly pass the tests below.  */	      if ((SYMBOL_CLASS (sym) == LOC_LABEL		   || SYMBOL_CLASS (sym) == LOC_STATIC		   || SYMBOL_CLASS (sym) == LOC_INDIRECT)		  && SYMBOL_SECTION (sym) >= 0)		{		  SYMBOL_VALUE_ADDRESS (sym) +=		    ANOFFSET (delta, SYMBOL_SECTION (sym));		}#ifdef MIPS_EFI_SYMBOL_NAME	      /* Relocate Extra Function Info for ecoff.  */	      else if (SYMBOL_CLASS (sym) == LOC_CONST		       && SYMBOL_DOMAIN (sym) == LABEL_DOMAIN		       && strcmp (DEPRECATED_SYMBOL_NAME (sym), MIPS_EFI_SYMBOL_NAME) == 0)		ecoff_relocate_efi (sym, ANOFFSET (delta,						   s->block_line_section));#endif	    }	}    }  }  {    struct partial_symtab *p;    ALL_OBJFILE_PSYMTABS (objfile, p)    {      p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile));      p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile));    }  }  {    struct partial_symbol **psym;    for (psym = objfile->global_psymbols.list;	 psym < objfile->global_psymbols.next;	 psym++)      {	fixup_psymbol_section (*psym, objfile);	if (SYMBOL_SECTION (*psym) >= 0)	  SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,						    SYMBOL_SECTION (*psym));      }    for (psym = objfile->static_psymbols.list;	 psym < objfile->static_psymbols.next;	 psym++)      {	fixup_psymbol_section (*psym, objfile);	if (SYMBOL_SECTION (*psym) >= 0)	  SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,						    SYMBOL_SECTION (*psym));      }  }  {    struct minimal_symbol *msym;    ALL_OBJFILE_MSYMBOLS (objfile, msym)      if (SYMBOL_SECTION (msym) >= 0)      SYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, SYMBOL_SECTION (msym));  }  /* Relocating different sections by different amounts may cause the symbols     to be out of order.  */  msymbols_sort (objfile);  {    int i;    for (i = 0; i < objfile->num_sections; ++i)      (objfile->section_offsets)->offsets[i] = ANOFFSET (new_offsets, i);  }  if (objfile->ei.entry_point != ~(CORE_ADDR) 0)    {      /* Relocate ei.entry_point with its section offset, use SECT_OFF_TEXT	 only as a fallback.  */      struct obj_section *s;      s = find_pc_section (objfile->ei.entry_point);      if (s)        objfile->ei.entry_point += ANOFFSET (delta, s->the_bfd_section->index);      else        objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT (objfile));    }  {    struct obj_section *s;    bfd *abfd;    abfd = objfile->obfd;    ALL_OBJFILE_OSECTIONS (objfile, s)      {      	int idx = s->the_bfd_section->index;		s->addr += ANOFFSET (delta, idx);	s->endaddr += ANOFFSET (delta, idx);      }  }  if (objfile->ei.entry_func_lowpc != INVALID_ENTRY_LOWPC)    {      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.deprecated_entry_file_lowpc != INVALID_ENTRY_LOWPC)    {      objfile->ei.deprecated_entry_file_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));      objfile->ei.deprecated_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));      objfile->ei.main_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));    }  /* Relocate breakpoints as necessary, after things are relocated. */  breakpoint_re_set ();}