From patchwork Fri May 10 22:16:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Boccassi X-Patchwork-Id: 89923 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AFC0E386F82D for ; Fri, 10 May 2024 22:17:23 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 58EDD386F802 for ; Fri, 10 May 2024 22:16:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 58EDD386F802 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 58EDD386F802 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715379416; cv=none; b=wQnbLdLjE15om4QMA5j9k7kkiL/cEVf4Bdxrqy6mCDsb1IeOQAcQqRYJa846zwI2XZluTLrTWiY5M/NTatGfycXmWrNdhYekEVOFi47irdqpMVZo6N2XJzOJDD3nuu2DCR+1BZMcbUm/h33/QOSxIyD2Mnpw8HGZYhq3qvalMOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715379416; c=relaxed/simple; bh=pmqgW05RhhSPGO0fMCDYT89z3ekxNUP/s3KJpcsPcp8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=JJn7ZPn7S5gFXjGfd4AdtRHyU4KP3W+nyqKzvJPySFiBe4a01eKa+CVl1lyRIr4gdpplXdraRZH3wUH0OffiKvaO3pgd2Q2qjTu0uYCKczIaoTSMNs/DNjGk59YZimmdNCxnbril82YZdNN37rLilMv0fzKHyELtzG73fiL0OGM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-41b21ed19f5so17469695e9.2 for ; Fri, 10 May 2024 15:16:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715379413; x=1715984213; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=EaOQV0+x723ZSslfdb94Jyimh7ktdsN70V9yEe62pTg=; b=GrXnzZ4eI6cTIIpyv4iB+6ESHqD5fIDuqt3LtsUEJpjqDCFvGd36jlXmu0iR05NpHV va4FW0fbUY+WWctexvy6E5xR3grP4dp6NBNmvJB/2z3Jp4/ZRIAMgGUUfN+HMgFdH45+ seE8+X50NkFlwsa8XtK48jFeSg0AxTeyOE4iAQPaEz20bm7lWUqMx/MMVLRASJ752Nxj Z72bLIZJ79BWlA+yJ7WAP4FtIyxEUK+QTJF0yUGGxu8w7aQddw3Ef0Ir72L0lmRDYrU8 2U6t9x0aByhwjulWXva9YYITsuVQiM5UV16J3G0x0/V0a0EA5Av8d3EgkXkySd6DEL53 sL2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715379413; x=1715984213; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EaOQV0+x723ZSslfdb94Jyimh7ktdsN70V9yEe62pTg=; b=IJO0Oblq1+Hhp/AXvRN6w5Mgxdtr2d9esk+ysLitT4RaytIYJpAiH6hzce5LHH7p71 4E91VE8TjPWwfaFDJBTVuqBOStqcOUxWP2AN5TE3g1h5S2BzQ+gml4LriFpCFWVknLlS 9UCgvUiqRKWGUBdOMJPGekPGJv0/ovpf0CuIXpbB8N+eZW6nozf6B2zT1V04i0uPqsMv BCAotzU6zVaTCmSR7MzlEsTBwn5hF9qyUb3QnV8qAUE0avQuP2QBJR4jVe5fmBpYH7I6 DH0BKhpul9YzfukI5rbRaUbB85LbcOpq4DPdW55qV3RiHej+8EfHI3vhtQWqZq624Aj+ DMRA== X-Gm-Message-State: AOJu0YwvnrTNuzJ9obk7r+dYXx0ILAl9oaIogakWvOAtCwA3oycs6UJQ 8tmNUf/lhr3iU+JpOiTFfyNQxjXpnbfjdqTlnpcz7qW9209kd/eNgRI8aOUH X-Google-Smtp-Source: AGHT+IGU+PW+a7zkHa0FzCkzyGtCJSnxpKF8vpmgDOA57e0rLwo5OzwRwhMdlyPigsc3tjqzxu3PLg== X-Received: by 2002:a05:600c:3b26:b0:41c:73d:62fe with SMTP id 5b1f17b1804b1-41fead7a82emr23853485e9.41.1715379412540; Fri, 10 May 2024 15:16:52 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41f87b265e8sm112647005e9.5.2024.05.10.15.16.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 15:16:52 -0700 (PDT) From: luca.boccassi@gmail.com To: binutils@sourceware.org Subject: [PATCH] readelf: add pretty printing for FDO Dlopen Metadata note Date: Fri, 10 May 2024 23:16:49 +0100 Message-Id: <20240510221649.1207746-1-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org From: Luca Boccassi Note that the webpage in the comment is not published yet, it will be next week when the next systemd RC is tagged. The document can be viewed right now on github at: https://github.com/systemd/systemd/blob/main/docs/ELF_DLOPEN_METADATA.md But the node ID and the string format are now fixed, even if the content of the string might change, it will still be a string. Signed-off-by: Luca Boccassi --- binutils/readelf.c | 7 +++++++ include/elf/common.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/binutils/readelf.c b/binutils/readelf.c index f8305b4715b..2fb5f977ec0 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -20518,6 +20518,8 @@ get_note_type (Filedata * filedata, unsigned e_type) return _("GO BUILDID"); case FDO_PACKAGING_METADATA: return _("FDO_PACKAGING_METADATA"); + case FDO_DLOPEN_METADATA: + return _("FDO_DLOPEN_METADATA"); default: break; } @@ -21777,6 +21779,11 @@ print_fdo_note (Elf_Internal_Note * pnote) printf (_(" Packaging Metadata: %.*s\n"), (int) pnote->descsz, pnote->descdata); return true; } + if (pnote->descsz > 0 && pnote->type == FDO_DLOPEN_METADATA) + { + printf (_(" Dlopen Metadata: %.*s\n"), (int) pnote->descsz, pnote->descdata); + return true; + } return false; } diff --git a/include/elf/common.h b/include/elf/common.h index 832f9bd510f..7e62c34643c 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -1037,6 +1037,9 @@ /* Values for FDO .note.package notes as defined on https://systemd.io/COREDUMP_PACKAGE_METADATA/ */ #define FDO_PACKAGING_METADATA 0xcafe1a7e +/* Values for FDO .note.dlopen notes as defined on https://systemd.io/ELF_DLOPEN_METADATA/ */ +#define FDO_DLOPEN_METADATA 0x407c0c0a + /* These three macros disassemble and assemble a symbol table st_info field, which contains the symbol binding and symbol type. The STB_ and STT_ defines identify the binding and type. */