lkdtm: avoid link error on ARM
Arnd Bergmann
maintainerPATCH 1/1 lkdtm: avoid link error on ARM
The lkdtm_rodata file is built so that a function in it gets linked into the .rodata ELF section. This works fine normally, but on 32-bit ARM with really large kernels, it prevents the linker from inserting a veneer for the call to __gnu_mcount_nc in case we are building with "gcc -pg":
drivers/misc/built-in.o: In function `lkdtm_rodata_do_nothing':
panel.c:(.rodata+0x1480): relocation truncated to fit: R_ARM_CALL against symbol `__gnu_mcount_nc' defined in .text section in arch/arm/kernel/built-in.o
We probably never want the profiling code to be enabled for this file anyway, so this just removes the option here, and for the sake of consistency also in the lkdtm core module.
--- drivers/misc/Makefile | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/Makefile +2 -0
@@ -60,6 +60,8 @@ obj-$(CONFIG_PANEL) += panel.o lkdtm-$(CONFIG_LKDTM) += lkdtm_core.o lkdtm-$(CONFIG_LKDTM) += lkdtm_rodata_objcopy.o +CFLAGS_REMOVE_lkdtm_core.o += -pg +CFLAGS_REMOVE_lkdtm_rodata.o += -pg OBJCOPYFLAGS := OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \
Signature · 1 line
2.9.0
Quoted 9 lines · Arnd Bergmann
The
lkdtm_rodatafile is built so that a function in it gets linked into the .rodata ELF section. This works fine normally, but on 32-bit ARM with really large kernels, it prevents the linker from inserting a veneer for the call to__gnu_mcount_ncin case we are building with "gcc -pg":
drivers/misc/built-in.o: In function `lkdtm_rodata_do_nothing':
panel.c:(.rodata+0x1480): relocation truncated to fit:R_ARM_CALLagainst symbol `__gnu_mcount_nc' defined in .text section inarch/arm/kernel/built-in.o
Quoted 6 lines
We probably never want the profiling code to be enabled for this file anyway, so this just removes the option here, and for the sake of consistency also in the lkdtm core module.
Signed-off-by Arnd Bergmann <[email protected]>Fixes 9a49a528dcf3 ("lkdtm: add function for testing .rodata section")
Looks fine to me, thanks!
Greg, can you take this into your tree for -next?
Thanks!
-Kees
Quoted 20 lines
--- drivers/misc/Makefile | 2 ++ 1 file changed, 2 insertions(+)drivers/misc/Makefile +2
-1@@ -60,6 +60,8 @@ obj-$(CONFIG_PANEL) += panel.o lkdtm-$(CONFIG_LKDTM) += lkdtm_core.o lkdtm-$(CONFIG_LKDTM) += lkdtm_rodata_objcopy.o +CFLAGS_REMOVE_lkdtm_core.o += -pg +CFLAGS_REMOVE_lkdtm_rodata.o += -pg OBJCOPYFLAGS := OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \ --2.9.0
Signature · 2 lines
Kees Cook Chrome OS & Brillo Security
Greg Kroah-Hartman
maintainerQuoted 14 lines · Kees Cook
Quoted 13 lines · Arnd Bergmann
The
lkdtm_rodatafile is built so that a function in it gets linked into the .rodata ELF section. This works fine normally, but on 32-bit ARM with really large kernels, it prevents the linker from inserting a veneer for the call to__gnu_mcount_ncin case we are building with "gcc -pg":
drivers/misc/built-in.o: In function `lkdtm_rodata_do_nothing':
panel.c:(.rodata+0x1480): relocation truncated to fit:R_ARM_CALLagainst symbol `__gnu_mcount_nc' defined in .text section inarch/arm/kernel/built-in.oWe probably never want the profiling code to be enabled for this file anyway, so this just removes the option here, and for the sake of consistency also in the lkdtm core module.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Arnd Bergmann <[email protected]>Fixes 9a49a528dcf3 ("lkdtm: add function for testing .rodata section")Looks fine to me, thanks!
Acked-by Kees Cook <[email protected]>Greg, can you take this into your tree for -next?
Yes,will do.