From 8b172bf22ebfa4305ab8cb73cec859fb472c5ba0 Mon Sep 17 00:00:00 2001 From: Piotr Tworek Date: Wed, 9 Dec 2020 00:15:27 +0100 Subject: [PATCH] base: Explicitly state ELF segment flags The code in base-hw/src/bootstrap/platform.cc uses segment flags for identification purposes. Based on this information the code decides what to do with each segment. Unfortunately the linker script does not actually ensure the flags for a specific named segment match expectations. The code relies on implicit linker behaviour. This implicit behaviour can vary between linkers. This breaks arm_v7a base-hw builds linked with LLVM's lld linker. The segment named "ro" ends up having writeable flag set when using LLD. This patch ensures that all ELF segments in genode.ld have their required perimssion flags set explicitly. Fixes #3988 --- repos/base/src/ld/genode.ld | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repos/base/src/ld/genode.ld b/repos/base/src/ld/genode.ld index 1179c69e12..2093d00afe 100644 --- a/repos/base/src/ld/genode.ld +++ b/repos/base/src/ld/genode.ld @@ -15,8 +15,8 @@ ENTRY(_start) PHDRS { - ro PT_LOAD; - rw PT_LOAD; + ro PT_LOAD FLAGS(5); + rw PT_LOAD FLAGS(6); boot PT_LOAD FLAGS(4); }