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

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