summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-01-26 11:22:42 -0600
committerWaldemar Brodkorb <wbx@openadk.org>2015-01-26 11:22:42 -0600
commitf03fbbb009c0df52d363719a592e2ac33577d9a6 (patch)
tree01671bcc5099ef304faf5ae86d58bbf32f9d0b7c /ldso
parent97dc8cb71d96a4bbfda0aa51740433d5da825b6a (diff)
parent92de8a5f6ffb1ff9f7183fd08d872aa098b75ae2 (diff)
merge upstream changes
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/xtensa/dl-startup.h20
-rw-r--r--ldso/ldso/xtensa/dl-sysdep.h24
-rw-r--r--ldso/ldso/xtensa/resolve.S7
3 files changed, 42 insertions, 9 deletions
diff --git a/ldso/ldso/xtensa/dl-startup.h b/ldso/ldso/xtensa/dl-startup.h
index 70a6255d9..8fe54a3c7 100644
--- a/ldso/ldso/xtensa/dl-startup.h
+++ b/ldso/ldso/xtensa/dl-startup.h
@@ -83,6 +83,7 @@ do { \
unsigned long l_addr = tpnt->loadaddr; \
Elf32_Word relative_count; \
unsigned long rel_addr; \
+ Elf32_Addr prev_got_start = 0, prev_got_end = 0; \
int x; \
\
got_loc = (xtensa_got_location *) \
@@ -93,7 +94,24 @@ do { \
got_start = got_loc[x].offset & ~(PAGE_SIZE - 1); \
got_end = ((got_loc[x].offset + got_loc[x].length + PAGE_SIZE - 1) \
& ~(PAGE_SIZE - 1)); \
- _dl_mprotect ((void *)(got_start + l_addr), got_end - got_start, \
+ if (got_end >= prev_got_start && got_start <= prev_got_end) { \
+ if (got_end > prev_got_end) \
+ prev_got_end = got_end; \
+ if (got_start < prev_got_start) \
+ prev_got_start = got_start; \
+ continue; \
+ } else if (prev_got_start != prev_got_end) { \
+ _dl_mprotect ((void *)(prev_got_start + l_addr), \
+ prev_got_end - prev_got_start, \
+ PROT_READ | PROT_WRITE | PROT_EXEC); \
+ } \
+ prev_got_start = got_start; \
+ prev_got_end = got_end; \
+ } \
+\
+ if (prev_got_start != prev_got_end) { \
+ _dl_mprotect ((void *)(prev_got_start + l_addr), \
+ prev_got_end - prev_got_start, \
PROT_READ | PROT_WRITE | PROT_EXEC); \
} \
\
diff --git a/ldso/ldso/xtensa/dl-sysdep.h b/ldso/ldso/xtensa/dl-sysdep.h
index 148de5b95..d308237d3 100644
--- a/ldso/ldso/xtensa/dl-sysdep.h
+++ b/ldso/ldso/xtensa/dl-sysdep.h
@@ -36,6 +36,7 @@ typedef struct xtensa_got_location_struct {
do { \
xtensa_got_location *got_loc; \
Elf32_Addr l_addr = MODULE->loadaddr; \
+ Elf32_Addr prev_got_start = 0, prev_got_end = 0; \
int x; \
\
got_loc = (xtensa_got_location *) \
@@ -47,7 +48,28 @@ typedef struct xtensa_got_location_struct {
got_start = got_loc[x].offset & ~(PAGE_SIZE - 1); \
got_end = ((got_loc[x].offset + got_loc[x].length + PAGE_SIZE - 1) \
& ~(PAGE_SIZE - 1)); \
- _dl_mprotect ((void *)(got_start + l_addr) , got_end - got_start, \
+ if (got_end >= prev_got_start && got_start <= prev_got_end) \
+ { \
+ if (got_end > prev_got_end) \
+ prev_got_end = got_end; \
+ if (got_start < prev_got_start) \
+ prev_got_start = got_start; \
+ continue; \
+ } \
+ else if (prev_got_start != prev_got_end) \
+ { \
+ _dl_mprotect ((void *)(prev_got_start + l_addr), \
+ prev_got_end - prev_got_start, \
+ PROT_READ | PROT_WRITE | PROT_EXEC); \
+ } \
+ prev_got_start = got_start; \
+ prev_got_end = got_end; \
+ } \
+ \
+ if (prev_got_start != prev_got_end) \
+ { \
+ _dl_mprotect ((void *)(prev_got_start + l_addr), \
+ prev_got_end - prev_got_start, \
PROT_READ | PROT_WRITE | PROT_EXEC); \
} \
\
diff --git a/ldso/ldso/xtensa/resolve.S b/ldso/ldso/xtensa/resolve.S
index d1ae8aa04..8061af247 100644
--- a/ldso/ldso/xtensa/resolve.S
+++ b/ldso/ldso/xtensa/resolve.S
@@ -31,13 +31,6 @@
.global _dl_linux_resolve
.type _dl_linux_resolve, @function
_dl_linux_resolve:
- /* Fix up the high 2 bits of the return address. */
- movi a13, 0f
- slli a12, a0, 2
-0: extui a13, a13, 30, 2
- ssai 2
- src a12, a13, a12
-
/* Call the fixup function. */
movi a8, _dl_linux_resolver
callx8 a8