Skip to contentSkip to conversation

RISC-V: Stop putting .sbss in .sdata

PATCH In review Palmer Dabbelt 2 participants 3 messages Feb 18, 2020 – Feb 19, 2020 RISC-V

lore
Share & tools
lore

Palmer Dabbelt

author maintainer
#0 lore raw

PATCH 1/1 RISC-V: Stop putting .sbss in .sdata

From: Palmer Dabbelt <[email protected]>

I don't know why we were doing this, as it's been there since the beginning. After d841f729e655 ("riscv: force hart_lottery to put in .sdata section") my guess would be that it made the kernel boot and we forgot to fix it more cleanly.

The default .bss segment already contains the .sbss section, so we don't need to do anything additional to ensure the symbols in .sbss continue to work.

---
 arch/riscv/kernel/vmlinux.lds.S | 1 -
 1 file changed, 1 deletion(-)
arch/riscv/kernel/vmlinux.lds.S +0 -1
index 1e0193ded420..a8fb52a00295 100644
@@ -64,7 +64,6 @@ SECTIONS
 		*(.sdata*)
 		/* End of data section */
 		_edata = .;
-		*(.sbss*)
 	}
 
 	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
Signature · 1 line
2.25.0.265.gbab2e86ba0-goog
Tested-by on v1 1/1
#1 lore raw
Quoted 29 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

I don't know why we were doing this, as it's been there since the beginning. After d841f729e655 ("riscv: force hart_lottery to put in .sdata section") my guess would be that it made the kernel boot and we forgot to fix it more cleanly.

The default .bss segment already contains the .sbss section, so we don't need to do anything additional to ensure the symbols in .sbss continue to work.

---
 arch/riscv/kernel/vmlinux.lds.S | 1 -
 1 file changed, 1 deletion(-)
arch/riscv/kernel/vmlinux.lds.S +0 -2
index 1e0193ded420..a8fb52a00295 100644
@@ -64,7 +64,6 @@ SECTIONS
                *(.sdata*)
                /* End of data section */
                _edata = .;
-               *(.sbss*)
        }
 
        BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
--
Quoted 2 lines

2.25.0.265.gbab2e86ba0-goog

I had given a quick test for that. It works on RV32 and RV64.

author maintainer
#2 lore raw
Quoted 28 lines · On Wed, 19 Feb 2020 01:26:09 PST (-0800), [email protected] wrote:
Quoted 27 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

I don't know why we were doing this, as it's been there since the beginning. After d841f729e655 ("riscv: force hart_lottery to put in .sdata section") my guess would be that it made the kernel boot and we forgot to fix it more cleanly.

The default .bss segment already contains the .sbss section, so we don't need to do anything additional to ensure the symbols in .sbss continue to work.

---
 arch/riscv/kernel/vmlinux.lds.S | 1 -
 1 file changed, 1 deletion(-)
arch/riscv/kernel/vmlinux.lds.S +0 -1
index 1e0193ded420..a8fb52a00295 100644
@@ -64,7 +64,6 @@ SECTIONS
                *(.sdata*)
                /* End of data section */
                _edata = .;
-               *(.sbss*)
        }
 
Quoted 8 lines
Quoted 4 lines
arch/riscv/kernel/vmlinux.lds.S +0 -1
        BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
--

2.25.0.265.gbab2e86ba0-goog

I had given a quick test for that. It works on RV32 and RV64.

Thanks!