From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id DDA323851C0D for ; Thu, 25 Jun 2020 14:13:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DDA323851C0D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org 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 D056330291AB; Thu, 25 Jun 2020 16:13:36 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 81F8A40006CA; Thu, 25 Jun 2020 16:13:36 +0200 (CEST) Message-ID: Subject: Re: location list From: Mark Wielaard To: Sasha Da Rocha Pinheiro , "elfutils-devel@sourceware.org" Date: Thu, 25 Jun 2020 16:13:36 +0200 In-Reply-To: References: , <4c9a5ec61c1157efbb71269d5aa67c07e46436a9.camel@klomp.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2020 14:13:39 -0000 Hi Sasha, On Tue, 2020-06-23 at 16:34 +0000, Sasha Da Rocha Pinheiro wrote: > Since we are now using not only executables and .so, but ".o" files > too, I'm trying to decide if I can use the same functions to all of > them, like the code you pointed out to deal with ".o". Would that > work for EXEC, SHARED, and RELOC? Yes, it would work. The relocation resolving logic only triggers for .o (ET_REL) files. But everything else works as expected also for ET_EXEC and ET_DYN files. > The idea is not to have two codes to parse modules and DIEs, two ways > because as you pointed out ".o" files need some relocation to be > performed, therefore using dwfl_*. Meanwhile for executables and .so > we only use dwarf_* functions. > In face of that, do you foresee bigger changes or things we should > worry that we would have in case we use only dwfl_* to open all the > ELF files with dwarf data, and drop the way we used to open them? > Because our code base for a long time has only used the dwarf_* > functions, this would be a big change. The real "value" from the Dwfl interface comes from it trying to layout objects as if dynamically loaded. So you can mimic a process even if it isn't loaded (or a kernel plus modules). This is why some functions return an "bias" indicating the difference between the Dwfl_Module "assigned" addresses and any addresses you might read directly from the Elf or Dwarf. But you can of course ignore that functionality and just treat each object file independently. Besides resolving those relocations for ET_REL files, Dwfl also provides various (default/standard) callbacks to find/associate separate debuginfo to an Elf file. See Dwfl_Callbacks and the "Standard callbacks" in the libdwfl.h file. If you do use it, it might override/change some search paths for where to get the Dwarf data/file from. Again, you could not use this functionality if you don't like it. (Dwfl also works when you provide it the Dwarf data files directly.) Just look at what you need/want. Cheers, Mark