Skip to content

Commit 41fb9d5

Browse files
Revert "RISC-V: Make BSS section as the last section in vmlinux.lds.S"
At least BBL relies on the flat binaries containing all the bytes in the actual image to exist in the file. Before this revert the flat images dropped the trailing zeros, which caused BBL to put its copy of the device tree where Linux thought the BSS was, which wreaks all sorts of havoc. Manifesting the bug is a bit subtle because BBL aligns everything to 2MiB page boundaries, but with large enough kernels you're almost certain to get bitten by the bug. While moving the sections around isn't a great long-term fix, it will at least avoid producing broken images. This reverts commit 22e6a2e. Signed-off-by: Palmer Dabbelt <palmer@sifive.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent e3613bb commit 41fb9d5

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

arch/riscv/kernel/vmlinux.lds.S

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include <asm/cache.h>
1919
#include <asm/thread_info.h>
2020

21-
#define MAX_BYTES_PER_LONG 0x10
22-
2321
OUTPUT_ARCH(riscv)
2422
ENTRY(_start)
2523

@@ -76,17 +74,15 @@ SECTIONS
7674
*(.sbss*)
7775
}
7876

77+
BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
78+
7979
EXCEPTION_TABLE(0x10)
8080
NOTES
8181

8282
.rel.dyn : {
8383
*(.rel.dyn*)
8484
}
8585

86-
BSS_SECTION(MAX_BYTES_PER_LONG,
87-
MAX_BYTES_PER_LONG,
88-
MAX_BYTES_PER_LONG)
89-
9086
_end = .;
9187

9288
STABS_DEBUG

0 commit comments

Comments
 (0)