path: root/drivers/misc/lkdtm/Makefile
diff options
authorNick Desaulniers <>2019-05-15 11:24:41 -0700
committerGreg Kroah-Hartman <>2019-07-14 08:11:21 +0200
commit294b893a41cd031394d734524bc1eebbef0707cd (patch)
tree471d95bdbbccecd083725df8127a9f7ffa2aa115 /drivers/misc/lkdtm/Makefile
parent5c90a2ecd08a53bcfd45dc219876573821b33265 (diff)
lkdtm: support llvm-objcopy
commit e9e08a07385e08f1a7f85c5d1e345c21c9564963 upstream. With CONFIG_LKDTM=y and make OBJCOPY=llvm-objcopy, llvm-objcopy errors: llvm-objcopy: error: --set-section-flags=.text conflicts with --rename-section=.text=.rodata Rather than support setting flags then renaming sections vs renaming then setting flags, it's simpler to just change both at the same time via --rename-section. Adding the load flag is required for GNU objcopy to mark .rodata Type as PROGBITS after the rename. This can be verified with: $ readelf -S drivers/misc/lkdtm/rodata_objcopy.o ... Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [ 1] .rodata PROGBITS 0000000000000000 00000040 0000000000000004 0000000000000000 A 0 0 4 ... Which shows that .text is now renamed .rodata, the alloc flag A is set, the type is PROGBITS, and the section is not flagged as writeable W. Cc: Link: Link: Reported-by: Nathan Chancellor <> Suggested-by: Alan Modra <> Suggested-by: Jordan Rupprect <> Suggested-by: Kees Cook <> Acked-by: Kees Cook <> Reviewed-by: Nathan Chancellor <> Signed-off-by: Nick Desaulniers <> Signed-off-by: Greg Kroah-Hartman <>
Diffstat (limited to 'drivers/misc/lkdtm/Makefile')
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
index 3370a4138e94..cce47a15a79f 100644
--- a/drivers/misc/lkdtm/Makefile
+++ b/drivers/misc/lkdtm/Makefile
@@ -13,8 +13,7 @@ KCOV_INSTRUMENT_rodata.o := n
OBJCOPYFLAGS_rodata_objcopy.o := \
- --set-section-flags .text=alloc,readonly \
- --rename-section .text=.rodata
+ --rename-section .text=.rodata,alloc,readonly,load
targets += rodata.o rodata_objcopy.o
$(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
$(call if_changed,objcopy)