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]

[PATCH] dwarf: Bail out if debug info needs relocation


find_abstract_instance may work only with relocated files.  When debug
info needs relocation, bfd should bail out instead of issuing an error.
For the testcase at

https://sourceware.org/bugzilla/show_bug.cgi?id=23425#c1

now we get

$ ./ld ccELcIbzdebugobjtem cccLlhS9debugobjtem ccqD9BbN.ltrans0.ltrans.o
./ld: warning: cannot find entry symbol _start; defaulting to 0000000000401000
./ld: ccqD9BbN.ltrans0.ltrans.o: in function `strerrno(int)':
/abuild/rguenther/obj-sccvn-g/gcc/cpputil.cpp:16: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'
./ld: /abuild/rguenther/obj-sccvn-g/gcc/cpputil.cpp:22: undefined reference to `strerrno_s(char*, unsigned long, int)'
./ld: /abuild/rguenther/obj-sccvn-g/gcc/cpputil.cpp:25: undefined reference to `std::string::operator=(char const*)'
./ld: /abuild/rguenther/obj-sccvn-g/gcc/cpputil.cpp:27: undefined reference to `std::string::operator+=(char const*)'
./ld: /abuild/rguenther/obj-sccvn-g/gcc/cpputil.cpp:31: undefined reference to `std::string::operator=(char const*)'
./ld: /abuild/rguenther/obj-sccvn-g/gcc/cpputil.cpp:34: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
./ld: /abuild/rguenther/obj-sccvn-g/gcc/cpputil.cpp:34: undefined reference to `_Unwind_Resume'
./ld: ccqD9BbN.ltrans0.ltrans.o:(.eh_frame+0x4b): undefined reference to `__gcc_personality_v0'
$

	PR ld/23425
	* dwarf2.c (find_abstract_instance): Bail out if debug info
	needs relocation.
---
 bfd/dwarf2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 8fadb5c4b6..bce5db9c7e 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2839,6 +2839,9 @@ find_abstract_instance (struct comp_unit *   unit,
       total = info_ptr_end - info_ptr;
       if (!die_ref || die_ref >= total)
 	{
+	  /* Bail out if the debug info needs relocation.  */
+	  if ((unit->stash->sec->flags & SEC_RELOC))
+	    return TRUE;
 	  _bfd_error_handler
 	    (_("DWARF error: invalid abstract instance DIE ref"));
 	  bfd_set_error (bfd_error_bad_value);
-- 
2.17.1


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