diff mbox series

dwarf_loader: Sync with LINUX_ELFNOTE_LTO_INFO macro from kernel

Message ID 20230120201203.10785-1-sedat.dilek@gmail.com (mailing list archive)
State Not Applicable
Delegated to: BPF
Headers show
Series dwarf_loader: Sync with LINUX_ELFNOTE_LTO_INFO macro from kernel | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Sedat Dilek Jan. 20, 2023, 8:12 p.m. UTC
As long as I am using CONFIG_DEBUG_INFO_BTF=y with LLVM/Clang
I have noticed the below macros where defined unconsistently.

See here pahole latest Git...

[ pahole:dwarf_loader ]

/* Match the define in linux:include/linux/elfnote.h */
#define LINUX_ELFNOTE_BUILD_LTO                0x101

...and latest Linus v6.2-rc4+ Git:

[ linux:include/linux/elfnote-lto.h ]

#define LINUX_ELFNOTE_LTO_INFO         0x101

Yonghong Song says:
> Ya, LINUX_ELFNOTE_BUILD_LTO is initially proposed macro name but later
> the formal kernel patch used LINUX_ELFNOTE_LTO_INFO. Could you submit
> a pahole for this so it is consistent with kernel? Thanks!

Fix this by syncing the pahole macro with the one from linux-kernel.

Suggested-by: Yonghong Song <yhs@meta.com>
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
---
 dwarf_loader.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Yonghong Song Jan. 20, 2023, 10:57 p.m. UTC | #1
On 1/20/23 12:12 PM, Sedat Dilek wrote:
> As long as I am using CONFIG_DEBUG_INFO_BTF=y with LLVM/Clang
> I have noticed the below macros where defined unconsistently.
> 
> See here pahole latest Git...
> 
> [ pahole:dwarf_loader ]
> 
> /* Match the define in linux:include/linux/elfnote.h */
> #define LINUX_ELFNOTE_BUILD_LTO                0x101
> 
> ...and latest Linus v6.2-rc4+ Git:
> 
> [ linux:include/linux/elfnote-lto.h ]
> 
> #define LINUX_ELFNOTE_LTO_INFO         0x101
> 
> Yonghong Song says:
>> Ya, LINUX_ELFNOTE_BUILD_LTO is initially proposed macro name but later
>> the formal kernel patch used LINUX_ELFNOTE_LTO_INFO. Could you submit
>> a pahole for this so it is consistent with kernel? Thanks!
> 
> Fix this by syncing the pahole macro with the one from linux-kernel.
> 
> Suggested-by: Yonghong Song <yhs@meta.com>
> Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>

Thanks!

Acked-by: Yonghong Song <yhs@fb.com>
diff mbox series

Patch

diff --git a/dwarf_loader.c b/dwarf_loader.c
index 5a74035c5708..96ce5db4f5bc 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -2808,8 +2808,8 @@  static int __cus__load_debug_types(struct conf_load *conf, Dwfl_Module *mod, Dwa
 	return 0;
 }
 
-/* Match the define in linux:include/linux/elfnote.h */
-#define LINUX_ELFNOTE_BUILD_LTO		0x101
+/* Match the define in linux:include/linux/elfnote-lto.h */
+#define LINUX_ELFNOTE_LTO_INFO		0x101
 
 static bool cus__merging_cu(Dwarf *dw, Elf *elf)
 {
@@ -2827,7 +2827,7 @@  static bool cus__merging_cu(Dwarf *dw, Elf *elf)
 			size_t name_off, desc_off, offset = 0;
 			GElf_Nhdr hdr;
 			while ((offset = gelf_getnote(data, offset, &hdr, &name_off, &desc_off)) != 0) {
-				if (hdr.n_type != LINUX_ELFNOTE_BUILD_LTO)
+				if (hdr.n_type != LINUX_ELFNOTE_LTO_INFO)
 					continue;
 
 				/* owner is Linux */