summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-01-02 12:16:36 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-01-02 12:16:36 +0000
commit4f326cf2825008ca1b36472028d1020626c5fec8 (patch)
tree6b2d9fff4f220ef42b68697b08c8035a41bc8439 /libexec
parentc687cfed448255b6460411891ac062c4d070679f (diff)
Fix handling of hppa RELOC_IPLT relocations during 'bootstrap relocation'.
ok miod@, deraadt@, jsing@
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/alpha/archdep.h5
-rw-r--r--libexec/ld.so/amd64/archdep.h5
-rw-r--r--libexec/ld.so/arm/archdep.h5
-rw-r--r--libexec/ld.so/hppa/archdep.h8
-rw-r--r--libexec/ld.so/i386/archdep.h5
-rw-r--r--libexec/ld.so/loader.c4
-rw-r--r--libexec/ld.so/mips64/archdep.h4
-rw-r--r--libexec/ld.so/powerpc/archdep.h5
-rw-r--r--libexec/ld.so/sh/archdep.h5
-rw-r--r--libexec/ld.so/sparc/archdep.h5
-rw-r--r--libexec/ld.so/sparc64/archdep.h5
11 files changed, 33 insertions, 23 deletions
diff --git a/libexec/ld.so/alpha/archdep.h b/libexec/ld.so/alpha/archdep.h
index bae7963d977..3c77ae42cdf 100644
--- a/libexec/ld.so/alpha/archdep.h
+++ b/libexec/ld.so/alpha/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.12 2004/05/24 20:16:12 drahn Exp $ */
+/* $OpenBSD: archdep.h,v 1.13 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -51,7 +51,8 @@ RELOC_REL(Elf64_Rel *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v)
}
static inline void
-RELOC_RELA(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v)
+RELOC_RELA(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v,
+ Elf_Addr *pltgot)
{
if (ELF64_R_TYPE(r->r_info) == RELOC_RELATIVE) {
/* handled by _reloc_alpha_got */
diff --git a/libexec/ld.so/amd64/archdep.h b/libexec/ld.so/amd64/archdep.h
index 21b156fe594..364123f0476 100644
--- a/libexec/ld.so/amd64/archdep.h
+++ b/libexec/ld.so/amd64/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.3 2004/05/24 20:16:12 drahn Exp $ */
+/* $OpenBSD: archdep.h,v 1.4 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -66,7 +66,8 @@ RELOC_REL(Elf64_Rel *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v)
}
static inline void
-RELOC_RELA(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v)
+RELOC_RELA(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v,
+ Elf_Addr *pltgot)
{
if (ELF64_R_TYPE(r->r_info) == R_X86_64_RELATIVE) {
*p = v + r->r_addend;
diff --git a/libexec/ld.so/arm/archdep.h b/libexec/ld.so/arm/archdep.h
index 4f08415ceca..d9ffdbfc6cb 100644
--- a/libexec/ld.so/arm/archdep.h
+++ b/libexec/ld.so/arm/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.3 2004/05/24 20:16:12 drahn Exp $ */
+/* $OpenBSD: archdep.h,v 1.4 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -73,7 +73,8 @@ RELOC_REL(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
}
static inline void
-RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v)
+RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v,
+ Elf_Addr *pltgot)
{
_dl_exit(20);
}
diff --git a/libexec/ld.so/hppa/archdep.h b/libexec/ld.so/hppa/archdep.h
index 83ce7ec38fc..250553bb42d 100644
--- a/libexec/ld.so/hppa/archdep.h
+++ b/libexec/ld.so/hppa/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.4 2008/04/09 21:45:26 kurt Exp $ */
+/* $OpenBSD: archdep.h,v 1.5 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 2004 Michael Shalayeff
@@ -74,13 +74,15 @@ RELOC_REL(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
* prepare to code around this problem, or fix it here.
*/
static inline void
-RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
+RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v,
+ Elf_Addr *pltgot)
{
/* XXX fille out _sl ??? */
if (ELF_R_TYPE(r->r_info) == RELOC_DIR32) {
*p = v + r->r_addend;
} else if (ELF_R_TYPE(r->r_info) == RELOC_IPLT) {
- *p = v + s->st_value + r->r_addend;
+ p[0] = v + s->st_value + r->r_addend;
+ p[1] = (Elf_Addr)pltgot;
} else if (ELF_R_TYPE(r->r_info) == RELOC_PLABEL32) {
*p = v + s->st_value + r->r_addend;
} else {
diff --git a/libexec/ld.so/i386/archdep.h b/libexec/ld.so/i386/archdep.h
index 3f5ca911982..57badd1c871 100644
--- a/libexec/ld.so/i386/archdep.h
+++ b/libexec/ld.so/i386/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.10 2004/05/24 20:16:12 drahn Exp $ */
+/* $OpenBSD: archdep.h,v 1.11 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -74,7 +74,8 @@ RELOC_REL(Elf32_Rel *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v)
}
static inline void
-RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v)
+RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v,
+ Elf_Addr *pltgot)
{
/* does i386 use RELA type relocations? - XXX */
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index f64f12b3daa..1b577effa47 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.117 2009/02/04 19:44:51 kettenis Exp $ */
+/* $OpenBSD: loader.c,v 1.118 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -776,7 +776,7 @@ _dl_boot_bind(const long sp, long *dl_data, Elf_Dyn *dynamicp)
}
ra = (Elf_Addr *)(rp->r_offset + loff);
- RELOC_RELA(rp, sp, ra, loff);
+ RELOC_RELA(rp, sp, ra, loff, dynld.dyn.pltgot);
rp++;
}
}
diff --git a/libexec/ld.so/mips64/archdep.h b/libexec/ld.so/mips64/archdep.h
index 637143d4e88..300af59709d 100644
--- a/libexec/ld.so/mips64/archdep.h
+++ b/libexec/ld.so/mips64/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.5 2006/05/08 20:37:01 deraadt Exp $ */
+/* $OpenBSD: archdep.h,v 1.6 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998-2002 Opsycon AB, Sweden.
@@ -52,7 +52,7 @@ do { \
} \
} while (0)
-#define RELOC_RELA(rela, sym, ptr, val) \
+#define RELOC_RELA(rela, sym, ptr, val, pltgot) \
do { \
_dl_exit(20); /* We don't do RELA now */ \
} while (0)
diff --git a/libexec/ld.so/powerpc/archdep.h b/libexec/ld.so/powerpc/archdep.h
index e0d5cd1f94b..49fdbd0734c 100644
--- a/libexec/ld.so/powerpc/archdep.h
+++ b/libexec/ld.so/powerpc/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.13 2004/05/24 20:16:12 drahn Exp $ */
+/* $OpenBSD: archdep.h,v 1.14 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -73,7 +73,8 @@ RELOC_REL(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
}
static inline void
-RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v)
+RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v,
+ Elf_Addr *pltgot)
{
if (ELF32_R_TYPE(r->r_info) == RELOC_RELATIVE) {
*p = v + r->r_addend;
diff --git a/libexec/ld.so/sh/archdep.h b/libexec/ld.so/sh/archdep.h
index a4b71daa2fc..7c1bbc54082 100644
--- a/libexec/ld.so/sh/archdep.h
+++ b/libexec/ld.so/sh/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.1 2006/11/10 07:44:58 drahn Exp $ */
+/* $OpenBSD: archdep.h,v 1.2 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -75,7 +75,8 @@ RELOC_REL(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
}
static inline void
-RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v)
+RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v,
+ Elf_Addr *pltgot)
{
if (ELF_R_TYPE(r->r_info) == R_SH_RELATIVE) {
*p = v + r->r_addend;
diff --git a/libexec/ld.so/sparc/archdep.h b/libexec/ld.so/sparc/archdep.h
index 5b8bca11905..509b17c922f 100644
--- a/libexec/ld.so/sparc/archdep.h
+++ b/libexec/ld.so/sparc/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.8 2004/05/24 20:16:12 drahn Exp $ */
+/* $OpenBSD: archdep.h,v 1.9 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -61,7 +61,8 @@ RELOC_REL(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
}
static inline void
-RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
+RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v,
+ Elf_Addr *pltgot)
{
if (ELF_R_TYPE(r->r_info) == R_TYPE(NONE)) {
} else if (ELF_R_TYPE(r->r_info) == R_TYPE(RELATIVE)) {
diff --git a/libexec/ld.so/sparc64/archdep.h b/libexec/ld.so/sparc64/archdep.h
index 86aa167e33d..61e32e7e820 100644
--- a/libexec/ld.so/sparc64/archdep.h
+++ b/libexec/ld.so/sparc64/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.17 2004/05/24 20:16:12 drahn Exp $ */
+/* $OpenBSD: archdep.h,v 1.18 2010/01/02 12:16:35 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -61,7 +61,8 @@ RELOC_REL(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
}
static inline void
-RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
+RELOC_RELA(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v,
+ Elf_Addr *pltgot)
{
if (ELF_R_TYPE(r->r_info) == RELOC_RELATIVE) {
*p = v + r->r_addend;