From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122322 invoked by alias); 27 May 2018 12:13:36 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 122297 invoked by uid 89); 27 May 2018 12:13:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.4 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 27 May 2018 12:13:33 +0000 Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 1855830008B6; Sun, 27 May 2018 14:13:30 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id AF49B413CB92; Sun, 27 May 2018 14:13:30 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [PATCH] libdwfl: Allow partial relocations also for debug files. Date: Sun, 27 May 2018 12:13:00 -0000 Message-Id: <1527423205-15293-1-git-send-email-mark@klomp.org> X-Mailer: git-send-email 1.8.3.1 X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2018-q2/txt/msg00088.txt.bz2 __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 --- 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 + + * relocate.c (__libdwfl_relocate): Always call relocate_section with + partial true. + 2018-05-17 Mark Wielaard * 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