mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-24 12:39:59 +00:00
2009-02-06 Chris Demetriou <cgd@google.com>
* gold.h (gold_undefined_symbol): Change to take only a Symbol pointer and to report location as the file name associated with the symbol. (gold_undefined_symbol_at_location): New function to replace the old gold_undefined_symbol functionality. * target-reloc.h (relocate_section): Update to use gold_undefined_symbol_at_location. * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol): Call gold_undefined_symbol function rather than gold_error. * errors.h (Errors::undefined_symbol): Take location as a string, rather than calculating it from a relocation. * errors.cc (Errors::fatal): Print "fatal error:" before the formatted message. (Errors::error, Errors::error_at_location): Print "error: " before the formatted message. (Errors::undefined_symbol): Take location as a string, rather than calculating it from a relocation. (gold_undefined_symbol_at_location): New function akin to old gold_undefined_symbol, calculates location from relocation. (gold_undefined_symbol): Change to take only a Symbol pointer and to report location as the file name associated with the symbol. * testsuite/debug_msg.sh: Update for changed error messages. * testsuite/undef_symbol.sh: Likewise.
This commit is contained in:
parent
5a7c5e8630
commit
f073bbf7e0
@ -1,3 +1,29 @@
|
|||||||
|
2009-02-06 Chris Demetriou <cgd@google.com>
|
||||||
|
|
||||||
|
* gold.h (gold_undefined_symbol): Change to take only a Symbol
|
||||||
|
pointer and to report location as the file name associated with
|
||||||
|
the symbol.
|
||||||
|
(gold_undefined_symbol_at_location): New function to replace the
|
||||||
|
old gold_undefined_symbol functionality.
|
||||||
|
* target-reloc.h (relocate_section): Update to use
|
||||||
|
gold_undefined_symbol_at_location.
|
||||||
|
* symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
|
||||||
|
Call gold_undefined_symbol function rather than gold_error.
|
||||||
|
* errors.h (Errors::undefined_symbol): Take location as a
|
||||||
|
string, rather than calculating it from a relocation.
|
||||||
|
* errors.cc (Errors::fatal): Print "fatal error:" before the
|
||||||
|
formatted message.
|
||||||
|
(Errors::error, Errors::error_at_location): Print "error: "
|
||||||
|
before the formatted message.
|
||||||
|
(Errors::undefined_symbol): Take location as a string, rather
|
||||||
|
than calculating it from a relocation.
|
||||||
|
(gold_undefined_symbol_at_location): New function akin to
|
||||||
|
old gold_undefined_symbol, calculates location from relocation.
|
||||||
|
(gold_undefined_symbol): Change to take only a Symbol pointer
|
||||||
|
and to report location as the file name associated with the symbol.
|
||||||
|
* testsuite/debug_msg.sh: Update for changed error messages.
|
||||||
|
* testsuite/undef_symbol.sh: Likewise.
|
||||||
|
|
||||||
2009-02-04 Duncan Sands <baldrick@free.fr>
|
2009-02-04 Duncan Sands <baldrick@free.fr>
|
||||||
|
|
||||||
PR 9812
|
PR 9812
|
||||||
|
@ -80,7 +80,7 @@ Errors::increment_counter(int *counter)
|
|||||||
void
|
void
|
||||||
Errors::fatal(const char* format, va_list args)
|
Errors::fatal(const char* format, va_list args)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: ", this->program_name_);
|
fprintf(stderr, _("%s: fatal error: "), this->program_name_);
|
||||||
vfprintf(stderr, format, args);
|
vfprintf(stderr, format, args);
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
gold_exit(false);
|
gold_exit(false);
|
||||||
@ -91,7 +91,7 @@ Errors::fatal(const char* format, va_list args)
|
|||||||
void
|
void
|
||||||
Errors::error(const char* format, va_list args)
|
Errors::error(const char* format, va_list args)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: ", this->program_name_);
|
fprintf(stderr, _("%s: error: "), this->program_name_);
|
||||||
vfprintf(stderr, format, args);
|
vfprintf(stderr, format, args);
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ Errors::error_at_location(const Relocate_info<size, big_endian>* relinfo,
|
|||||||
size_t relnum, off_t reloffset,
|
size_t relnum, off_t reloffset,
|
||||||
const char* format, va_list args)
|
const char* format, va_list args)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: %s: ", this->program_name_,
|
fprintf(stderr, _("%s: %s: error: "), this->program_name_,
|
||||||
relinfo->location(relnum, reloffset).c_str());
|
relinfo->location(relnum, reloffset).c_str());
|
||||||
vfprintf(stderr, format, args);
|
vfprintf(stderr, format, args);
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
@ -151,13 +151,10 @@ Errors::warning_at_location(const Relocate_info<size, big_endian>* relinfo,
|
|||||||
this->increment_counter(&this->warning_count_);
|
this->increment_counter(&this->warning_count_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue an undefined symbol error.
|
// Issue an undefined symbol error with a caller-supplied location string.
|
||||||
|
|
||||||
template<int size, bool big_endian>
|
|
||||||
void
|
void
|
||||||
Errors::undefined_symbol(const Symbol* sym,
|
Errors::undefined_symbol(const Symbol* sym, const std::string& location)
|
||||||
const Relocate_info<size, big_endian>* relinfo,
|
|
||||||
size_t relnum, off_t reloffset)
|
|
||||||
{
|
{
|
||||||
bool initialized = this->initialize_lock();
|
bool initialized = this->initialize_lock();
|
||||||
gold_assert(initialized);
|
gold_assert(initialized);
|
||||||
@ -169,12 +166,13 @@ Errors::undefined_symbol(const Symbol* sym,
|
|||||||
}
|
}
|
||||||
const char* const version = sym->version();
|
const char* const version = sym->version();
|
||||||
if (version == NULL)
|
if (version == NULL)
|
||||||
fprintf(stderr, _("%s: %s: undefined reference to '%s'\n"),
|
fprintf(stderr, _("%s: %s: error: undefined reference to '%s'\n"),
|
||||||
this->program_name_, relinfo->location(relnum, reloffset).c_str(),
|
this->program_name_, location.c_str(),
|
||||||
sym->demangled_name().c_str());
|
sym->demangled_name().c_str());
|
||||||
else
|
else
|
||||||
fprintf(stderr, _("%s: %s: undefined reference to '%s', version '%s'\n"),
|
fprintf(stderr,
|
||||||
this->program_name_, relinfo->location(relnum, reloffset).c_str(),
|
_("%s: %s: error: undefined reference to '%s', version '%s'\n"),
|
||||||
|
this->program_name_, location.c_str(),
|
||||||
sym->demangled_name().c_str(), version);
|
sym->demangled_name().c_str(), version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,13 +269,22 @@ gold_warning_at_location(const Relocate_info<size, big_endian>* relinfo,
|
|||||||
|
|
||||||
// Report an undefined symbol.
|
// Report an undefined symbol.
|
||||||
|
|
||||||
|
void
|
||||||
|
gold_undefined_symbol(const Symbol* sym)
|
||||||
|
{
|
||||||
|
parameters->errors()->undefined_symbol(sym, sym->object()->name().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Report an undefined symbol at a reloc location
|
||||||
|
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
void
|
void
|
||||||
gold_undefined_symbol(const Symbol* sym,
|
gold_undefined_symbol_at_location(const Symbol* sym,
|
||||||
const Relocate_info<size, big_endian>* relinfo,
|
const Relocate_info<size, big_endian>* relinfo,
|
||||||
size_t relnum, off_t reloffset)
|
size_t relnum, off_t reloffset)
|
||||||
{
|
{
|
||||||
parameters->errors()->undefined_symbol(sym, relinfo, relnum, reloffset);
|
parameters->errors()->undefined_symbol(sym,
|
||||||
|
relinfo->location(relnum, reloffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_TARGET_32_LITTLE
|
#ifdef HAVE_TARGET_32_LITTLE
|
||||||
@ -347,33 +354,37 @@ gold_warning_at_location<64, true>(const Relocate_info<64, true>* relinfo,
|
|||||||
#ifdef HAVE_TARGET_32_LITTLE
|
#ifdef HAVE_TARGET_32_LITTLE
|
||||||
template
|
template
|
||||||
void
|
void
|
||||||
gold_undefined_symbol<32, false>(const Symbol* sym,
|
gold_undefined_symbol_at_location<32, false>(
|
||||||
const Relocate_info<32, false>* relinfo,
|
const Symbol* sym,
|
||||||
size_t relnum, off_t reloffset);
|
const Relocate_info<32, false>* relinfo,
|
||||||
|
size_t relnum, off_t reloffset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TARGET_32_BIG
|
#ifdef HAVE_TARGET_32_BIG
|
||||||
template
|
template
|
||||||
void
|
void
|
||||||
gold_undefined_symbol<32, true>(const Symbol* sym,
|
gold_undefined_symbol_at_location<32, true>(
|
||||||
const Relocate_info<32, true>* relinfo,
|
const Symbol* sym,
|
||||||
size_t relnum, off_t reloffset);
|
const Relocate_info<32, true>* relinfo,
|
||||||
|
size_t relnum, off_t reloffset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TARGET_64_LITTLE
|
#ifdef HAVE_TARGET_64_LITTLE
|
||||||
template
|
template
|
||||||
void
|
void
|
||||||
gold_undefined_symbol<64, false>(const Symbol* sym,
|
gold_undefined_symbol_at_location<64, false>(
|
||||||
const Relocate_info<64, false>* relinfo,
|
const Symbol* sym,
|
||||||
size_t relnum, off_t reloffset);
|
const Relocate_info<64, false>* relinfo,
|
||||||
|
size_t relnum, off_t reloffset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TARGET_64_BIG
|
#ifdef HAVE_TARGET_64_BIG
|
||||||
template
|
template
|
||||||
void
|
void
|
||||||
gold_undefined_symbol<64, true>(const Symbol* sym,
|
gold_undefined_symbol_at_location<64, true>(
|
||||||
const Relocate_info<64, true>* relinfo,
|
const Symbol* sym,
|
||||||
size_t relnum, off_t reloffset);
|
const Relocate_info<64, true>* relinfo,
|
||||||
|
size_t relnum, off_t reloffset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // End namespace gold.
|
} // End namespace gold.
|
||||||
|
@ -75,14 +75,10 @@ class Errors
|
|||||||
size_t relnum, off_t reloffset,
|
size_t relnum, off_t reloffset,
|
||||||
const char* format, va_list);
|
const char* format, va_list);
|
||||||
|
|
||||||
// Issue an undefined symbol error. SYM is the undefined symbol.
|
// Issue an undefined symbol error. LOCATION is the location of
|
||||||
// RELINFO is the general relocation info. RELNUM is the number of
|
// the error (typically an object file name or relocation info).
|
||||||
// the reloc, and RELOFFSET is the reloc's offset.
|
|
||||||
template<int size, bool big_endian>
|
|
||||||
void
|
void
|
||||||
undefined_symbol(const Symbol* sym,
|
undefined_symbol(const Symbol* sym, const std::string& location);
|
||||||
const Relocate_info<size, big_endian>* relinfo,
|
|
||||||
size_t relnum, off_t reloffset);
|
|
||||||
|
|
||||||
// Report a debugging message.
|
// Report a debugging message.
|
||||||
void
|
void
|
||||||
|
18
gold/gold.h
18
gold/gold.h
@ -202,12 +202,22 @@ gold_warning_at_location(const Relocate_info<size, big_endian>*,
|
|||||||
size_t, off_t, const char* format, ...)
|
size_t, off_t, const char* format, ...)
|
||||||
TEMPLATE_ATTRIBUTE_PRINTF_4;
|
TEMPLATE_ATTRIBUTE_PRINTF_4;
|
||||||
|
|
||||||
// This function is called to report an undefined symbol.
|
// This function is called to report an undefined symbol without
|
||||||
|
// a relocation (e.g., referenced by a dynamic object). SYM is
|
||||||
|
// the undefined symbol. The file name associated with the SYM
|
||||||
|
// is used to print a location for the undefined symbol.
|
||||||
|
extern void
|
||||||
|
gold_undefined_symbol(const Symbol*);
|
||||||
|
|
||||||
|
// This function is called to report an undefined symbol resulting
|
||||||
|
// from a relocation. SYM is the undefined symbol. RELINFO is the
|
||||||
|
// general relocation info. RELNUM is the number of the reloc,
|
||||||
|
// and RELOFFSET is the reloc's offset.
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
extern void
|
extern void
|
||||||
gold_undefined_symbol(const Symbol*,
|
gold_undefined_symbol_at_location(const Symbol*,
|
||||||
const Relocate_info<size, big_endian>*,
|
const Relocate_info<size, big_endian>*,
|
||||||
size_t, off_t);
|
size_t, off_t);
|
||||||
|
|
||||||
// This is function is called in some cases if we run out of memory.
|
// This is function is called in some cases if we run out of memory.
|
||||||
extern void
|
extern void
|
||||||
|
@ -2634,17 +2634,7 @@ Symbol_table::warn_about_undefined_dynobj_symbol(
|
|||||||
// A very ugly cast.
|
// A very ugly cast.
|
||||||
Dynobj* dynobj = static_cast<Dynobj*>(sym->object());
|
Dynobj* dynobj = static_cast<Dynobj*>(sym->object());
|
||||||
if (!dynobj->has_unknown_needed_entries())
|
if (!dynobj->has_unknown_needed_entries())
|
||||||
{
|
gold_undefined_symbol(sym);
|
||||||
if (sym->version())
|
|
||||||
gold_error(_("%s: undefined reference to '%s', version '%s'"),
|
|
||||||
sym->object()->name().c_str(),
|
|
||||||
sym->demangled_name().c_str(),
|
|
||||||
sym->version());
|
|
||||||
else
|
|
||||||
gold_error(_("%s: undefined reference to '%s'"),
|
|
||||||
sym->object()->name().c_str(),
|
|
||||||
sym->demangled_name().c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ relocate_section(
|
|||||||
&& !target->is_defined_by_abi(sym)
|
&& !target->is_defined_by_abi(sym)
|
||||||
&& (!parameters->options().shared() // -shared
|
&& (!parameters->options().shared() // -shared
|
||||||
|| parameters->options().defs())) // -z defs
|
|| parameters->options().defs())) // -z defs
|
||||||
gold_undefined_symbol(sym, relinfo, i, offset);
|
gold_undefined_symbol_at_location(sym, relinfo, i, offset);
|
||||||
|
|
||||||
if (sym != NULL && sym->has_warning())
|
if (sym != NULL && sym->has_warning())
|
||||||
relinfo->symtab->issue_warning(sym, relinfo, i, offset);
|
relinfo->symtab->issue_warning(sym, relinfo, i, offset);
|
||||||
|
@ -55,18 +55,18 @@ check_missing()
|
|||||||
|
|
||||||
# We don't know how the compiler might order these variables, so we
|
# 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.
|
# can't test for the actual offset from .data, hence the regexp.
|
||||||
check debug_msg.err "debug_msg.o: in function fn_array:debug_msg.cc(.data+0x[0-9a-fA-F]*): undefined reference to 'undef_fn1()'"
|
check debug_msg.err "debug_msg.o: in function fn_array:debug_msg.cc(.data+0x[0-9a-fA-F]*): error: undefined reference to 'undef_fn1()'"
|
||||||
check debug_msg.err "debug_msg.o: in function fn_array:debug_msg.cc(.data+0x[0-9a-fA-F]*): undefined reference to 'undef_fn2()'"
|
check debug_msg.err "debug_msg.o: in function fn_array:debug_msg.cc(.data+0x[0-9a-fA-F]*): error: undefined reference to 'undef_fn2()'"
|
||||||
check debug_msg.err "debug_msg.o: in function badref1:debug_msg.cc(.data+0x[0-9a-fA-F]*): undefined reference to 'undef_int'"
|
check debug_msg.err "debug_msg.o: in function badref1:debug_msg.cc(.data+0x[0-9a-fA-F]*): error: undefined reference to 'undef_int'"
|
||||||
|
|
||||||
check debug_msg.err "debug_msg.o: in function Base::virtfn():${srcdir}/debug_msg.cc:50: undefined reference to 'undef_fn1()'"
|
check debug_msg.err "debug_msg.o: in function Base::virtfn():${srcdir}/debug_msg.cc:50: error: undefined reference to 'undef_fn1()'"
|
||||||
check debug_msg.err "debug_msg.o: in function Derived::virtfn():${srcdir}/debug_msg.cc:55: undefined reference to 'undef_fn2()'"
|
check debug_msg.err "debug_msg.o: in function Derived::virtfn():${srcdir}/debug_msg.cc:55: error: undefined reference to 'undef_fn2()'"
|
||||||
check debug_msg.err "debug_msg.o: in function int testfn<int>(int):${srcdir}/debug_msg.cc:43: undefined reference to 'undef_fn1()'"
|
check debug_msg.err "debug_msg.o: in function int testfn<int>(int):${srcdir}/debug_msg.cc:43: error: undefined reference to 'undef_fn1()'"
|
||||||
check debug_msg.err "debug_msg.o: in function int testfn<int>(int):${srcdir}/debug_msg.cc:44: undefined reference to 'undef_fn2()'"
|
check debug_msg.err "debug_msg.o: in function int testfn<int>(int):${srcdir}/debug_msg.cc:44: error: undefined reference to 'undef_fn2()'"
|
||||||
check debug_msg.err "debug_msg.o: in function int testfn<int>(int):${srcdir}/debug_msg.cc:45: undefined reference to 'undef_int'"
|
check debug_msg.err "debug_msg.o: in function int testfn<int>(int):${srcdir}/debug_msg.cc:45: error: undefined reference to 'undef_int'"
|
||||||
check debug_msg.err "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:43: undefined reference to 'undef_fn1()'"
|
check debug_msg.err "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:43: error: undefined reference to 'undef_fn1()'"
|
||||||
check debug_msg.err "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:44: undefined reference to 'undef_fn2()'"
|
check debug_msg.err "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:44: error: undefined reference to 'undef_fn2()'"
|
||||||
check debug_msg.err "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:45: undefined reference to 'undef_int'"
|
check debug_msg.err "debug_msg.o: in function int testfn<double>(double):${srcdir}/debug_msg.cc:45: error: undefined reference to 'undef_int'"
|
||||||
|
|
||||||
# Check we detected the ODR (One Definition Rule) violation.
|
# Check we detected the ODR (One Definition Rule) violation.
|
||||||
check debug_msg.err ": symbol 'Ordering::operator()(int, int)' defined in multiple places (possible ODR violation):"
|
check debug_msg.err ": symbol 'Ordering::operator()(int, int)' defined in multiple places (possible ODR violation):"
|
||||||
@ -75,17 +75,17 @@ check debug_msg.err "odr_violation2.cc:5"
|
|||||||
|
|
||||||
# When linking together .so's, we don't catch the line numbers, but we
|
# When linking together .so's, we don't catch the line numbers, but we
|
||||||
# still find all the undefined variables, and the ODR violation.
|
# still find all the undefined variables, and the ODR violation.
|
||||||
check debug_msg_so.err "debug_msg.so: undefined reference to 'undef_fn1()'"
|
check debug_msg_so.err "debug_msg.so: error: undefined reference to 'undef_fn1()'"
|
||||||
check debug_msg_so.err "debug_msg.so: undefined reference to 'undef_fn2()'"
|
check debug_msg_so.err "debug_msg.so: error: undefined reference to 'undef_fn2()'"
|
||||||
check debug_msg_so.err "debug_msg.so: undefined reference to 'undef_int'"
|
check debug_msg_so.err "debug_msg.so: error: undefined reference to 'undef_int'"
|
||||||
check debug_msg_so.err ": symbol 'Ordering::operator()(int, int)' defined in multiple places (possible ODR violation):"
|
check debug_msg_so.err ": symbol 'Ordering::operator()(int, int)' defined in multiple places (possible ODR violation):"
|
||||||
check debug_msg_so.err "odr_violation1.cc:5"
|
check debug_msg_so.err "odr_violation1.cc:5"
|
||||||
check debug_msg_so.err "odr_violation2.cc:5"
|
check debug_msg_so.err "odr_violation2.cc:5"
|
||||||
|
|
||||||
# These messages shouldn't need any debug info to detect:
|
# These messages shouldn't need any debug info to detect:
|
||||||
check debug_msg_ndebug.err "debug_msg_ndebug.so: undefined reference to 'undef_fn1()'"
|
check debug_msg_ndebug.err "debug_msg_ndebug.so: error: undefined reference to 'undef_fn1()'"
|
||||||
check debug_msg_ndebug.err "debug_msg_ndebug.so: undefined reference to 'undef_fn2()'"
|
check debug_msg_ndebug.err "debug_msg_ndebug.so: error: undefined reference to 'undef_fn2()'"
|
||||||
check debug_msg_ndebug.err "debug_msg_ndebug.so: undefined reference to 'undef_int'"
|
check debug_msg_ndebug.err "debug_msg_ndebug.so: error: undefined reference to 'undef_int'"
|
||||||
# However, we shouldn't detect or declare any ODR violation
|
# However, we shouldn't detect or declare any ODR violation
|
||||||
check_missing debug_msg_ndebug.err "(possible ODR violation)"
|
check_missing debug_msg_ndebug.err "(possible ODR violation)"
|
||||||
|
|
||||||
|
@ -40,6 +40,6 @@ check()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check "undef_symbol.so: undefined reference to 'a'"
|
check "undef_symbol.so: error: undefined reference to 'a'"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user