public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] libdwfl: Allow partial relocations also for debug files.
Date: Sun, 27 May 2018 12:13:00 -0000	[thread overview]
Message-ID: <1527423205-15293-1-git-send-email-mark@klomp.org> (raw)

__libdwfl_relocate is called for get_dwarf and get_elf. We allow not all
relocations to be resolved for Elf files, but required all relocations
(in the debug sections) to be fully resoled in Dwarf files. This used to
mostly work out with .o ET_REL files when the main Elf was gotten before
the Dwarf. But with .dwo files, we (readelf) might open the .o file just
for the (skeleton) Dwarf. In this case it could happen not all relocations
in the debug sections could be resolved (.debug_info and .debug_addr might
contain referenes to undefined symbols). So allow partial relocations
also for debug files.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 libdwfl/ChangeLog  | 5 +++++
 libdwfl/relocate.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index d69fe0c..34aa07d 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-27  Mark Wielaard  <mark@klomp.org>
+
+	* relocate.c (__libdwfl_relocate): Always call relocate_section with
+	partial true.
+
 2018-05-17  Mark Wielaard  <mark@klomp.org>
 
 	* dwfl_module (__libdwfl_module_free): Free elfdir.
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index 1768243..9afcdeb 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -751,7 +751,7 @@ __libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile, bool debug)
 	  else
 	    result = relocate_section (mod, debugfile, ehdr, d_shstrndx,
 				       &reloc_symtab, scn, shdr, tscn,
-				       debug, !debug);
+				       debug, true /* partial always OK. */);
 	}
     }
 
-- 
1.8.3.1

             reply	other threads:[~2018-05-27 12:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-27 12:13 Mark Wielaard [this message]
2018-05-29 10:12 ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1527423205-15293-1-git-send-email-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).