From 05cfdb42f8434b8705875f786d41a64eafbd63ab Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 3 Jan 2007 23:06:29 +0000 Subject: [PATCH] 2007-01-03 Pedro Alves * 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. --- gdb/ChangeLog | 7 ++++++ gdb/coffread.c | 36 +++++++++++------------------- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/shreloc.exp | 2 +- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 97037770777..74359c975d9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2007-01-03 Pedro Alves + + * 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 Daniel Jacobowitz diff --git a/gdb/coffread.c b/gdb/coffread.c index 669e33de459..e90e925faee 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 7ee795c3d59..e8003afe372 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-01-03 Pedro Alves + + * gdb.base/shreloc.exp: Use ldflags instead of additional_flags to + pass --image-base to linker. + 2007-01-03 Jan Kratochvil Daniel Jacobowitz diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp index fe8ecfcf81d..978a5294151 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-*"] { -- 2.30.2