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

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