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