In new_symbol(), relocate symbol address by base address of the section
authorKevin Buettner <kevinb@redhat.com>
Fri, 3 Nov 2000 22:38:38 +0000 (22:38 +0000)
committerKevin Buettner <kevinb@redhat.com>
Fri, 3 Nov 2000 22:38:38 +0000 (22:38 +0000)
it is in instead of using the base address of the .text section.

gdb/ChangeLog
gdb/dwarf2read.c

index a3d1933b0f10c548898105bc20390ca7e84fa5e0..db8a843592861042944abbaee5abc74e53c2620c 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-03  Kevin Buettner  <kevinb@redhat.com>
+
+       * dwarf2read.c (new_symbol): Relocate address of symbol by the
+       base address of the section it is in rather than always using
+       the base address of the .text section.
+
 2000-11-01  J.T. Conklin  <jtc@redback.com>
 
        * TODO: Note abstraction layer violation where "ocd reset" command
index d3dba4e74c0a1f13e854d2c6cc59866c48eab848..c215c9941d8e067ca5e2589d61bfd2cf22bcab70 100644 (file)
@@ -4185,7 +4185,10 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile,
                     the variable is referenced.  */
                  if (SYMBOL_VALUE_ADDRESS (sym))
                    {
-                     SYMBOL_VALUE_ADDRESS (sym) += baseaddr;
+                     fixup_symbol_section (sym, objfile);
+                     SYMBOL_VALUE_ADDRESS (sym) +=
+                       ANOFFSET (objfile->section_offsets,
+                                 SYMBOL_SECTION (sym));
                      SYMBOL_CLASS (sym) = LOC_STATIC;
                    }
                  else
@@ -4215,8 +4218,11 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile,
                    }
                  else
                    {
+                     fixup_symbol_section (sym, objfile);
+                     SYMBOL_VALUE_ADDRESS (sym) =
+                       addr + ANOFFSET (objfile->section_offsets,
+                                        SYMBOL_SECTION (sym));
                      SYMBOL_CLASS (sym) = LOC_STATIC;
-                     SYMBOL_VALUE_ADDRESS (sym) = addr + baseaddr;
                    }
                }
            }