From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18A1C23E344; Thu, 26 Jun 2025 23:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750982176; cv=none; b=WZKer8t29W8SzthBJnIRiiu8zGVgKtb6mIjSiZZUL9N4Pp2RFb4q9NSQg8beoQKtt9bSAfiVJeq4uV4Ecrb9dvunNggieZVmccq0hWEIDN0xrnRvV6kSvFVLyKn+F8ShVA+ggy/YSq6WQnSSSPMxiFMTpNqSMd4/UwHee5o0MjI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750982176; c=relaxed/simple; bh=CzL97ppEFIAqWlaw5ziqGUhqojWDK7zAj1wMTi9L81o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ph7UdxfInexWtA4j4GijLTXBhGGjYkmPsXKVsIFBqdj/IroosBiVnMOc+nusH8GYuL2z38YtPXB8yCCCBc63J8XeGaCSZsguwmuCNxEw+UHMC6jWsq+XcKC4eREF1Lq4ZwPZCKAQc8PmebIh+NYuUD7H4fauUcJVT+aGYIcprvI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sSml4038; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sSml4038" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A746C4CEF7; Thu, 26 Jun 2025 23:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750982175; bh=CzL97ppEFIAqWlaw5ziqGUhqojWDK7zAj1wMTi9L81o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSml40381iG1LXDL1te3zC2GZ4QMHBj7j44/W7Nqu8dTIgam0xG8uljmbSgF8nylZ r5anN/h2dOcSByB76FCNA6i4Di94JGr0gGnpSzGKeV34F1G7pj+XsmS5T96QjPKuIm JkkMdPVUWwvk/cpUBYTiNwBbx8/j6tWXJtPZwwUOXh+6yAP4g3b5YorHk5P/a7xvmk 11MkiTRPAb35fyVWlaOPpd1b8Cl6fJqA1AKmzzJ6tlmxxgbnKmBfV7eSy81/TFSgJv d1G4OYes8gA0L6jsG2Y0Am+7FBjjcNLM7con9iQw+W0TOKT66IhDTR7EvPAmJZHsMz wW7svnKJCjKGQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Petr Mladek , Miroslav Benes , Joe Lawrence , live-patching@vger.kernel.org, Song Liu , laokz , Jiri Kosina , Marcos Paulo de Souza , Weinan Liu , Fazla Mehrab , Chen Zhongjin , Puranjay Mohan , Dylan Hatch Subject: [PATCH v3 07/64] elfnote: Change ELFNOTE() to use __UNIQUE_ID() Date: Thu, 26 Jun 2025 16:54:54 -0700 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: live-patching@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In preparation for the objtool klp diff subcommand, replace the custom unique symbol name generation in ELFNOTE() with __UNIQUE_ID(). This standardizes the naming format for all "unique" symbols, which will allow objtool to properly correlate them. Note this also removes the "one ELF note per line" limitation. Signed-off-by: Josh Poimboeuf --- include/linux/elfnote.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h index 69b136e4dd2b..bb3dcded055f 100644 --- a/include/linux/elfnote.h +++ b/include/linux/elfnote.h @@ -60,23 +60,21 @@ #else /* !__ASSEMBLER__ */ #include +#include /* * Use an anonymous structure which matches the shape of * Elf{32,64}_Nhdr, but includes the name and desc data. The size and * type of name and desc depend on the macro arguments. "name" must - * be a literal string, and "desc" must be passed by value. You may - * only define one note per line, since __LINE__ is used to generate - * unique symbols. + * be a literal string, and "desc" must be passed by value. */ -#define _ELFNOTE_PASTE(a,b) a##b -#define _ELFNOTE(size, name, unique, type, desc) \ +#define ELFNOTE(size, name, type, desc) \ static const struct { \ struct elf##size##_note _nhdr; \ unsigned char _name[sizeof(name)] \ __attribute__((aligned(sizeof(Elf##size##_Word)))); \ typeof(desc) _desc \ __attribute__((aligned(sizeof(Elf##size##_Word)))); \ - } _ELFNOTE_PASTE(_note_, unique) \ + } __UNIQUE_ID(note) \ __used \ __attribute__((section(".note." name), \ aligned(sizeof(Elf##size##_Word)), \ @@ -89,11 +87,10 @@ name, \ desc \ } -#define ELFNOTE(size, name, type, desc) \ - _ELFNOTE(size, name, __LINE__, type, desc) #define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc) #define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc) + #endif /* __ASSEMBLER__ */ #endif /* _LINUX_ELFNOTE_H */ -- 2.49.0