mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] firmware: fix alignment of firmware images
@ 2023-07-03 14:21 Ahmad Fatoum
  2023-07-04  7:36 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-07-03 14:21 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

ASM_LGPTR is a preprocessor symbol, not a Make variable, so expanding it
in the Makefile results in .p2align without an argument, which disables
alignment requirement. Fix this to restore the sizeof(void *) alignment
we had before.

Fixes: a59e2740b4a7 ("firmware: reference pointer alignment defined in <asm-generic/pointer.h>")
Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 firmware/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/firmware/Makefile b/firmware/Makefile
index 8d3bfb0752ff..d7f35853a404 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -49,7 +49,7 @@ filechk_fwbin = { \
 	echo "\#include <asm-generic/pointer.h>"		;\
 	echo ".section .note.GNU-stack,\"\",%progbits"		;\
 	echo "    .section $2,\"$3\""				;\
-	echo "    .p2align $(ASM_LGPTR)"			;\
+	echo "    .p2align ASM_LGPTR"				;\
 	echo ".global _fw_$(FWSTR)_start"			;\
 	echo "_fw_$(FWSTR)_start:"				;\
 	echo "\#if $(FWNAME_EXISTS)"				;\
@@ -68,7 +68,7 @@ filechk_fwbin = { \
 
 __fwbin_sha = { \
 	echo "    .section .rodata.$(FWSTR).sha"		;\
-	echo "    .p2align $(ASM_LGPTR)"			;\
+	echo "    .p2align ASM_LGPTR"				;\
 	echo ".global _fw_$(FWSTR)_sha_start"			;\
 	echo "_fw_$(FWSTR)_sha_start:"				;\
 	echo "    .incbin \"$(fwobjdir)/$(FWNAME).sha.bin\""	;\
-- 
2.39.2




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

* Re: [PATCH] firmware: fix alignment of firmware images
  2023-07-03 14:21 [PATCH] firmware: fix alignment of firmware images Ahmad Fatoum
@ 2023-07-04  7:36 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-07-04  7:36 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Jul 03, 2023 at 04:21:22PM +0200, Ahmad Fatoum wrote:
> ASM_LGPTR is a preprocessor symbol, not a Make variable, so expanding it
> in the Makefile results in .p2align without an argument, which disables
> alignment requirement. Fix this to restore the sizeof(void *) alignment
> we had before.
> 
> Fixes: a59e2740b4a7 ("firmware: reference pointer alignment defined in <asm-generic/pointer.h>")
> Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  firmware/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/firmware/Makefile b/firmware/Makefile
> index 8d3bfb0752ff..d7f35853a404 100644
> --- a/firmware/Makefile
> +++ b/firmware/Makefile
> @@ -49,7 +49,7 @@ filechk_fwbin = { \
>  	echo "\#include <asm-generic/pointer.h>"		;\
>  	echo ".section .note.GNU-stack,\"\",%progbits"		;\
>  	echo "    .section $2,\"$3\""				;\
> -	echo "    .p2align $(ASM_LGPTR)"			;\
> +	echo "    .p2align ASM_LGPTR"				;\
>  	echo ".global _fw_$(FWSTR)_start"			;\
>  	echo "_fw_$(FWSTR)_start:"				;\
>  	echo "\#if $(FWNAME_EXISTS)"				;\
> @@ -68,7 +68,7 @@ filechk_fwbin = { \
>  
>  __fwbin_sha = { \
>  	echo "    .section .rodata.$(FWSTR).sha"		;\
> -	echo "    .p2align $(ASM_LGPTR)"			;\
> +	echo "    .p2align ASM_LGPTR"				;\
>  	echo ".global _fw_$(FWSTR)_sha_start"			;\
>  	echo "_fw_$(FWSTR)_sha_start:"				;\
>  	echo "    .incbin \"$(fwobjdir)/$(FWNAME).sha.bin\""	;\
> -- 
> 2.39.2
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2023-07-04  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 14:21 [PATCH] firmware: fix alignment of firmware images Ahmad Fatoum
2023-07-04  7:36 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox