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.
This commit is contained in:
Daniel Jacobowitz 2007-01-03 23:06:29 +00:00
parent 1fefacdfa1
commit 05cfdb42f8
4 changed files with 26 additions and 24 deletions

View file

@ -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> 2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com>

View file

@ -277,19 +277,9 @@ static int
cs_to_section (struct coff_symbol *cs, struct objfile *objfile) cs_to_section (struct coff_symbol *cs, struct objfile *objfile)
{ {
asection *sect = cs_to_bfd_section (cs, objfile); asection *sect = cs_to_bfd_section (cs, objfile);
int off = SECT_OFF_TEXT (objfile); if (sect == NULL)
if (sect != NULL) return SECT_OFF_TEXT (objfile);
{ return sect->index;
/* 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;
} }
/* Return the address of the section of a COFF symbol. */ /* 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; long fcn_line_ptr = 0;
int val; int val;
CORE_ADDR tmpaddr; CORE_ADDR tmpaddr;
struct minimal_symbol *msym;
/* Work around a stdio bug in SunOS4.1.1 (this makes me nervous.... /* 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 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 else
{ {
asection *bfd_section = cs_to_bfd_section (cs, objfile);
sec = cs_to_section (cs, objfile); sec = cs_to_section (cs, objfile);
tmpaddr = cs->c_value; tmpaddr = cs->c_value;
/* Statics in a PE file also get relocated */ /* 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))) || (pe_file && (cs->c_sclass == C_STAT)))
tmpaddr += ANOFFSET (objfile->section_offsets, sec); tmpaddr += ANOFFSET (objfile->section_offsets, sec);
if (sec == SECT_OFF_TEXT (objfile)) if (bfd_section->flags & SEC_CODE)
{ {
ms_type = ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC 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; mst_text : mst_file_text;
tmpaddr = SMASH_TEXT_ADDRESS (tmpaddr); 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 = ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ? cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data; mst_data : mst_file_data;
} }
else if (sec == SECT_OFF_BSS (objfile)) else if (bfd_section->flags & SEC_ALLOC)
{ {
ms_type = ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ? cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data; mst_bss : mst_file_bss;
} }
else else
ms_type = mst_unknown; ms_type = mst_unknown;
} }
{ msym = record_minimal_symbol (cs, tmpaddr, ms_type, sec, objfile);
struct minimal_symbol *msym; if (msym)
msym = record_minimal_symbol (cs, tmpaddr, ms_type, sec, objfile); COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym);
if (msym)
COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym);
}
if (SDB_TYPE (cs->c_type)) if (SDB_TYPE (cs->c_type))
{ {

View file

@ -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> 2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com>

View file

@ -55,7 +55,7 @@ set lib_opts "debug"
set exec_opts [list debug shlib=$lib1_sl shlib=$lib2_sl] set exec_opts [list debug shlib=$lib1_sl shlib=$lib2_sl]
if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } { 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-*"] { if [test_compiler_info "xlc-*"] {