This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rfa][gold] build debug_msg.o without -fdebug-prefix-map


in the gold tests, the error messages from linking debug_msg.o are
checked to verify that the source file names show up correctly in
error messages.

Use of -fdebug-prefix-map in CXX or CXXFLAGS breaks that test.

To repro, build/test like:

export CC="$GCC_PREFIX/bin/gcc -fdebug-prefix-map=${topdir}=/tmp/foobar"
export CXX="$GCC_PREFIX//bin/g++ -fdebug-prefix-map=${topdir}=/tmp/foobar"
CC="${CC}" CXX="${CXX}" "${topdir}/gold/configure" --enable-gold
make all-gold
make check-gold

(GCC_PREFIX must contain a version of gcc that supports
-fdebug-prefix-map, of course.)

the errors you get are like:

Did not find expected error in debug_msg.err:
   debug_msg.o: in function
Base::virtfn():/home/cgd/proj/gcctools/sources/gold/gold/testsuite/debug_msg.cc:50:
error: undefined reference to 'undef_fn1()'

Actual error output below:
gcctestdir/ld: warning: while linking debug_msg: symbol
'Ordering::operator()(int, int)' defined in multiple places (possible
ODR violation):
  /tmp/foobar/gold/gold/testsuite/odr_violation1.cc:5
  /tmp/foobar/gold/gold/testsuite/odr_violation2.cc:5
gcctestdir/ld: debug_msg.o: in function
badref1:debug_msg.cc(.data+0x0): error: undefined reference to
'undef_int'
gcctestdir/ld: debug_msg.o: in function
fn_array:debug_msg.cc(.data+0x10): error: undefined reference to
'undef_fn1()'
gcctestdir/ld: debug_msg.o: in function
fn_array:debug_msg.cc(.data+0x18): error: undefined reference to
'undef_fn2()'
gcctestdir/ld: debug_msg.o: in function
Base::virtfn():/tmp/foobar/gold/gold/testsuite/debug_msg.cc:50: error:
undefined reference to 'undef_fn1()'
gcctestdir/ld: debug_msg.o: in function int
testfn<int>(int):/tmp/foobar/gold/gold/testsuite/debug_msg.cc:43:
error: undefined reference to 'undef_fn1()'
gcctestdir/ld: debug_msg.o: in function int
testfn<int>(int):/tmp/foobar/gold/gold/testsuite/debug_msg.cc:44:
error: undefined reference to 'undef_fn2()'
gcctestdir/ld: debug_msg.o: in function int
testfn<int>(int):/tmp/foobar/gold/gold/testsuite/debug_msg.cc:45:
error: undefined reference to 'undef_int'
gcctestdir/ld: debug_msg.o: in function int
testfn<double>(double):/tmp/foobar/gold/gold/testsuite/debug_msg.cc:43:
error: undefined reference to 'undef_fn1()'
gcctestdir/ld: debug_msg.o: in function int
testfn<double>(double):/tmp/foobar/gold/gold/testsuite/debug_msg.cc:44:
error: undefined reference to 'undef_fn2()'
gcctestdir/ld: debug_msg.o: in function int
testfn<double>(double):/tmp/foobar/gold/gold/testsuite/debug_msg.cc:45:
error: undefined reference to 'undef_int'
gcctestdir/ld: debug_msg.o: in function
Derived::virtfn():/tmp/foobar/gold/gold/testsuite/debug_msg.cc:55:
error: undefined reference to 'undef_fn2()'
collect2: ld returned 1 exit status
FAIL: debug_msg.sh

The patch attached fixes it.  This doesn't work if the
-fdebug-prefix-map mapping includes spaces, but i couldn't immediately
think of a better way to do it.  (This seemed a lot more
straightforward than trying to apply the prefix mappings to the source
dir name used in the test, tho...)

Tested with gold sources as of 2009-08-15 00:00 UTC.


Please double-check the ChangeLog, i'm rusty.  8-)


chris
---
2009-08-18  Chris Demetriou  <cgd@google.com>

        * configure.ac (CXX_NO_DEBUG_PREFIX_MAP)
        (CXXFLAGS_NO_DEBUG_PREFIX_MAP): New variables.
        * testsuite/Makefile.am (CXXCOMPILE_NO_DEBUG_PREFIX_MAP): New variable.
        (debug_msg.o): Build using CXXCOMPILE_NO_DEBUG_PREFIX_MAP.
        * Makefile.in: Regenerate.
        * configure: Likewise.
        * testsuite/Makefile.in: Likewise.

Attachment: debug_msg_test.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]