From 1ba54ee0206e3d32ee062d24d8342cd713ab4a0a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 24 Sep 2004 07:07:22 +0000 Subject: [PATCH] bfd/ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Add output section vma and output offset to address. * simple.c (simple_save_output_info): Only set output section and offset for debug sections, or those not already set up by the linker. (bfd_simple_get_relocated_section_contents): Update comment. ld/testsuite/ * ld-elfvsb/elfvsb.exp: Remove file name from "undefined ref" string. --- bfd/ChangeLog | 9 +++++++++ bfd/dwarf2.c | 10 ++++++++-- bfd/simple.c | 13 +++++++------ ld/testsuite/ChangeLog | 4 ++++ ld/testsuite/ld-elfvsb/elfvsb.exp | 20 ++++++++++---------- 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8537513db6..1d9635288d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2004-09-24 Alan Modra + + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Add output section + vma and output offset to address. + * simple.c (simple_save_output_info): Only set output section + and offset for debug sections, or those not already set up by + the linker. + (bfd_simple_get_relocated_section_contents): Update comment. + 2004-09-24 Alan Modra * elf.c (IS_LOADED): Delete. diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index a09265755a..b1f4ea6885 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -1703,13 +1703,19 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, We keep a list of all the previously read compilation units, and a pointer to the next un-read compilation unit. Check the previously read units before reading more. */ - struct dwarf2_debug *stash = *pinfo; + struct dwarf2_debug *stash; /* What address are we looking for? */ - bfd_vma addr = offset + section->vma; + bfd_vma addr; struct comp_unit* each; + stash = *pinfo; + addr = offset; + if (section->output_section) + addr += section->output_section->vma + section->output_offset; + else + addr += section->vma; *filename_ptr = NULL; *functionname_ptr = NULL; *linenumber_ptr = 0; diff --git a/bfd/simple.c b/bfd/simple.c index 5039911dcf..41aa950955 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -92,8 +92,12 @@ simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED, struct saved_output_info *output_info = ptr; output_info[section->index].offset = section->output_offset; output_info[section->index].section = section->output_section; - section->output_offset = 0; - section->output_section = section; + if ((section->flags & SEC_DEBUGGING) != 0 + || section->output_section == NULL) + { + section->output_offset = 0; + section->output_section = section; + } } static void @@ -117,13 +121,10 @@ SYNOPSIS DESCRIPTION Returns the relocated contents of section @var{sec}. The symbols in @var{symbol_table} will be used, or the symbols from @var{abfd} if - @var{symbol_table} is NULL. The output offsets for all sections will + @var{symbol_table} is NULL. The output offsets for debug sections will be temporarily reset to 0. The result will be stored at @var{outbuf} or allocated with @code{bfd_malloc} if @var{outbuf} is @code{NULL}. - Generally all sections in @var{abfd} should have their - @code{output_section} pointing back to the original section. - Returns @code{NULL} on a fatal error; ignores errors applying particular relocations. */ diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 83e25486cc..4546a2b575 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-09-24 Alan Modra + + * ld-elfvsb/elfvsb.exp: Remove file name from "undefined ref" string. + 2004-09-22 Alan Modra * ld-i386/tlsbin.rd: Update for changed segment map. diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp index 0b87c77105..3208f8e1bc 100644 --- a/ld/testsuite/ld-elfvsb/elfvsb.exp +++ b/ld/testsuite/ld-elfvsb/elfvsb.exp @@ -117,12 +117,12 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } { } if {![ld_simple_link $CC $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} { if { [ string match $visibility "hidden_undef" ] - && [regexp ".*/sh1.c.*: undefined reference to \`\.?visibility\'" $link_output] - && [regexp ".*/sh1.c.*: undefined reference to \`visibility_var\'" $link_output] } { + && [regexp "undefined reference to \`\.?visibility\'" $link_output] + && [regexp "undefined reference to \`visibility_var\'" $link_output] } { pass "$testname" } else { if { [ string match $visibility "protected_undef" ] - && [regexp ".*/sh1.c.*: undefined reference to \`\.?visibility\'" $link_output] - && [regexp ".*/sh1.c.*: undefined reference to \`visibility_var\'" $link_output] } { + && [regexp "undefined reference to \`\.?visibility\'" $link_output] + && [regexp "undefined reference to \`visibility_var\'" $link_output] } { pass "$testname" } else { fail "$testname" @@ -140,14 +140,14 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } { } if ![ld_simple_link $CC $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so"] { if { [ string match $visibility "hidden" ] - && [regexp ".*/main.c.*: undefined reference to \`\.?visibility\'" $link_output] - && [regexp ".*/main.c.*: undefined reference to \`visibility_var\'" $link_output] } { + && [regexp "undefined reference to \`\.?visibility\'" $link_output] + && [regexp "undefined reference to \`visibility_var\'" $link_output] } { pass "$testname" } else { if { [ string match $visibility "hidden_undef_def" ] - && [regexp ".*/main.c.*: undefined reference to \`\.?visibility\'" $link_output] - && [regexp ".*/main.c.*: undefined reference to \`visibility_def\'" $link_output] - && [regexp ".*/main.c.*: undefined reference to \`\.?visibility_func\'" $link_output] - && [regexp ".*/main.c.*: undefined reference to \`visibility_var\'" $link_output] } { + && [regexp "undefined reference to \`\.?visibility\'" $link_output] + && [regexp "undefined reference to \`visibility_def\'" $link_output] + && [regexp "undefined reference to \`\.?visibility_func\'" $link_output] + && [regexp "undefined reference to \`visibility_var\'" $link_output] } { pass "$testname" } else { fail "$testname" -- 2.34.1