From patchwork Wed May 15 16:57:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 64467 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A8CED27BBEA; Wed, 15 May 2024 18:01:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id AAF8B27BBE2 for ; Wed, 15 May 2024 18:01:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7HzC-0001rS-5M; Wed, 15 May 2024 13:00:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7Hz5-0001os-O2 for guix-patches@gnu.org; Wed, 15 May 2024 13:00:09 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7Hz1-0007Fr-Pn for guix-patches@gnu.org; Wed, 15 May 2024 13:00:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s7Hz3-0007C3-FL; Wed, 15 May 2024 13:00:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70962] [PATCH 08/14] gnu: Add dwarves. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: leo@famulari.name, me@tobias.gr, w@wmeyer.eu, guix-patches@gnu.org Resent-Date: Wed, 15 May 2024 17:00:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70962 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70962@debbugs.gnu.org Cc: Maxim Cournoyer , Leo Famulari , Tobias Geerinckx-Rice , Wilko Meyer X-Debbugs-Original-Xcc: Leo Famulari , Tobias Geerinckx-Rice , Wilko Meyer Received: via spool by 70962-submit@debbugs.gnu.org id=B70962.171579237027500 (code B ref 70962); Wed, 15 May 2024 17:00:05 +0000 Received: (at 70962) by debbugs.gnu.org; 15 May 2024 16:59:30 +0000 Received: from localhost ([127.0.0.1]:43167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7HyU-00079T-10 for submit@debbugs.gnu.org; Wed, 15 May 2024 12:59:30 -0400 Received: from mail-qk1-f170.google.com ([209.85.222.170]:43035) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7HyO-00078W-Tc for 70962@debbugs.gnu.org; Wed, 15 May 2024 12:59:25 -0400 Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-792bd82402cso482116685a.0 for <70962@debbugs.gnu.org>; Wed, 15 May 2024 09:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715792297; x=1716397097; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=saP5NNXJ+XzpRkPaysozWLBPOJh4YBQFWsZ8dBFdN7M=; b=S5HkvqD0M2zUS2PQ6HRQX7jDtr79veKP0MIW9HRYeaHQ/hTY6xEbmBWDkcvcOrteCC +iNjjOMHmInMQLbfzwCGu4cenhhgfUxyCjwnfMtBCBREWBL4OTtvVXVVnP13AC5JfFNv gIiHzE8gK9wFJFWdUlZIRHzBbNrE7QRNvpbkreLpeL8sdXc0Qwevn6GnQRGliOkVjG+G 7OM2hyUiQZqakZg8qqeLty38QO5KSXxcHsfvYG5Y6wn9cMdhweoExMeYBAaL6bJijJ33 MqWCdBl7rrxCw3loSJi4cQA8lADK4mQu5cq9ic7vdlf2TWHv2v+RnIfAYi0ejebw4wWH WOBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715792297; x=1716397097; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=saP5NNXJ+XzpRkPaysozWLBPOJh4YBQFWsZ8dBFdN7M=; b=iafNBY6apB1oCKIpnWiKK80l8sn8IDjIp7ctEnupwgspfBXnuE4qqUGvEV5Ddd4tXV a5m+opLSUf98pjYS4e43elSwnq8NarsoVKGKGyNt/mnp6pkJEiVM6VAHe2Bh4tYlQkSA xJU2xCuGyLO588Wchoj8qCeFfx7tvMzEpvLD9LTgdJCTcqBL6/B/VsoPwhe2I1fMxnDN dsAdfXUD7PU3bokPCaB31uiyAmc0pEFM8sEaQc1IEXb8u3YkZcd6bYK8/5kSij2iS7dA mJPrAXRoBkkHGBoiesX6LmNNRWR5uRHQTDcE9ItIKnNlsaSrHs1A/gjDOkOi0afxU+2c 0bYw== X-Gm-Message-State: AOJu0Yyb0OCrplM91kJhnr+Kku+s3ox8APeQF/DnY5sz1rMyeO9Vy/si nNKl3jU9+UkeH4UjhagK1gZKWfNRsHzbsNanlUVATJZpRGj2RKlKl/b++g== X-Google-Smtp-Source: AGHT+IHo0tuMkPdaL9IcgkFE6WqnRhoBn79P5xAy1wLPGag3uwR0fM/S0eaeE1tTgAfKr583OrOTdQ== X-Received: by 2002:a05:6214:398c:b0:6a0:f637:667 with SMTP id 6a1803df08f44-6a33d607dc9mr169176426d6.12.1715792297062; Wed, 15 May 2024 09:58:17 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-125-107.b2b2c.ca. [205.233.125.107]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6a15f194871sm66068896d6.59.2024.05.15.09.58.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 09:58:16 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 15 May 2024 12:57:18 -0400 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <7cf609dcf83c85b6897c9fb9af46ce8a854a15c8.1715791830.git.maxim.cournoyer@gmail.com> References: <7cf609dcf83c85b6897c9fb9af46ce8a854a15c8.1715791830.git.maxim.cournoyer@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/linux.scm (dwarves): New variable. Change-Id: Ib2452868eae76bea95060a70e568dfb6e84b2a75 --- gnu/local.mk | 1 + gnu/packages/linux.scm | 48 +++++++++++++++++++ .../dwarves-threading-reproducibility.patch | 23 +++++++++ 3 files changed, 72 insertions(+) create mode 100644 gnu/packages/patches/dwarves-threading-reproducibility.patch diff --git a/gnu/local.mk b/gnu/local.mk index 81960e1c9b..1531da2f87 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1123,6 +1123,7 @@ dist_patch_DATA = \ %D%/packages/patches/dune-istl-fix-solver-playground.patch \ %D%/packages/patches/durden-shadow-arcan.patch \ %D%/packages/patches/dvd+rw-tools-add-include.patch \ + %D%/packages/patches/dwarves-threading-reproducibility.patch \ %D%/packages/patches/dynaconf-unvendor-deps.patch \ %D%/packages/patches/dyninst-fix-glibc-compatibility.patch \ %D%/packages/patches/efivar-211.patch \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index a51ce5c27a..5119e7f575 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -2376,6 +2376,54 @@ (define-public dislocker partitions. Write functionality is also provided but check the README.") (license license:gpl2+))) +(define-public dwarves + (package + (name "dwarves") + (version "1.26") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/acmel/dwarves") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0xfq0r3whc3dk922ss8i5vwyfcqhgc95dy27mm69j5niy7i5kzrd")) + (patches + (search-patches "dwarves-threading-reproducibility.patch")))) + (build-system cmake-build-system) + (arguments (list #:configure-flags #~(list "-D__LIB=lib" + "-DLIBBPF_EMBEDDED=OFF") + #:tests? #f)) ;no test suite + (native-inputs (list pkg-config)) + (inputs (list libbpf)) + (home-page "https://github.com/acmel/dwarves") + (synopsis "Debugging information processing library and utilities") + (description "Dwarves is a set of tools that use the debugging information +inserted in ELF binaries by compilers such as GCC, used by well known +debuggers such as GDB. + +Utilities in the Dwarves suite include @command{pahole}, that can be used to +find alignment holes in structures and classes in languages such as C, C++, +but not limited to these. These tools can also be used to encode and read the +BTF type information format used with the kernel Linux @code{bpf} syscall. + +The @command{codiff} command can be used to compare the effects changes in +source code generate on the resulting binaries. + +The @command{pfunct} command can be used to find all sorts of information +about functions, inlines, decisions made by the compiler about inlining, etc. + +The @command{pahole} command can be used to use all this type information to +pretty print raw data according to command line directions. + +Headers can have its data format described from debugging info and offsets from +it can be used to further format a number of records. + +Finally, the @command{btfdiff} command can be used to compare the output of +pahole from BTF and DWARF, to make sure they produce the same results. ") + (license license:gpl2+))) + (define-public fbset (package (name "fbset") diff --git a/gnu/packages/patches/dwarves-threading-reproducibility.patch b/gnu/packages/patches/dwarves-threading-reproducibility.patch new file mode 100644 index 0000000000..8771ca6b0d --- /dev/null +++ b/gnu/packages/patches/dwarves-threading-reproducibility.patch @@ -0,0 +1,23 @@ +Retrieved from nixpkgs. + +This causes pahole to use '-j1' (single thread) when SOURCE_DATE_EPOCH +is set, to ensure it produces reproducible output. + +diff --git a/pahole.c b/pahole.c +index 6fc4ed6..a4e306f 100644 +--- a/pahole.c ++++ b/pahole.c +@@ -1687,8 +1687,11 @@ static error_t pahole__options_parser(int key, char *arg, + class_name = arg; break; + case 'j': + #if _ELFUTILS_PREREQ(0, 178) +- conf_load.nr_jobs = arg ? atoi(arg) : +- sysconf(_SC_NPROCESSORS_ONLN) * 1.1; ++ // Force single thread if reproducibility is desirable. ++ if (!getenv("SOURCE_DATE_EPOCH")) { ++ conf_load.nr_jobs = arg ? atoi(arg) : ++ sysconf(_SC_NPROCESSORS_ONLN) * 1.1; ++ } + #else + fputs("pahole: Multithreading requires elfutils >= 0.178. Continuing with a single thread...\n", stderr); + #endif