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

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