Skip to content

Commit e99bf2b

Browse files
nickdesaulniersExtremeXT
authored andcommitted
elfnote: mark all .note sections SHF_ALLOC
[ Upstream commit 51da9dfb7f20911ae4e79e9b412a9c2d4c373d4b ] ELFNOTE_START allows callers to specify flags for .pushsection assembler directives. All callsites but ELF_NOTE use "a" for SHF_ALLOC. For vdso's that explicitly use ELF_NOTE_START and BUILD_SALT, the same section is specified twice after preprocessing, once with "a" flag, once without. Example: .pushsection .note.Linux, "a", @note ; .pushsection .note.Linux, "", @note ; While GNU as allows this ordering, it warns for the opposite ordering, making these directives position dependent. We'd prefer not to precisely match this behavior in Clang's integrated assembler. Instead, the non __ASSEMBLY__ definition of ELF_NOTE uses __attribute__((section(".note.Linux"))) which is created with SHF_ALLOC, so let's make the __ASSEMBLY__ definition of ELF_NOTE consistent with C and just always use "a" flag. This allows Clang to assemble a working mainline (5.6) kernel via: $ make CC=clang AS=clang Signed-off-by: Nick Desaulniers <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Reviewed-by: Fangrui Song <[email protected]> Cc: Jeremy Fitzhardinge <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vincenzo Frascino <[email protected]> Link: ClangBuiltLinux/linux#913 Link: http://lkml.kernel.org/r/[email protected] Debugged-by: Ilie Halip <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 2ae7ae1 commit e99bf2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/elfnote.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
.popsection ;
5555

5656
#define ELFNOTE(name, type, desc) \
57-
ELFNOTE_START(name, type, "") \
57+
ELFNOTE_START(name, type, "a") \
5858
desc ; \
5959
ELFNOTE_END
6060

0 commit comments

Comments
 (0)