* [PATCH v2] lds: align RO_DATA_SECTION members
@ 2019-12-19 9:01 Lucas Stach
2019-12-20 15:12 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2019-12-19 9:01 UTC (permalink / raw)
To: barebox
From: Lucas Stach <dev@lynxeye.de>
When using the RO_DATA_SECTION macro, all the individual components
are put into the rodata section. As they now end up in the same
section there is no alignment enforced between them anymore. This
leads to unaligned start pointers when any of the components have a
unaligned size. Enforce some alignment between them.
Fixes: c5d38e920101 (lds: Add and use RO_DATA_SECTION macro)
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
v2: use STRUCT_ALIGN
---
include/asm-generic/barebox.lds.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index b6ca8eb2be27..bd6f6ee06ba5 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -17,6 +17,7 @@
#endif
#define BAREBOX_INITCALLS \
+ STRUCT_ALIGN(); \
__barebox_initcalls_start = .; \
KEEP(*(.initcall.0)) \
KEEP(*(.initcall.1)) \
@@ -36,6 +37,7 @@
__barebox_initcalls_end = .;
#define BAREBOX_EXITCALLS \
+ STRUCT_ALIGN(); \
__barebox_exitcalls_start = .; \
KEEP(*(.exitcall.0)) \
KEEP(*(.exitcall.1)) \
@@ -47,37 +49,44 @@
__barebox_exitcalls_end = .;
#define BAREBOX_CMDS \
+ STRUCT_ALIGN(); \
__barebox_cmd_start = .; \
KEEP(*(SORT_BY_NAME(.barebox_cmd*))) \
__barebox_cmd_end = .;
#define BAREBOX_RATP_CMDS \
+ STRUCT_ALIGN(); \
__barebox_ratp_cmd_start = .; \
KEEP(*(SORT_BY_NAME(.barebox_ratp_cmd*))) \
__barebox_ratp_cmd_end = .;
#define BAREBOX_SYMS \
+ STRUCT_ALIGN(); \
__usymtab_start = .; \
KEEP(*(__usymtab)) \
__usymtab_end = .;
#define BAREBOX_MAGICVARS \
+ STRUCT_ALIGN(); \
__barebox_magicvar_start = .; \
KEEP(*(SORT_BY_NAME(.barebox_magicvar*))) \
__barebox_magicvar_end = .;
#define BAREBOX_CLK_TABLE \
+ STRUCT_ALIGN(); \
__clk_of_table_start = .; \
KEEP(*(.__clk_of_table)); \
KEEP(*(.__clk_of_table_end)); \
__clk_of_table_end = .;
#define BAREBOX_DTB \
+ STRUCT_ALIGN(); \
__dtb_start = .; \
KEEP(*(.dtb.rodata.*)); \
__dtb_end = .;
#define BAREBOX_IMD \
+ STRUCT_ALIGN(); \
KEEP(*(.barebox_imd_start)) \
KEEP(*(.barebox_imd_1*)) \
*(.barebox_imd_0*) \
@@ -85,6 +94,7 @@
#ifdef CONFIG_PCI
#define BAREBOX_PCI_FIXUP \
+ STRUCT_ALIGN(); \
__start_pci_fixups_early = .; \
KEEP(*(.pci_fixup_early)) \
__end_pci_fixups_early = .; \
@@ -99,6 +109,7 @@
#endif
#define BAREBOX_RSA_KEYS \
+ STRUCT_ALIGN(); \
__rsa_keys_start = .; \
KEEP(*(.rsa_keys.rodata.*)); \
__rsa_keys_end = .; \
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] lds: align RO_DATA_SECTION members
2019-12-19 9:01 [PATCH v2] lds: align RO_DATA_SECTION members Lucas Stach
@ 2019-12-20 15:12 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-12-20 15:12 UTC (permalink / raw)
To: Lucas Stach; +Cc: barebox
On Thu, Dec 19, 2019 at 10:01:01AM +0100, Lucas Stach wrote:
> From: Lucas Stach <dev@lynxeye.de>
>
> When using the RO_DATA_SECTION macro, all the individual components
> are put into the rodata section. As they now end up in the same
> section there is no alignment enforced between them anymore. This
> leads to unaligned start pointers when any of the components have a
> unaligned size. Enforce some alignment between them.
>
> Fixes: c5d38e920101 (lds: Add and use RO_DATA_SECTION macro)
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
> v2: use STRUCT_ALIGN
> ---
> include/asm-generic/barebox.lds.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
Applied, thanks
Sascha
--
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 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-20 15:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19 9:01 [PATCH v2] lds: align RO_DATA_SECTION members Lucas Stach
2019-12-20 15:12 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox