linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware_loader: Align .builtin_fw to 8
@ 2020-12-03 17:05 Fangrui Song
  2020-12-03 18:00 ` Arnd Bergmann
  2020-12-03 19:04 ` Nick Desaulniers
  0 siblings, 2 replies; 11+ messages in thread
From: Fangrui Song @ 2020-12-03 17:05 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arch
  Cc: linux-kernel, clang-built-linux, Nathan Chancellor,
	Nick Desaulniers, Fangrui Song, kernel test robot

arm64 references the start address of .builtin_fw (__start_builtin_fw)
with a pair of R_AARCH64_ADR_PREL_PG_HI21/R_AARCH64_LDST64_ABS_LO12_NC
relocations. The compiler is allowed to emit the
R_AARCH64_LDST64_ABS_LO12_NC relocation because struct builtin_fw in
include/linux/firmware.h is 8-byte aligned.

The R_AARCH64_LDST64_ABS_LO12_NC relocation requires the address to be a
multiple of 8, which may not be the case if .builtin_fw is empty.
Unconditionally align .builtin_fw to fix the linker error.

Fixes: 5658c76 ("firmware: allow firmware files to be built into kernel image")
Link: https://github.com/ClangBuiltLinux/linux/issues/1204
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Fangrui Song <maskray@google.com>
---
 include/asm-generic/vmlinux.lds.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index b2b3d81b1535..3cd4bd1193ab 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -459,6 +459,7 @@
 	}								\
 									\
 	/* Built-in firmware blobs */					\
+	ALIGN_FUNCTION();						\
 	.builtin_fw        : AT(ADDR(.builtin_fw) - LOAD_OFFSET) {	\
 		__start_builtin_fw = .;					\
 		KEEP(*(.builtin_fw))					\
-- 
2.29.2.576.ga3fc446d84-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-02-05 19:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 17:05 [PATCH] firmware_loader: Align .builtin_fw to 8 Fangrui Song
2020-12-03 18:00 ` Arnd Bergmann
2020-12-03 19:04 ` Nick Desaulniers
2020-12-03 20:27   ` Fangrui Song
2020-12-08  5:46     ` [PATCH v2] " Fangrui Song
2020-12-08 17:59       ` Nick Desaulniers
2021-01-05 17:44       ` Doug Anderson
2021-01-05 19:20         ` Nick Desaulniers
2021-01-22 19:04           ` Doug Anderson
2021-02-05 17:19             ` Doug Anderson
2021-02-05 19:08       ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).