From 56ea76b6bf190bffdc07aba90e4b25dfc096027b Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Mon, 11 Apr 2011 13:13:18 +0200 Subject: Fix nommu handling of DT_TEXTREL We have a problem with DT_TEXTREL shared libraries on nommu machines. The dynamic linker's strategy is to map the text segment read-only first, then look for DT_TEXTREL, and use mprotect to change protections if necessary. This fails on nommu, since a nommu kernel can decide to share the memory for private read-only file mappings, and mprotect doesn't (can't) do anything about this sharing. Existing nommu targets apparently have no need for this, but on C6X, we may need to assign library indices at run-time if no --dsbt-index option was passed to the linker at build time. Hence, the following patch, which instead of using mprotect, redoes the mapping with PF_W set. Signed-off-by: Bernd Schmidt --- ldso/include/dl-elf.h | 2 +- ldso/include/ldso.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'ldso/include') diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index 7fbb373b4..e7203fd8f 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -184,7 +184,7 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info ADJUST_DYN_INFO(DT_DSBT_BASE_IDX, load_off); /* Initialize loadmap dsbt info. */ - load_off.map->dsbt_table = dynamic_info[DT_DSBT_BASE_IDX]; + load_off.map->dsbt_table = (void *)dynamic_info[DT_DSBT_BASE_IDX]; load_off.map->dsbt_size = dynamic_info[DT_DSBT_SIZE_IDX]; load_off.map->dsbt_index = dynamic_info[DT_DSBT_INDEX_IDX]; #endif diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index 69b5dd75a..95bcd14a4 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -34,6 +34,8 @@ #include /* Pull in the arch specific page size */ #include +/* Pull in the MIN macro */ +#include /* Pull in the ldso syscalls and string functions */ #ifndef __ARCH_HAS_NO_SHARED__ #include -- cgit v1.2.3