Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

elfnote: Change ELFNOTE() to use __UNIQUE_ID()

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.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+5 -8
+5 -8
include/linux/elfnote.h
··· 60 60 61 61 #else /* !__ASSEMBLER__ */ 62 62 #include <uapi/linux/elf.h> 63 + #include <linux/compiler.h> 63 64 /* 64 65 * Use an anonymous structure which matches the shape of 65 66 * Elf{32,64}_Nhdr, but includes the name and desc data. The size and 66 67 * type of name and desc depend on the macro arguments. "name" must 67 - * be a literal string, and "desc" must be passed by value. You may 68 - * only define one note per line, since __LINE__ is used to generate 69 - * unique symbols. 68 + * be a literal string, and "desc" must be passed by value. 70 69 */ 71 - #define _ELFNOTE_PASTE(a,b) a##b 72 - #define _ELFNOTE(size, name, unique, type, desc) \ 70 + #define ELFNOTE(size, name, type, desc) \ 73 71 static const struct { \ 74 72 struct elf##size##_note _nhdr; \ 75 73 unsigned char _name[sizeof(name)] \ 76 74 __attribute__((aligned(sizeof(Elf##size##_Word)))); \ 77 75 typeof(desc) _desc \ 78 76 __attribute__((aligned(sizeof(Elf##size##_Word)))); \ 79 - } _ELFNOTE_PASTE(_note_, unique) \ 77 + } __UNIQUE_ID(note) \ 80 78 __used \ 81 79 __attribute__((section(".note." name), \ 82 80 aligned(sizeof(Elf##size##_Word)), \ ··· 87 89 name, \ 88 90 desc \ 89 91 } 90 - #define ELFNOTE(size, name, type, desc) \ 91 - _ELFNOTE(size, name, __LINE__, type, desc) 92 92 93 93 #define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc) 94 94 #define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc) 95 + 95 96 #endif /* __ASSEMBLER__ */ 96 97 97 98 #endif /* _LINUX_ELFNOTE_H */