summaryrefslogtreecommitdiff
path: root/libexec/ld.so/arm
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2006-08-23 21:22:10 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2006-08-23 21:22:10 +0000
commit47a98a137d2ec982c9f58cf29c5299a6f5c8c5f2 (patch)
tree845d33bf8fca0cb2e032d3213d77c5b74ac3d2ff /libexec/ld.so/arm
parentd9b6b238fa4502d20760fcb6e02a9c550fad83fc (diff)
Support arm libraries with DT_TEXTREL, has no affect for other libraries.
ok kettenis, 'in then' deraadt@
Diffstat (limited to 'libexec/ld.so/arm')
-rw-r--r--libexec/ld.so/arm/rtld_machine.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/libexec/ld.so/arm/rtld_machine.c b/libexec/ld.so/arm/rtld_machine.c
index 7524a6a5e6e..63225443da6 100644
--- a/libexec/ld.so/arm/rtld_machine.c
+++ b/libexec/ld.so/arm/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.9 2005/09/22 01:33:08 drahn Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.10 2006/08/23 21:22:09 drahn Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -156,9 +156,6 @@ static int reloc_target_bitmask[] = {
void _dl_reloc_plt(Elf_Word *where, Elf_Addr value, Elf_Rel *rel);
-/*
-#define LD_ALLOW_WRITEABLE_TEXT
-*/
int
_dl_md_reloc(elf_object_t *object, int rel, int relsz)
{
@@ -167,9 +164,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz)
long fails = 0;
Elf_Addr loff;
Elf_Rel *rels;
-#ifdef LD_ALLOW_WRITEABLE_TEXT
struct load_list *llist;
-#endif
loff = object->load_offs;
numrel = object->Dyn.info[relsz] / sizeof(Elf_Rel);
@@ -178,11 +173,10 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz)
if (rels == NULL)
return(0);
-#ifdef LD_ALLOW_WRITEABLE_TEXT
/*
* unprotect some segments if we need it.
*/
- if ((rel == DT_REL || rel == DT_RELA)) {
+ if ((object->dyn.textrel == 1) && (rel == DT_REL || rel == DT_RELA)) {
for (llist = object->load_list;
llist != NULL;
llist = llist->next) {
@@ -191,7 +185,6 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz)
llist->prot|PROT_WRITE);
}
}
-#endif
for (i = 0; i < numrel; i++, rels++) {
Elf_Addr *where, value, ooff, mask;
@@ -307,9 +300,8 @@ resolve_failed:
}
}
-#ifdef LD_ALLOW_WRITEABLE_TEXT
/* reprotect the unprotected segments */
- if ((rel == DT_REL || rel == DT_RELA)) {
+ if ((object->dyn.textrel == 1) && (rel == DT_REL || rel == DT_RELA)) {
for (llist = object->load_list;
llist != NULL;
llist = llist->next) {
@@ -318,7 +310,6 @@ resolve_failed:
llist->prot);
}
}
-#endif
return (fails);
}