aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-01-03 23:06:29 +0000
committerDaniel Jacobowitz <drow@false.org>2007-01-03 23:06:29 +0000
commit05cfdb42f8434b8705875f786d41a64eafbd63ab (patch)
treeac46ec077f0f8dd78bb52412c50fb9089d81984f
parent1fefacdfa14360ff9de5f81efd43cb0ba223093a (diff)
downloadgdb-05cfdb42f8434b8705875f786d41a64eafbd63ab.zip
gdb-05cfdb42f8434b8705875f786d41a64eafbd63ab.tar.gz
gdb-05cfdb42f8434b8705875f786d41a64eafbd63ab.tar.bz2
2007-01-03 Pedro Alves <pedro_alves@portugalmail.pt>
* coffread.c (cs_to_section): If bfd_section is found, always return its section index. (coff_symtab_read): Determine the minimal_symbol_type using the bfd_section flags. * gdb.base/shreloc.exp: Use ldflags instead of additional_flags to pass --image-base to linker.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/coffread.c36
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/shreloc.exp2
4 files changed, 26 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9703777..74359c9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-03 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * coffread.c (cs_to_section): If bfd_section is found, always
+ return its section index.
+ (coff_symtab_read): Determine the minimal_symbol_type using the
+ bfd_section flags.
+
2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 669e33d..e90e925 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -277,19 +277,9 @@ static int
cs_to_section (struct coff_symbol *cs, struct objfile *objfile)
{
asection *sect = cs_to_bfd_section (cs, objfile);
- int off = SECT_OFF_TEXT (objfile);
- if (sect != NULL)
- {
- /* This is the section. Figure out what SECT_OFF_* code it is. */
- if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
- off = SECT_OFF_TEXT (objfile);
- else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
- off = SECT_OFF_DATA (objfile);
- else
- /* Just return the bfd section index. */
- off = sect->index;
- }
- return off;
+ if (sect == NULL)
+ return SECT_OFF_TEXT (objfile);
+ return sect->index;
}
/* Return the address of the section of a COFF symbol. */
@@ -711,6 +701,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
long fcn_line_ptr = 0;
int val;
CORE_ADDR tmpaddr;
+ struct minimal_symbol *msym;
/* Work around a stdio bug in SunOS4.1.1 (this makes me nervous....
it's hard to know I've really worked around it. The fix should be
@@ -903,6 +894,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
}
else
{
+ asection *bfd_section = cs_to_bfd_section (cs, objfile);
sec = cs_to_section (cs, objfile);
tmpaddr = cs->c_value;
/* Statics in a PE file also get relocated */
@@ -912,7 +904,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
|| (pe_file && (cs->c_sclass == C_STAT)))
tmpaddr += ANOFFSET (objfile->section_offsets, sec);
- if (sec == SECT_OFF_TEXT (objfile))
+ if (bfd_section->flags & SEC_CODE)
{
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
@@ -920,28 +912,26 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
mst_text : mst_file_text;
tmpaddr = SMASH_TEXT_ADDRESS (tmpaddr);
}
- else if (sec == SECT_OFF_DATA (objfile))
+ else if (bfd_section->flags & SEC_ALLOC
+ && bfd_section->flags & SEC_LOAD)
{
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data;
}
- else if (sec == SECT_OFF_BSS (objfile))
+ else if (bfd_section->flags & SEC_ALLOC)
{
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
- mst_data : mst_file_data;
+ mst_bss : mst_file_bss;
}
else
ms_type = mst_unknown;
}
- {
- struct minimal_symbol *msym;
- msym = record_minimal_symbol (cs, tmpaddr, ms_type, sec, objfile);
- if (msym)
- COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym);
- }
+ msym = record_minimal_symbol (cs, tmpaddr, ms_type, sec, objfile);
+ if (msym)
+ COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym);
if (SDB_TYPE (cs->c_type))
{
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 7ee795c..e8003af 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-03 Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * gdb.base/shreloc.exp: Use ldflags instead of additional_flags to
+ pass --image-base to linker.
+
2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp
index fe8ecfc..978a529 100644
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -55,7 +55,7 @@ set lib_opts "debug"
set exec_opts [list debug shlib=$lib1_sl shlib=$lib2_sl]
if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } {
- lappend lib_opts "additional_flags=-Wl,--image-base,0x04000000"
+ lappend lib_opts "ldflags=-Wl,--image-base,0x04000000"
}
if [test_compiler_info "xlc-*"] {