diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 42f2da7a88f..41411abef2b 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -127,7 +127,7 @@ struct ctf_psymtab : public standard_psymtab
   ctf_psymtab (const char *filename,
 	       psymtab_storage *partial_symtabs,
 	       objfile_per_bfd_storage *objfile_per_bfd,
-	       CORE_ADDR addr)
+	       unrelocated_addr addr)
     : standard_psymtab (filename, partial_symtabs, objfile_per_bfd, addr)
   {
   }
@@ -1232,10 +1232,10 @@ add_stt_func (struct ctf_context *ccp)
   add_stt_entries (ccp, 1);
 }
 
-/* Get text segment base for OBJFILE, TSIZE contains the segment size.  */
+/* Get text section base for OBJFILE, TSIZE contains the size.  */
 
 static CORE_ADDR
-get_objfile_text_range (struct objfile *of, int *tsize)
+get_objfile_text_range (struct objfile *of, size_t *tsize)
 {
   bfd *abfd = of->obfd.get ();
   const asection *codes;
@@ -1405,14 +1405,14 @@ ctf_psymtab::read_symtab (struct objfile *objfile)
 
       /* Start a symtab.  */
       CORE_ADDR offset;        /* Start of text segment.  */
-      int tsize;
+      size_t tsize;
 
       offset = get_objfile_text_range (objfile, &tsize);
       ctf_start_compunit_symtab (this, objfile, offset);
       expand_psymtab (objfile);
 
-      set_text_low (offset);
-      set_text_high (offset + tsize);
+      set_text_low (unrelocated_addr (0));
+      set_text_high (unrelocated_addr (tsize));
       compunit_symtab = ctf_end_compunit_symtab (this, offset + tsize);
 
       /* Finish up the debug error message.  */
@@ -1442,7 +1442,8 @@ create_partial_symtab (const char *name,
 {
   ctf_psymtab *pst;
 
-  pst = new ctf_psymtab (name, partial_symtabs, objfile->per_bfd, 0);
+  pst = new ctf_psymtab (name, partial_symtabs, objfile->per_bfd,
+			 unrelocated_addr (0));
 
   pst->context.arc = arc;
   pst->context.fp = cfp;
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index e5366ccd0d0..1ae527e9bf3 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -296,7 +296,7 @@ static void add_old_header_file (const char *, int);
 static void add_this_object_header_file (int);
 
 static legacy_psymtab *start_psymtab (psymtab_storage *, struct objfile *,
-				      const char *, CORE_ADDR, int);
+				      const char *, unrelocated_addr, int);
 
 /* Free up old header file tables.  */
 
@@ -1125,16 +1125,18 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 	      || (namestring[(nsl = strlen (namestring)) - 1] == 'o'
 		  && namestring[nsl - 2] == '.'))
 	    {
+	      unrelocated_addr unrel_val = unrelocated_addr (nlist.n_value);
+
 	      if (past_first_source_file && pst
 		  /* The gould NP1 uses low values for .o and -l symbols
 		     which are not the address.  */
-		  && nlist.n_value >= pst->raw_text_low ())
+		  && unrel_val >= pst->raw_text_low ())
 		{
 		  dbx_end_psymtab (objfile, partial_symtabs,
 				   pst, psymtab_include_list,
 				   includes_used, symnum * symbol_size,
-				   nlist.n_value > pst->raw_text_high ()
-				   ? nlist.n_value : pst->raw_text_high (),
+				   unrel_val > pst->raw_text_high ()
+				   ? unrel_val : pst->raw_text_high (),
 				   dependency_list, dependencies_used,
 				   textlow_not_set);
 		  pst = (legacy_psymtab *) 0;
@@ -1246,11 +1248,12 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 
 		if (pst)
 		  {
+		    unrelocated_addr unrel_value = unrelocated_addr (valu);
 		    dbx_end_psymtab (objfile, partial_symtabs,
 				     pst, psymtab_include_list,
 				     includes_used, symnum * symbol_size,
-				     (valu > pst->raw_text_high ()
-				      ? valu : pst->raw_text_high ()),
+				     (unrel_value > pst->raw_text_high ()
+				      ? unrel_value : pst->raw_text_high ()),
 				     dependency_list, dependencies_used,
 				     prev_textlow_not_set);
 		    pst = (legacy_psymtab *) 0;
@@ -1291,7 +1294,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 	    if (!pst)
 	      {
 		pst = start_psymtab (partial_symtabs, objfile,
-				     namestring, valu,
+				     namestring,
+				     unrelocated_addr (valu),
 				     first_so_symnum * symbol_size);
 		pst->dirname = dirname_nso;
 		dirname_nso = NULL;
@@ -1416,13 +1420,14 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 	  /* See if this is an end of function stab.  */
 	  if (pst && nlist.n_type == N_FUN && *namestring == '\000')
 	    {
-	      CORE_ADDR valu;
+	      unrelocated_addr valu;
 
 	      /* It's value is the size (in bytes) of the function for
 		 function relative stabs, or the address of the function's
 		 end for old style stabs.  */
-	      valu = nlist.n_value + last_function_start;
-	      if (pst->raw_text_high () == 0 || valu > pst->raw_text_high ())
+	      valu = unrelocated_addr (nlist.n_value + last_function_start);
+	      if (pst->raw_text_high () == unrelocated_addr (0)
+		  || valu > pst->raw_text_high ())
 		pst->set_text_high (valu);
 	      break;
 	    }
@@ -1673,7 +1678,7 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 	      if (pst && textlow_not_set
 		  && gdbarch_sofun_address_maybe_missing (gdbarch))
 		{
-		  pst->set_text_low (nlist.n_value);
+		  pst->set_text_low (unrelocated_addr (nlist.n_value));
 		  textlow_not_set = 0;
 		}
 	      /* End kludge.  */
@@ -1688,10 +1693,11 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 		 the partial symbol table.  */
 	      if (pst
 		  && (textlow_not_set
-		      || (nlist.n_value < pst->raw_text_low ()
+		      || (unrelocated_addr (nlist.n_value)
+			  < pst->raw_text_low ()
 			  && (nlist.n_value != 0))))
 		{
-		  pst->set_text_low (nlist.n_value);
+		  pst->set_text_low (unrelocated_addr (nlist.n_value));
 		  textlow_not_set = 0;
 		}
 	      if (pst != nullptr)
@@ -1729,7 +1735,7 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 	      if (pst && textlow_not_set
 		  && gdbarch_sofun_address_maybe_missing (gdbarch))
 		{
-		  pst->set_text_low (nlist.n_value);
+		  pst->set_text_low (unrelocated_addr (nlist.n_value));
 		  textlow_not_set = 0;
 		}
 	      /* End kludge.  */
@@ -1744,10 +1750,11 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 		 the partial symbol table.  */
 	      if (pst
 		  && (textlow_not_set
-		      || (nlist.n_value < pst->raw_text_low ()
+		      || (unrelocated_addr (nlist.n_value)
+			  < pst->raw_text_low ()
 			  && (nlist.n_value != 0))))
 		{
-		  pst->set_text_low (nlist.n_value);
+		  pst->set_text_low (unrelocated_addr (nlist.n_value));
 		  textlow_not_set = 0;
 		}
 	      if (pst != nullptr)
@@ -1871,7 +1878,7 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 	      dbx_end_psymtab (objfile, partial_symtabs, pst,
 			       psymtab_include_list, includes_used,
 			       symnum * symbol_size,
-			       (CORE_ADDR) 0, dependency_list,
+			       (unrelocated_addr) 0, dependency_list,
 			       dependencies_used, textlow_not_set);
 	      pst = (legacy_psymtab *) 0;
 	      includes_used = 0;
@@ -1928,11 +1935,11 @@ read_dbx_symtab (minimal_symbol_reader &reader,
     {
       /* Don't set high text address of PST lower than it already
 	 is.  */
-      CORE_ADDR text_end =
-	(lowest_text_address == (CORE_ADDR) -1
-	 ? text_addr
-	 : lowest_text_address)
-	+ text_size;
+      unrelocated_addr text_end
+	= unrelocated_addr ((lowest_text_address == (CORE_ADDR) -1
+			     ? text_addr
+			     : lowest_text_address)
+			    + text_size);
 
       dbx_end_psymtab (objfile, partial_symtabs,
 		       pst, psymtab_include_list, includes_used,
@@ -1952,7 +1959,7 @@ read_dbx_symtab (minimal_symbol_reader &reader,
 
 static legacy_psymtab *
 start_psymtab (psymtab_storage *partial_symtabs, struct objfile *objfile,
-	       const char *filename, CORE_ADDR textlow, int ldsymoff)
+	       const char *filename, unrelocated_addr textlow, int ldsymoff)
 {
   legacy_psymtab *result = new legacy_psymtab (filename, partial_symtabs,
 					       objfile->per_bfd, textlow);
@@ -1983,7 +1990,7 @@ legacy_psymtab *
 dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
 		 legacy_psymtab *pst,
 		 const char **include_list, int num_includes,
-		 int capping_symbol_offset, CORE_ADDR capping_text,
+		 int capping_symbol_offset, unrelocated_addr capping_text,
 		 legacy_psymtab **dependency_list,
 		 int number_dependencies,
 		 int textlow_not_set)
@@ -2037,8 +2044,9 @@ dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
 	}
 
       if (minsym.minsym)
-	pst->set_text_high (minsym.minsym->value_raw_address ()
-			    + minsym.minsym->size ());
+	pst->set_text_high
+	  (unrelocated_addr (minsym.minsym->value_raw_address ()
+			     + minsym.minsym->size ()));
 
       last_function_name = NULL;
     }
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 43542eae673..4bcda4b9d74 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -2601,7 +2601,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
     {
       legacy_psymtab *save_pst;
       EXTR *ext_ptr;
-      CORE_ADDR textlow;
+      unrelocated_addr textlow;
 
       cur_fdr = fh = debug_info->fdr + f_idx;
 
@@ -2614,9 +2614,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
       /* Determine the start address for this object file from the
 	 file header and relocate it, except for Irix 5.2 zero fh->adr.  */
       if (fh->cpd)
-	textlow = fh->adr;
+	textlow = unrelocated_addr (fh->adr);
       else
-	textlow = 0;
+	textlow = unrelocated_addr (0);
       pst = new legacy_psymtab (fdr_name (fh), partial_symtabs,
 				objfile->per_bfd, textlow);
       pst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, md_symloc);
@@ -2695,7 +2695,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 		{
 		  if (sh.st == stProc || sh.st == stStaticProc)
 		    {
-		      CORE_ADDR procaddr;
+		      unrelocated_addr procaddr;
 		      long isym;
 
 		      if (sh.st == stStaticProc)
@@ -2705,7 +2705,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 						 mst_file_text, sh.sc,
 						 objfile);
 			}
-		      procaddr = sh.value;
+		      procaddr = unrelocated_addr (sh.value);
 
 		      isym = AUX_GET_ISYM (fh->fBigendian,
 					   (debug_info->external_aux
@@ -2718,7 +2718,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 				      &sh);
 		      if (sh.st == stEnd)
 			{
-			  CORE_ADDR high = procaddr + sh.value;
+			  unrelocated_addr high
+			    = unrelocated_addr (CORE_ADDR (procaddr)
+						+ sh.value);
 
 			  /* Kludge for Irix 5.2 zero fh->adr.  */
 			  if (!relocatable
@@ -3304,8 +3306,12 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 		    continue;
 
 		  case N_RBRAC:
-		    if (sh.value > save_pst->raw_text_high ())
-		      save_pst->set_text_high (sh.value);
+		    {
+		      unrelocated_addr unrel_value
+			= unrelocated_addr (sh.value);
+		      if (unrel_value > save_pst->raw_text_high ())
+			save_pst->set_text_high (unrel_value);
+		    }
 		    continue;
 		  case N_EINCL:
 		  case N_DSLINE:
@@ -3409,8 +3415,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 
 	      switch (sh.st)
 		{
-		  CORE_ADDR high;
-		  CORE_ADDR procaddr;
+		  unrelocated_addr high;
+		  unrelocated_addr procaddr;
 		  int new_sdx;
 
 		case stStaticProc:
@@ -3479,7 +3485,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 				      sh.value, psymtab_language,
 				      partial_symtabs, objfile);
 
-		  procaddr = sh.value;
+		  procaddr = unrelocated_addr (sh.value);
 
 		  cur_sdx = new_sdx;
 		  (*swap_sym_in) (cur_bfd,
@@ -3496,7 +3502,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 			  || procaddr < pst->raw_text_low ()))
 		    pst->set_text_low (procaddr);
 
-		  high = procaddr + sh.value;
+		  high = unrelocated_addr (CORE_ADDR (procaddr) + sh.value);
 		  if (high > pst->raw_text_high ())
 		    pst->set_text_high (high);
 		  continue;
@@ -4005,7 +4011,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
 
       if (! last_symtab_ended)
 	{
-	  cust = end_compunit_symtab (pst->raw_text_high ());
+	  cust = end_compunit_symtab (pst->text_high (objfile));
 	  end_stabs ();
 	}
 
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 332d6a62686..8fb595e2e0b 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -130,7 +130,7 @@ struct partial_symtab
   partial_symtab (const char *filename,
 		  psymtab_storage *partial_symtabs,
 		  objfile_per_bfd_storage *objfile_per_bfd,
-		  CORE_ADDR addr)
+		  unrelocated_addr addr)
     ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (3);
 
   virtual ~partial_symtab ()
@@ -171,14 +171,16 @@ struct partial_symtab
   virtual struct compunit_symtab *get_compunit_symtab
     (struct objfile *) const = 0;
 
-  /* Return the raw low text address of this partial_symtab.  */
-  CORE_ADDR raw_text_low () const
+  /* Return the unrelocated low text address of this
+     partial_symtab.  */
+  unrelocated_addr raw_text_low () const
   {
     return m_text_low;
   }
 
-  /* Return the raw high text address of this partial_symtab.  */
-  CORE_ADDR raw_text_high () const
+  /* Return the unrelocated_addr high text address of this
+     partial_symtab.  */
+  unrelocated_addr raw_text_high () const
   {
     return m_text_high;
   }
@@ -186,24 +188,24 @@ struct partial_symtab
   /* Return the relocated low text address of this partial_symtab.  */
   CORE_ADDR text_low (struct objfile *objfile) const
   {
-    return m_text_low + objfile->text_section_offset ();
+    return CORE_ADDR (m_text_low) + objfile->text_section_offset ();
   }
 
   /* Return the relocated high text address of this partial_symtab.  */
   CORE_ADDR text_high (struct objfile *objfile) const
   {
-    return m_text_high + objfile->text_section_offset ();
+    return CORE_ADDR (m_text_high) + objfile->text_section_offset ();
   }
 
   /* Set the low text address of this partial_symtab.  */
-  void set_text_low (CORE_ADDR addr)
+  void set_text_low (unrelocated_addr addr)
   {
     m_text_low = addr;
     text_low_valid = 1;
   }
 
-  /* Set the hight text address of this partial_symtab.  */
-  void set_text_high (CORE_ADDR addr)
+  /* Set the high text address of this partial_symtab.  */
+  void set_text_high (unrelocated_addr addr)
   {
     m_text_high = addr;
     text_high_valid = 1;
@@ -283,8 +285,8 @@ struct partial_symtab
      fields; these are located later in this structure for better
      packing.  */
 
-  CORE_ADDR m_text_low = 0;
-  CORE_ADDR m_text_high = 0;
+  unrelocated_addr m_text_low {};
+  unrelocated_addr m_text_high {};
 
   /* If NULL, this is an ordinary partial symbol table.
 
@@ -372,7 +374,7 @@ struct standard_psymtab : public partial_symtab
   standard_psymtab (const char *filename,
 		    psymtab_storage *partial_symtabs,
 		    objfile_per_bfd_storage *objfile_per_bfd,
-		    CORE_ADDR addr)
+		    unrelocated_addr addr)
     : partial_symtab (filename, partial_symtabs, objfile_per_bfd, addr)
   {
   }
@@ -414,7 +416,7 @@ struct legacy_psymtab : public standard_psymtab
   legacy_psymtab (const char *filename,
 		  psymtab_storage *partial_symtabs,
 		  objfile_per_bfd_storage *objfile_per_bfd,
-		  CORE_ADDR addr)
+		  unrelocated_addr addr)
     : standard_psymtab (filename, partial_symtabs, objfile_per_bfd, addr)
   {
   }
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 95a53b90edd..484199b4be2 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1110,7 +1110,7 @@ psymbol_functions::has_unexpanded_symtabs (struct objfile *objfile)
 partial_symtab::partial_symtab (const char *filename,
 				psymtab_storage *partial_symtabs,
 				objfile_per_bfd_storage *objfile_per_bfd,
-				CORE_ADDR textlow)
+				unrelocated_addr textlow)
   : partial_symtab (filename, partial_symtabs, objfile_per_bfd)
 {
   set_text_low (textlow);
@@ -1653,7 +1653,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
 		      gdb_printf (" psymtab\n");
 		    }
 		}
-	      if (ps->raw_text_high () != 0
+	      if (ps->raw_text_high () != unrelocated_addr (0)
 		  && (ps->text_low (objfile) < b->start ()
 		      || ps->text_high (objfile) > b->end ()))
 		{
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 9df79bc7dfa..27ba176f63f 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -175,7 +175,7 @@ extern legacy_psymtab *dbx_end_psymtab
   (struct objfile *objfile, psymtab_storage *partial_symtabs,
    legacy_psymtab *pst,
    const char **include_list, int num_includes,
-   int capping_symbol_offset, CORE_ADDR capping_text,
+   int capping_symbol_offset, unrelocated_addr capping_text,
    legacy_psymtab **dependency_list, int number_dependencies,
    int textlow_not_set);
 
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index a07f40b5702..c829fb2aea0 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1875,7 +1875,8 @@ xcoff_start_psymtab (psymtab_storage *partial_symtabs,
 {
   /* We fill in textlow later.  */
   legacy_psymtab *result = new legacy_psymtab (filename, partial_symtabs,
-					       objfile->per_bfd, 0);
+					       objfile->per_bfd,
+					       unrelocated_addr (0));
 
   result->read_symtab_private =
     XOBNEW (&objfile->objfile_obstack, struct xcoff_symloc);
@@ -2172,14 +2173,16 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
 		      }
 		    if (pst != NULL)
 		      {
-			CORE_ADDR highval =
-			  symbol.n_value + csect_aux.x_csect.x_scnlen.l;
+			unrelocated_addr highval
+			  = unrelocated_addr (symbol.n_value
+					      + csect_aux.x_csect.x_scnlen.l);
 
 			if (highval > pst->raw_text_high ())
 			  pst->set_text_high (highval);
-			if (!pst->text_low_valid
-			    || symbol.n_value < pst->raw_text_low ())
-			  pst->set_text_low (symbol.n_value);
+			unrelocated_addr loval
+			  = unrelocated_addr (symbol.n_value);
+			if (!pst->text_low_valid || loval < pst->raw_text_low ())
+			  pst->set_text_low (loval);
 		      }
 		    misc_func_recorded = 0;
 		    break;
