From 348b0266d8dce0930c42a1699ec68defa786c86e Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Thu, 16 May 2019 14:26:52 -0700 Subject: [PATCH] x86: Make .rodata readonly During the conversion of .bin to .o objcopy was not setting the section to be readonly causing the .rodata in the final image has write permission. Signed-off-by: Flavio Ceolin --- arch/x86/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/CMakeLists.txt b/arch/x86/CMakeLists.txt index 3b1ecb492d4..ffa62484ac4 100644 --- a/arch/x86/CMakeLists.txt +++ b/arch/x86/CMakeLists.txt @@ -88,7 +88,7 @@ function(add_bin_file_to_the_next_link target_dependency bin) -I binary -B ${OUTPUT_ARCH} -O ${OUTPUT_FORMAT} - --rename-section .data=${bin} + --rename-section .data=${bin},CONTENTS,ALLOC,LOAD,READONLY,DATA ${bin}.bin ${bin}.o DEPENDS ${target_dependency} ${bin}.bin