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

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