aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-07-15 19:47:10 +0930
committerAlan Modra <amodra@gmail.com>2023-07-17 08:17:44 +0930
commit02d2a36902c7b0fefe05e8d9bdbf11e846ac71fe (patch)
tree259e2d70c3d929d26f948c6ca9c658fa3dc8e898
parent63e8fb86255ac97c31d368221be18850ad53039d (diff)
downloadgdb-02d2a36902c7b0fefe05e8d9bdbf11e846ac71fe.zip
gdb-02d2a36902c7b0fefe05e8d9bdbf11e846ac71fe.tar.gz
gdb-02d2a36902c7b0fefe05e8d9bdbf11e846ac71fe.tar.bz2
PR10957, Missing option to really print section+offset
Many of the reloc error messages have already been converted from using %C to using %H in ld.bfd, to print section+offset as well as file/line/function. This catches a few remaining, and changes gold to do the same. PR 10957 bfd/ * elf32-sh.c (sh_elf_relocate_section): Use %H in error messages. gold/ * object.cc (Relocate_info::location): Always report section+offset. * testsuite/debug_msg.sh: Adjust to suit. * testsuite/x32_overflow_pc32.sh: Likewise. * testsuite/x86_64_overflow_pc32.sh: Likewise. ld/ * emultempl/pe.em (read_addend): Use %H in error message. * emultempl/pep.em (read_addend): Likewise. * ldcref.c (check_reloc_refs): Likewise. * ldmain.c (warning_find_reloc, undefined_symbol): Likewise. * pe-dll.c (pe_create_import_fixup): Likewise. * testsuite/ld-cris/undef2.d: Adjust expected output to suit. * testsuite/ld-cris/undef3.d: Likewise. * testsuite/ld-elf/shared.exp: Likewise. * testsuite/ld-i386/compressed1.d: Likewise. * testsuite/ld-ia64/line.exp: Likewise. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-undefined/undefined.exp: Likewise. * testsuite/ld-x86-64/compressed1.d: Likewise. * testsuite/ld-x86-64/line.exp: Likewise. * testsuite/ld-x86-64/pr27587.err: Likewise.
-rw-r--r--bfd/elf32-sh.c4
-rw-r--r--gold/object.cc2
-rwxr-xr-xgold/testsuite/debug_msg.sh12
-rwxr-xr-xgold/testsuite/x32_overflow_pc32.sh2
-rwxr-xr-xgold/testsuite/x86_64_overflow_pc32.sh2
-rw-r--r--ld/emultempl/pe.em2
-rw-r--r--ld/emultempl/pep.em2
-rw-r--r--ld/ldcref.c2
-rw-r--r--ld/ldmain.c6
-rw-r--r--ld/pe-dll.c2
-rw-r--r--ld/testsuite/ld-cris/undef2.d12
-rw-r--r--ld/testsuite/ld-cris/undef3.d2
-rw-r--r--ld/testsuite/ld-elf/shared.exp4
-rw-r--r--ld/testsuite/ld-i386/compressed1.d2
-rw-r--r--ld/testsuite/ld-ia64/line.exp2
-rw-r--r--ld/testsuite/ld-plugin/lto.exp2
-rw-r--r--ld/testsuite/ld-undefined/undefined.exp2
-rw-r--r--ld/testsuite/ld-x86-64/compressed1.d2
-rw-r--r--ld/testsuite/ld-x86-64/line.exp2
-rw-r--r--ld/testsuite/ld-x86-64/pr27587.err2
20 files changed, 34 insertions, 34 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 499233d..cba3529 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -5010,14 +5010,14 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
info->callbacks->einfo
/* xgettext:c-format */
- (_("%X%C: relocation to \"%s\" references a different segment\n"),
+ (_("%X%H: relocation to \"%s\" references a different segment\n"),
input_bfd, input_section, rel->r_offset, symname);
return false;
}
else
info->callbacks->einfo
/* xgettext:c-format */
- (_("%C: warning: relocation to \"%s\" references a different segment\n"),
+ (_("%H: warning: relocation to \"%s\" references a different segment\n"),
input_bfd, input_section, rel->r_offset, symname);
}
diff --git a/gold/object.cc b/gold/object.cc
index ccb7405..77b2690 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -3358,7 +3358,7 @@ Relocate_info<size, big_endian>::location(size_t, off_t offset) const
if (info.enclosing_symbol_type == elfcpp::STT_FUNC)
ret += _("function ");
ret += info.enclosing_symbol_name;
- return ret;
+ ret += ":";
}
ret += "(";
diff --git a/gold/testsuite/debug_msg.sh b/gold/testsuite/debug_msg.sh
index b808fb8..51e8a83 100755
--- a/gold/testsuite/debug_msg.sh
+++ b/gold/testsuite/debug_msg.sh
@@ -55,9 +55,9 @@ check_missing()
# We don't know how the compiler might order these variables, so we
# can't test for the actual offset from .data, hence the regexp.
-check debug_msg.err "debug_msg.o:debug_msg.cc:fn_array: error: undefined reference to 'undef_fn1()'"
-check debug_msg.err "debug_msg.o:debug_msg.cc:fn_array: error: undefined reference to 'undef_fn2()'"
-check debug_msg.err "debug_msg.o:debug_msg.cc:badref1: error: undefined reference to 'undef_int'"
+check debug_msg.err "debug_msg.o:debug_msg.cc:fn_array:(.*): error: undefined reference to 'undef_fn1()'"
+check debug_msg.err "debug_msg.o:debug_msg.cc:fn_array:(.*): error: undefined reference to 'undef_fn2()'"
+check debug_msg.err "debug_msg.o:debug_msg.cc:badref1:(.*): error: undefined reference to 'undef_int'"
# These tests check only for the source file's file name (not the complete
# path) because use of -fdebug-prefix-map may change the path to the source
@@ -93,9 +93,9 @@ check debug_msg.err "odr_violation2.cc:3[0-7]"
# Check for the same error messages when using --compressed-debug-sections.
if test -r debug_msg_cdebug.err
then
- check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:fn_array: error: undefined reference to 'undef_fn1()'"
- check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:fn_array: error: undefined reference to 'undef_fn2()'"
- check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:badref1: error: undefined reference to 'undef_int'"
+ check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:fn_array:(.*): error: undefined reference to 'undef_fn1()'"
+ check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:fn_array:(.*): error: undefined reference to 'undef_fn2()'"
+ check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:badref1:(.*): error: undefined reference to 'undef_int'"
check debug_msg_cdebug.err ".*/debug_msg.cc:50: error: undefined reference to 'undef_fn1()'"
check debug_msg_cdebug.err ".*/debug_msg.cc:55: error: undefined reference to 'undef_fn2()'"
check debug_msg_cdebug.err ".*/debug_msg.cc:4[356]: error: undefined reference to 'undef_fn1()'"
diff --git a/gold/testsuite/x32_overflow_pc32.sh b/gold/testsuite/x32_overflow_pc32.sh
index d0a4cf0..6da575e 100755
--- a/gold/testsuite/x32_overflow_pc32.sh
+++ b/gold/testsuite/x32_overflow_pc32.sh
@@ -37,6 +37,6 @@ check()
# We don't know how the compiler might order these variables, so we
# can't test for the actual offset from .data, hence the regexp.
-check x86_64_overflow_pc32.err "function bar: error: relocation overflow"
+check x86_64_overflow_pc32.err "function bar:(.*): error: relocation overflow"
exit 0
diff --git a/gold/testsuite/x86_64_overflow_pc32.sh b/gold/testsuite/x86_64_overflow_pc32.sh
index d0a4cf0..6da575e 100755
--- a/gold/testsuite/x86_64_overflow_pc32.sh
+++ b/gold/testsuite/x86_64_overflow_pc32.sh
@@ -37,6 +37,6 @@ check()
# We don't know how the compiler might order these variables, so we
# can't test for the actual offset from .data, hence the regexp.
-check x86_64_overflow_pc32.err "function bar: error: relocation overflow"
+check x86_64_overflow_pc32.err "function bar:(.*): error: relocation overflow"
exit 0
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 7d956bf..cd2abe4 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1270,7 +1270,7 @@ read_addend (arelent *rel, asection *s)
bfd_vma addend = 0;
if (!bfd_get_section_contents (s->owner, s, buf, rel->address, sizeof (buf)))
- einfo (_("%P: %C: cannot get section contents - auto-import exception\n"),
+ einfo (_("%P: %H: cannot get section contents - auto-import exception\n"),
s->owner, s, rel->address);
else
addend = bfd_get_32 (s->owner, buf);
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 99e7195..28d8c8d 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -1269,7 +1269,7 @@ read_addend (arelent *rel, asection *s)
break;
}
if (!ok)
- einfo (_("%P: %C: cannot get section contents - auto-import exception\n"),
+ einfo (_("%P: %H: cannot get section contents - auto-import exception\n"),
s->owner, s, rel->address);
return addend;
}
diff --git a/ld/ldcref.c b/ld/ldcref.c
index da4a421..cf4eba3 100644
--- a/ld/ldcref.c
+++ b/ld/ldcref.c
@@ -721,7 +721,7 @@ check_reloc_refs (bfd *abfd, asection *sec, void *iarg)
in OUTSECNAME. This reloc is from a section which is
mapped into a section from which references to OUTSECNAME
are prohibited. We must report an error. */
- einfo (_("%X%P: %C: prohibited cross reference from %s to `%pT' in %s\n"),
+ einfo (_("%X%P: %H: prohibited cross reference from %s to `%pT' in %s\n"),
abfd, sec, q->address, outsecname,
bfd_asymbol_name (*q->sym_ptr_ptr), outdefsecname);
}
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 25cc89b..06ac2c6 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -1394,7 +1394,7 @@ warning_find_reloc (bfd *abfd, asection *sec, void *iarg)
&& strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), info->symbol) == 0)
{
/* We found a reloc for the symbol we are looking for. */
- einfo ("%P: %C: %s%s\n", abfd, sec, q->address, _("warning: "),
+ einfo ("%P: %H: %s%s\n", abfd, sec, q->address, _("warning: "),
info->warning);
info->found = true;
break;
@@ -1484,10 +1484,10 @@ undefined_symbol (struct bfd_link_info *info,
if (error_count < MAX_ERRORS_IN_A_ROW)
{
if (error)
- einfo (_("%X%P: %C: undefined reference to `%pT'\n"),
+ einfo (_("%X%P: %H: undefined reference to `%pT'\n"),
abfd, section, address, name);
else
- einfo (_("%P: %C: warning: undefined reference to `%pT'\n"),
+ einfo (_("%P: %H: warning: undefined reference to `%pT'\n"),
abfd, section, address, name);
}
else if (error_count == MAX_ERRORS_IN_A_ROW)
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 371915a..02e03d1 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -2911,7 +2911,7 @@ pe_create_import_fixup (arelent *rel, asection *s, bfd_vma addend, char *name,
}
else if (addend != 0)
- einfo (_("%X%P: %C: variable '%pT' can't be auto-imported; please read the documentation for ld's --enable-auto-import for details\n"),
+ einfo (_("%X%P: %H: variable '%pT' can't be auto-imported; please read the documentation for ld's --enable-auto-import for details\n"),
s->owner, s, rel->address, (*rel->sym_ptr_ptr)->name);
}
diff --git a/ld/testsuite/ld-cris/undef2.d b/ld/testsuite/ld-cris/undef2.d
index 46015c0..cd2c43e 100644
--- a/ld/testsuite/ld-cris/undef2.d
+++ b/ld/testsuite/ld-cris/undef2.d
@@ -1,6 +1,6 @@
-# source: start1.s
-# source: stabs1.s
-# target: cris-*-*elf* cris-*-*aout*
-# as: --em=crisaout
-# ld: -mcrisaout
-# error: .o:/blah/foo.c:96: undefined reference to `globsym1'$
+#source: start1.s
+#source: stabs1.s
+#target: cris-*-*elf* cris-*-*aout*
+#as: --em=crisaout
+#ld: -mcrisaout
+#error: .o:/blah/foo.c:96:\(.*\): undefined reference to `globsym1'$
diff --git a/ld/testsuite/ld-cris/undef3.d b/ld/testsuite/ld-cris/undef3.d
index e7bca10..e21456b 100644
--- a/ld/testsuite/ld-cris/undef3.d
+++ b/ld/testsuite/ld-cris/undef3.d
@@ -3,4 +3,4 @@
#target: cris-*-*elf* cris-*-*aout*
#as: --em=criself
#ld: -mcriself
-#error: .o:/blah/foo.c:96: undefined reference to `globsym1'$
+#error: .o:/blah/foo.c:96:\(.*\): undefined reference to `globsym1'$
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 1eef9f4..cf010e5 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -554,7 +554,7 @@ set build_tests {
"-shared" "-fPIC"
{beginwarn.c end.c}
{{readelf {-S --wide} libbarw.rd}
- {warning "^.*beginwarn.c:7: warning: function foo is deprecated\n?$"}}
+ {warning {^.*beginwarn.c:7:\(.*\): warning: function foo is deprecated\n?$}}}
"libbarw.so" "c"}
{"Build hidden libbar.so"
"-shared" "-fPIC"
@@ -1017,7 +1017,7 @@ set run_tests [list \
[list "Run warn with versioned libfoo.so" \
"-Wl,--no-as-needed tmpdir/beginwarn.o tmpdir/libfoov.so" "" \
{main.c} "warn" "warn.out" \
- "" "c" {^.*beginwarn.c:7: warning: function foo is deprecated\n?$} ] \
+ "" "c" {^.*beginwarn.c:7:\(.*\): warning: function foo is deprecated\n?$} ] \
[list "Run protected with versioned libfoo.so" \
"-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" "" \
{main.c} "protected" "normal.out" ] \
diff --git a/ld/testsuite/ld-i386/compressed1.d b/ld/testsuite/ld-i386/compressed1.d
index e9eeef9..a429478 100644
--- a/ld/testsuite/ld-i386/compressed1.d
+++ b/ld/testsuite/ld-i386/compressed1.d
@@ -1,7 +1,7 @@
#name: undefined symbol with compressed debug sections
#as: --32
#ld: -e foo -melf_i386 --noinhibit-exec
-#warning: .*/compressed1.c:13: undefined reference to .bar.
+#warning: .*/compressed1.c:13:\(.*\): undefined reference to .bar.
#nm: -n
#failif
diff --git a/ld/testsuite/ld-ia64/line.exp b/ld/testsuite/ld-ia64/line.exp
index d39e3ac..1fe32cd 100644
--- a/ld/testsuite/ld-ia64/line.exp
+++ b/ld/testsuite/ld-ia64/line.exp
@@ -52,6 +52,6 @@ proc checkund { string testname } {
}
}
-set ml "undefined.c:9: undefined reference to `*this_function_is_not_defined'"
+set ml {undefined.c:9:(*): undefined reference to `*this_function_is_not_defined'}
checkund $ml $testline
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 9a11de3..6f728d7 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -304,7 +304,7 @@ set lto_link_elf_tests [list \
{pr12760b.c} {} "libpr12760.a"] \
[list "PR ld/12760" \
"-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" "" \
- {dummy.c} {{warning "pr12760a.c:6: warning: Bad \\.?bar"}} \
+ {dummy.c} {{warning {pr12760a.c:6:\(.*\): warning: Bad \.?bar}}} \
"pr12760.exe" "c"] \
[list "PR ld/12975" \
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib -Wl,-version-script,pr12975.t" "-O2 -flto" \
diff --git a/ld/testsuite/ld-undefined/undefined.exp b/ld/testsuite/ld-undefined/undefined.exp
index 69a8f9b..05b1131 100644
--- a/ld/testsuite/ld-undefined/undefined.exp
+++ b/ld/testsuite/ld-undefined/undefined.exp
@@ -89,7 +89,7 @@ if { ![check_compiler_available] } {
#setup_xfail "arm*-*-pe*"
}
- set ml "undefined.c:9: undefined reference to `*this_function_is_not_defined'"
+ set ml {undefined.c:9:(*): undefined reference to `*this_function_is_not_defined'}
# With targets that use elf/dwarf2, such as the arm-elf toolchain,
# the code in bfd/elf.c:_bfd_elf_find_nearest_line() is called in
# order to locate the file name/line number where the undefined
diff --git a/ld/testsuite/ld-x86-64/compressed1.d b/ld/testsuite/ld-x86-64/compressed1.d
index f97c9ad..8b92278 100644
--- a/ld/testsuite/ld-x86-64/compressed1.d
+++ b/ld/testsuite/ld-x86-64/compressed1.d
@@ -1,7 +1,7 @@
#name: undefined symbol with compressed debug sections
#as: --64
#ld: -e foo -melf_x86_64 --noinhibit-exec
-#warning: .*/compressed1.c:13: undefined reference to .bar.
+#warning: .*/compressed1.c:13:\(.*\): undefined reference to .bar.
#nm: -n
#failif
diff --git a/ld/testsuite/ld-x86-64/line.exp b/ld/testsuite/ld-x86-64/line.exp
index f516399..af01ea2 100644
--- a/ld/testsuite/ld-x86-64/line.exp
+++ b/ld/testsuite/ld-x86-64/line.exp
@@ -52,6 +52,6 @@ proc checkund { string testname } {
}
}
-set ml "undefined.c:9: undefined reference to `*this_function_is_not_defined'"
+set ml {undefined.c:9:(*): undefined reference to `*this_function_is_not_defined'}
checkund $ml $testline
diff --git a/ld/testsuite/ld-x86-64/pr27587.err b/ld/testsuite/ld-x86-64/pr27587.err
index 807750c..9ccca0a 100644
--- a/ld/testsuite/ld-x86-64/pr27587.err
+++ b/ld/testsuite/ld-x86-64/pr27587.err
@@ -1,3 +1,3 @@
#...
-.*pr27587/<artificial>:4: undefined reference to `stack_size'
+.*pr27587/<artificial>:4:\(.*\): undefined reference to `stack_size'
#...