Jan Kratochvil 556378e
Index: gdb-7.5.50.20130118/gdb/gdbtypes.h
8c4c91e
===================================================================
Jan Kratochvil 556378e
--- gdb-7.5.50.20130118.orig/gdb/gdbtypes.h	2013-01-18 23:07:03.488358315 +0100
Jan Kratochvil 556378e
+++ gdb-7.5.50.20130118/gdb/gdbtypes.h	2013-01-18 23:08:10.286451570 +0100
Jan Kratochvil 556378e
@@ -420,6 +420,7 @@ enum field_loc_kind
8c4c91e
   {
8c4c91e
     FIELD_LOC_KIND_BITPOS,	/* bitpos */
Jan Kratochvil f8eee05
     FIELD_LOC_KIND_ENUMVAL,	/* enumval */
8c4c91e
+    /* This address is unrelocated by the objfile's ANOFFSET.  */
8c4c91e
     FIELD_LOC_KIND_PHYSADDR,	/* physaddr */
Jan Kratochvil 254f0e9
     FIELD_LOC_KIND_PHYSNAME,	/* physname */
Jan Kratochvil 254f0e9
     FIELD_LOC_KIND_DWARF_BLOCK	/* dwarf_block */
Jan Kratochvil 556378e
@@ -614,6 +615,7 @@ struct main_type
8c4c91e
 	   is the location (in the target) of the static field.
Jan Kratochvil b0e03f5
 	   Otherwise, physname is the mangled label of the static field.  */
8c4c91e
 
8c4c91e
+	/* This address is unrelocated by the objfile's ANOFFSET.  */
8c4c91e
 	CORE_ADDR physaddr;
Jan Kratochvil 3b55f78
 	const char *physname;
Jan Kratochvil 254f0e9
 
Jan Kratochvil 556378e
@@ -1237,6 +1239,7 @@ extern void allocate_gnat_aux_type (stru
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)			\
Jan Kratochvil 556378e
@@ -1248,6 +1251,7 @@ extern void allocate_gnat_aux_type (stru
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))
Jan Kratochvil 556378e
@@ -1264,6 +1268,7 @@ extern void allocate_gnat_aux_type (stru
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))
Jan Kratochvil 556378e
Index: gdb-7.5.50.20130118/gdb/jv-lang.c
8c4c91e
===================================================================
Jan Kratochvil 556378e
--- gdb-7.5.50.20130118.orig/gdb/jv-lang.c	2013-01-18 23:07:03.488358315 +0100
Jan Kratochvil 556378e
+++ gdb-7.5.50.20130118/gdb/jv-lang.c	2013-01-18 23:08:10.286451570 +0100
Jan Kratochvil 556378e
@@ -430,7 +430,8 @@ java_link_class_type (struct gdbarch *gd
0911f37
 
0911f37
   fields = NULL;
Jan Kratochvil b0e03f5
   nfields--;			/* First set up dummy "class" field.  */
0911f37
-  SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas));
0911f37
+  SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas)
0911f37
+    - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
0911f37
   TYPE_FIELD_NAME (type, nfields) = "class";
0911f37
   TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
0911f37
   SET_TYPE_FIELD_PRIVATE (type, nfields);
Jan Kratochvil 556378e
@@ -478,7 +479,8 @@ java_link_class_type (struct gdbarch *gd
0911f37
 	  SET_TYPE_FIELD_PROTECTED (type, i);
0911f37
 	}
0911f37
       if (accflags & 0x0008)	/* ACC_STATIC */
0911f37
-	SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset);
0911f37
+	SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset
0911f37
+	  - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
0911f37
       else
Jan Kratochvil f8eee05
 	SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset);
0911f37
       if (accflags & 0x8000)	/* FIELD_UNRESOLVED_FLAG */
Jan Kratochvil 556378e
Index: gdb-7.5.50.20130118/gdb/value.c
8c4c91e
===================================================================
Jan Kratochvil 556378e
--- gdb-7.5.50.20130118.orig/gdb/value.c	2013-01-18 23:07:03.490358319 +0100
Jan Kratochvil 556378e
+++ gdb-7.5.50.20130118/gdb/value.c	2013-01-18 23:08:10.287451543 +0100
Jan Kratochvil 556378e
@@ -2624,7 +2624,8 @@ value_static_field (struct type *type, i
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)
dd46ae6
+			      + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
dd46ae6
       break;
dd46ae6
     case FIELD_LOC_KIND_PHYSNAME:
0911f37
     {