Skip to contentSkip to conversation

RISC-V: build: Disable LTO for the vDSO

PATCH Superseded Wende Tan 2 participants 3 messages Jul 19, 2021 – Jul 20, 2021 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wende Tan

author
#0 lore raw

PATCH 2/3 RISC-V: build: Disable LTO for the vDSO

Disable LTO for the vDSO as done for x86 [1] and arm64 [2]. This also disables CFI for it [3].

[1] https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/
[2] https://patchwork.kernel.org/project/kernel-hardening/patch/[email protected]/
[3] https://lore.kernel.org/bpf/CABCJKucpFHC-9rvT7uNF+E-Jh20fz69zdO49_4p8G_Sb634qmw@mail.gmail.com/

---
 arch/riscv/kernel/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/vdso/Makefile +1 -1
index 24d936c147cd..4535a77792be 100644
@@ -30,7 +30,7 @@ obj-y += vdso.o vdso-syms.o
 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
 
 # Disable -pg to prevent insert call site
-CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
+CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_LTO)
 
 # Disable profiling and instrumentation for VDSO code
 GCOV_PROFILE := n
Signature · 7 lines
2.25.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw
Quoted 7 lines · Wende Tan

Disable LTO for the vDSO as done for x86 [1] and arm64 [2]. This also disables CFI for it [3].

[1] https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/
[2] https://patchwork.kernel.org/project/kernel-hardening/patch/[email protected]/
[3] https://lore.kernel.org/bpf/CABCJKucpFHC-9rvT7uNF+E-Jh20fz69zdO49_4p8G_Sb634qmw@mail.gmail.com/

It might be nicer to use the typical form for commits:
commit <12 char sha> ("<oneline>")
rather than a mix of patchwork and lore links.

Do you have a list of diagnostics produced when building this object file with LTO enabled?

Quoted 21 lines
---
 arch/riscv/kernel/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/vdso/Makefile +1 -2
index 24d936c147cd..4535a77792be 100644
@@ -30,7 +30,7 @@ obj-y += vdso.o vdso-syms.o
 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
 
 # Disable -pg to prevent insert call site
-CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
+CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_LTO)
 
 # Disable profiling and instrumentation for VDSO code
 GCOV_PROFILE := n
--

2.25.1

Signature · 7 lines
Thanks,
~Nick Desaulniers

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
author
#2 lore raw
Quoted 10 lines · Nick Desaulniers
Quoted 6 lines · Wende Tan

Disable LTO for the vDSO as done for x86 [1] and arm64 [2]. This also disables CFI for it [3].

[1] https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/
[2] https://patchwork.kernel.org/project/kernel-hardening/patch/[email protected]/
[3] https://lore.kernel.org/bpf/CABCJKucpFHC-9rvT7uNF+E-Jh20fz69zdO49_4p8G_Sb634qmw@mail.gmail.com/

It might be nicer to use the typical form for commits:
commit <12 char sha> ("<oneline>")
rather than a mix of patchwork and lore links.

commit 004d53f8c96f ("arm64: vdso: disable LTO") commit e242db40be27 ("x86, vdso: disable LTO only for vDSO")

I can put these into the next version.

Quoted 2 lines

Do you have a list of diagnostics produced when building this object file with LTO enabled?

Oh, this object can be built with LTO with no issue, but x86 and arm64 seem to disable LTO for it due to no noticeable benefit for the small amount of C code.

Quoted 12 lines
Quoted 12 lines
---
 arch/riscv/kernel/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/vdso/Makefile +0 -0
index 24d936c147cd..4535a77792be 100644
@@ -30,7 +30,7 @@ obj-y += vdso.o vdso-syms.o
 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
 
Quoted 8 lines
Quoted 8 lines
arch/riscv/kernel/vdso/Makefile +1 -2
 # Disable -pg to prevent insert call site
-CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
+CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_LTO)
 
 # Disable profiling and instrumentation for VDSO code
 GCOV_PROFILE := n
--

2.25.1

Thanks.
Wende

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv