Skip to content

Commit 427011d

Browse files
zearglaubitz
authored andcommitted
sh: Align .bss section padding to 8-byte boundary
J2-based devices expect to find a device tree blob at the end of the .bss section. As of a77725a ("scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8"), libfdt enforces 8-byte alignment for the DTB, causing J2 devices to fail early in sh_fdt_init(). As the J2 loader firmware calculates the DTB location based on the kernel image .bss section size rather than the __bss_stop symbol offset, the required alignment can't be enforced with BSS_SECTION(0, PAGE_SIZE, 8). To fix this, inline a modified version of the above macro which grows .bss by the required size. While this change affects all existing SH boards, it should be benign on platforms which don't need this alignment. Signed-off-by: Artur Rojek <contact@artur-rojek.eu> Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Tested-by: Rob Landley <rob@landley.net> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
1 parent 2014c95 commit 427011d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

arch/sh/kernel/vmlinux.lds.S

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,20 @@ SECTIONS
7171

7272
. = ALIGN(PAGE_SIZE);
7373
__init_end = .;
74-
BSS_SECTION(0, PAGE_SIZE, 4)
74+
__bss_start = .;
75+
SBSS(0)
76+
. = ALIGN(PAGE_SIZE);
77+
.bss : AT(ADDR(.bss) - LOAD_OFFSET) {
78+
BSS_FIRST_SECTIONS
79+
. = ALIGN(PAGE_SIZE);
80+
*(.bss..page_aligned)
81+
. = ALIGN(PAGE_SIZE);
82+
*(.dynbss)
83+
*(BSS_MAIN)
84+
*(COMMON)
85+
. = ALIGN(8);
86+
}
87+
__bss_stop = .;
7588
_end = . ;
7689

7790
STABS_DEBUG

0 commit comments

Comments
 (0)