riscv: vdso: fix section overlapping under some conditions
PATCH 1/1 riscv: vdso: fix section overlapping under some conditions
lkp reported a build error, I tried the config and can reproduce build error as below:
VDSOLD arch/riscv/kernel/vdso/vdso.so.dbg
ld.lld: error: section .note file range overlaps with .text
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.note range is [
0x7C8,0x803]
.text range is [0x800,0x1993]
ld.lld: error: section .text file range overlaps with .dynamic
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.text range is [
0x800,0x1993]
.dynamic range is [0x808,0x937]
ld.lld: error: section .note virtual address range overlaps with .text
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.note range is [
0x7C8,0x803]
.text range is [0x800,0x1993]
Fix it by removing the hardcoding 0x800 and related comments.
--- arch/riscv/kernel/vdso/vdso.lds.S | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
arch/riscv/kernel/vdso/vdso.lds.S +1 -7
@@ -31,13 +31,7 @@ SECTIONS .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - /* - * This linker script is used both with -r and with -shared. - * For the layouts to match, we need to skip more than enough - * space for the dynamic symbol table, etc. If this amount is - * insufficient, ld -shared will error; simply increase it here. - */ - . = 0x800; + . = ALIGN(16); .text : { *(.text .text.*) } :text .data : {
Signature · 1 line
2.37.2
Quoted 30 lines · Jisheng Zhang
lkp reported a build error, I tried the config and can reproduce build error as below:
VDSOLD
arch/riscv/kernel/vdso/vdso.so.dbg
ld.lld: error: section .note file range overlaps with .textQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
.note range is [
0x7C8,0x803]
.text range is [0x800,0x1993]ld.lld: error: section .text file range overlaps with .dynamic
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.text range is [
0x800,0x1993]
.dynamic range is [0x808,0x937]ld.lld: error: section .note virtual address range overlaps with .text
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.note range is [
0x7C8,0x803]
.text range is [0x800,0x1993]Fix it by removing the hardcoding
0x800and related comments.Reported-by kernel test robot <[email protected]>Signed-off-by Jisheng Zhang <[email protected]>--- arch/riscv/kernel/vdso/vdso.lds.S | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)arch/riscv/kernel/vdso/vdso.lds.S +0
-0
arch/riscv/kernel/vdso/vdso.lds.S SECTIONS · line 40
Quoted 10 lines
arch/riscv/kernel/vdso/vdso.lds.S +0
-7@@ -31,13 +31,7 @@ SECTIONS .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - /* - * This linker script is used both with -r and with -shared. - * For the layouts to match, we need to skip more than enough - * space for the dynamic symbol table, etc. If this amount is - * insufficient, ld -shared will error; simply increase it here. - */ - . = 0x800;
Hi Jisheng,
Removing this hard coded value is a good thing, but I don't understand why, if it was necessary before, that it's no longer necessary. Can you please explain that in the commit message? If the linker improved in this regard, then do we need to document a new minimum linker version?
arch/riscv/kernel/vdso/vdso.lds.S SECTIONS · line 34
Quoted 1 line
arch/riscv/kernel/vdso/vdso.lds.S +1
-0+ . = ALIGN(16);
Aligning text to a 4-byte boundary makes sense to me, but I don't understand the 16-byte boundary requirement. Can you please explain this for my education?
Thanks,
drew
Quoted 11 lines
arch/riscv/kernel/vdso/vdso.lds.S +0
-0.text : { *(.text .text.*) } :text .data : {Signature · 7 lines
2.37.2 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 34 lines · Andrew Jones
Quoted 33 lines · Jisheng Zhang
lkp reported a build error, I tried the config and can reproduce build error as below:
VDSOLD
arch/riscv/kernel/vdso/vdso.so.dbg
ld.lld: error: section .note file range overlaps with .textQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
.note range is [
0x7C8,0x803]
.text range is [0x800,0x1993]ld.lld: error: section .text file range overlaps with .dynamic
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.text range is [
0x800,0x1993]
.dynamic range is [0x808,0x937]ld.lld: error: section .note virtual address range overlaps with .text
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.note range is [
0x7C8,0x803]
.text range is [0x800,0x1993]Fix it by removing the hardcoding
0x800and related comments.Reported-by kernel test robot <[email protected]>Signed-off-by Jisheng Zhang <[email protected]>--- arch/riscv/kernel/vdso/vdso.lds.S | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)arch/riscv/kernel/vdso/vdso.lds.S +0
-0@@ -31,13 +31,7 @@ SECTIONS .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
Quoted 9 lines
arch/riscv/kernel/vdso/vdso.lds.S SECTIONS · line 40
Quoted 7 lines
arch/riscv/kernel/vdso/vdso.lds.S +0
-7- /* - * This linker script is used both with -r and with -shared. - * For the layouts to match, we need to skip more than enough - * space for the dynamic symbol table, etc. If this amount is - * insufficient, ld -shared will error; simply increase it here. - */ - . = 0x800;Hi Jisheng,
Hi Andrew,
Quoted 4 lines
Removing this hard coded value is a good thing, but I don't understand why, if it was necessary before, that it's no longer necessary. Can you please explain that in the commit message? If the linker improved in
To be honest, I dunno. The hardcoded 0x800 was there from day1, maybe Palmer knew the details.
Quoted 7 lines
this regard, then do we need to document a new minimum linker version?
arch/riscv/kernel/vdso/vdso.lds.S SECTIONS · line 34
Quoted 1 line
arch/riscv/kernel/vdso/vdso.lds.S +1
-0+ . = ALIGN(16);Aligning text to a 4-byte boundary makes sense to me, but I don't
Aha, I think align text to 4byte is fine. In my old memories, I was told to align function entry at 16byte boundary, I'm not sure this is still true.
PS: I just sent out v2 of this fix. The fix method is different and think v2 is the correct fix while this v1 is an improvement.