Blame SOURCES/gdb-archer-pie-addons.patch

5ad05e
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
5ad05e
From: Fedora GDB patches <invalid@email.com>
5ad05e
Date: Fri, 27 Oct 2017 21:07:50 +0200
5ad05e
Subject: gdb-archer-pie-addons.patch
5ad05e
5ad05e
;;=push+jan: May get obsoleted by Tom's unrelocated objfiles patch.
5ad05e
5ad05e
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
5ad05e
--- a/gdb/gdbtypes.h
5ad05e
+++ b/gdb/gdbtypes.h
5ad05e
@@ -516,6 +516,7 @@ enum field_loc_kind
5ad05e
   {
5ad05e
     FIELD_LOC_KIND_BITPOS,	/**< bitpos */
5ad05e
     FIELD_LOC_KIND_ENUMVAL,	/**< enumval */
5ad05e
+    /* This address is unrelocated by the objfile's ANOFFSET.  */
5ad05e
     FIELD_LOC_KIND_PHYSADDR,	/**< physaddr */
5ad05e
     FIELD_LOC_KIND_PHYSNAME,	/**< physname */
5ad05e
     FIELD_LOC_KIND_DWARF_BLOCK	/**< dwarf_block */
5ad05e
@@ -566,6 +567,7 @@ union field_location
5ad05e
      field.  Otherwise, physname is the mangled label of the
5ad05e
      static field.  */
5ad05e
 
5ad05e
+  /* This address is unrelocated by the objfile's ANOFFSET.  */
5ad05e
   CORE_ADDR physaddr;
5ad05e
   const char *physname;
5ad05e
 
5ad05e
@@ -1474,6 +1476,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
5ad05e
 #define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval)
5ad05e
 #define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0)
5ad05e
 #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
5ad05e
+/* This address is unrelocated by the objfile's ANOFFSET.  */
5ad05e
 #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
5ad05e
 #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
5ad05e
 #define SET_FIELD_BITPOS(thisfld, bitpos)			\
5ad05e
@@ -1485,6 +1488,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
5ad05e
 #define SET_FIELD_PHYSNAME(thisfld, name)			\
5ad05e
   (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME,		\
5ad05e
    FIELD_STATIC_PHYSNAME (thisfld) = (name))
5ad05e
+/* This address is unrelocated by the objfile's ANOFFSET.  */
5ad05e
 #define SET_FIELD_PHYSADDR(thisfld, addr)			\
5ad05e
   (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR,		\
5ad05e
    FIELD_STATIC_PHYSADDR (thisfld) = (addr))
5ad05e
@@ -1501,6 +1505,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
5ad05e
 #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
5ad05e
 #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
5ad05e
 #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
5ad05e
+/* This address is unrelocated by the objfile's ANOFFSET.  */
5ad05e
 #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
5ad05e
 #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
5ad05e
 #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
5ad05e
diff --git a/gdb/value.c b/gdb/value.c
5ad05e
--- a/gdb/value.c
5ad05e
+++ b/gdb/value.c
5ad05e
@@ -2839,7 +2839,8 @@ value_static_field (struct type *type, int fieldno)
5ad05e
     {
5ad05e
     case FIELD_LOC_KIND_PHYSADDR:
5ad05e
       retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
5ad05e
-			      TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
5ad05e
+			      TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
5ad05e
+			      + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));
5ad05e
       break;
5ad05e
     case FIELD_LOC_KIND_PHYSNAME:
5ad05e
     {