[PATCH] mips: Modify the FLAGS attribute value of text segment in PHDRS

From: Youling Tang
Date: Wed Nov 04 2020 - 05:54:03 EST


The attribute of the text segment should be read-only and executable,
FLAGS(7) should be changed to FLAGS(5), like x86, s390 architecture.

Signed-off-by: Youling Tang <tangyouling@xxxxxxxxxxx>
---
arch/mips/boot/compressed/ld.script | 2 +-
arch/mips/kernel/vmlinux.lds.S | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
index 2ed08fb..35b0315 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/ld.script
@@ -9,7 +9,7 @@
OUTPUT_ARCH(mips)
ENTRY(start)
PHDRS {
- text PT_LOAD FLAGS(7); /* RWX */
+ text PT_LOAD FLAGS(5); /* R_X */
}
SECTIONS
{
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 5e97e9d..545c4a9 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -22,7 +22,7 @@
OUTPUT_ARCH(mips)
ENTRY(kernel_entry)
PHDRS {
- text PT_LOAD FLAGS(7); /* RWX */
+ text PT_LOAD FLAGS(5); /* R_X */
#ifndef CONFIG_CAVIUM_OCTEON_SOC
note PT_NOTE FLAGS(4); /* R__ */
#endif /* CAVIUM_OCTEON_SOC */
--
2.1.0