about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-06-16 03:09:07 -0400
committerRich Felker <dalias@aerifal.cx>2014-06-16 03:09:07 -0400
commitbfa09700b927c99cff5263483c1d7a4d1fe766e5 (patch)
tree2cb41b425402212a2916e00d3108edd045552664
parent4e5c7a2176773c9a1564c6603240337b3ad6b496 (diff)
downloadmusl-bfa09700b927c99cff5263483c1d7a4d1fe766e5.tar.gz
musl-bfa09700b927c99cff5263483c1d7a4d1fe766e5.tar.xz
musl-bfa09700b927c99cff5263483c1d7a4d1fe766e5.zip
dynamic linker: permit error returns from arch-specific reloc function
the immediate motivation is supporting TLSDESC relocations which
require allocation and thus may fail (unless we pre-allocate), but
this mechanism should also be used for throwing an error on
unsupported or invalid relocation types, and perhaps in certain cases,
for reporting when a relocation is not satisfiable.
-rw-r--r--arch/arm/reloc.h3
-rw-r--r--arch/i386/reloc.h3
-rw-r--r--arch/microblaze/reloc.h3
-rw-r--r--arch/mips/reloc.h3
-rw-r--r--arch/powerpc/reloc.h3
-rw-r--r--arch/sh/reloc.h3
-rw-r--r--arch/x32/reloc.h3
-rw-r--r--arch/x86_64/reloc.h3
8 files changed, 16 insertions, 8 deletions
diff --git a/arch/arm/reloc.h b/arch/arm/reloc.h
index 264b7ab2..27c606d4 100644
--- a/arch/arm/reloc.h
+++ b/arch/arm/reloc.h
@@ -19,7 +19,7 @@
 #define IS_COPY(x) ((x)==R_ARM_COPY)
 #define IS_PLT(x) ((x)==R_ARM_JUMP_SLOT)
 
-static inline void do_single_reloc(
+static inline int do_single_reloc(
 	struct dso *self, unsigned char *base_addr,
 	size_t *reloc_addr, int type, size_t addend,
 	Sym *sym, size_t sym_size,
@@ -51,6 +51,7 @@ static inline void do_single_reloc(
 			: self->tls_offset + 8;
 		break;
 	}
+	return 0;
 }
 
 #define NO_LEGACY_INITFINI
diff --git a/arch/i386/reloc.h b/arch/i386/reloc.h
index 3923b54b..bc86e96e 100644
--- a/arch/i386/reloc.h
+++ b/arch/i386/reloc.h
@@ -6,7 +6,7 @@
 #define IS_COPY(x) ((x)==R_386_COPY)
 #define IS_PLT(x) ((x)==R_386_JMP_SLOT)
 
-static inline void do_single_reloc(
+static inline int do_single_reloc(
 	struct dso *self, unsigned char *base_addr,
 	size_t *reloc_addr, int type, size_t addend,
 	Sym *sym, size_t sym_size,
@@ -46,4 +46,5 @@ static inline void do_single_reloc(
 			: self->tls_offset;
 		break;
 	}
+	return 0;
 }
diff --git a/arch/microblaze/reloc.h b/arch/microblaze/reloc.h
index 7bf3a5b0..f2f6c3a0 100644
--- a/arch/microblaze/reloc.h
+++ b/arch/microblaze/reloc.h
@@ -13,7 +13,7 @@
 #define IS_COPY(x) ((x)==R_MICROBLAZE_COPY)
 #define IS_PLT(x) ((x)==R_MICROBLAZE_JUMP_SLOT)
 
-static inline void do_single_reloc(
+static inline int do_single_reloc(
 	struct dso *self, unsigned char *base_addr,
 	size_t *reloc_addr, int type, size_t addend,
 	Sym *sym, size_t sym_size,
@@ -38,6 +38,7 @@ static inline void do_single_reloc(
 		*reloc_addr = def.sym->st_value + addend;
 		break;
 	}
+	return 0;
 }
 
 #include "syscall.h"
diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h
index 4ca81257..08d139da 100644
--- a/arch/mips/reloc.h
+++ b/arch/mips/reloc.h
@@ -19,7 +19,7 @@
 #define IS_COPY(x) ((x)==R_MIPS_COPY)
 #define IS_PLT(x) 1
 
-static inline void do_single_reloc(
+static inline int do_single_reloc(
 	struct dso *self, unsigned char *base_addr,
 	size_t *reloc_addr, int type, size_t addend,
 	Sym *sym, size_t sym_size,
@@ -48,6 +48,7 @@ static inline void do_single_reloc(
 			: self->tls_offset - 0x7000;
 		break;
 	}
+	return 0;
 }
 
 void __reloc_self(int c, size_t *a, size_t *dynv, size_t *got)
diff --git a/arch/powerpc/reloc.h b/arch/powerpc/reloc.h
index 38034c56..d5ba74a7 100644
--- a/arch/powerpc/reloc.h
+++ b/arch/powerpc/reloc.h
@@ -7,7 +7,7 @@
 #define IS_PLT(x) ((x)==R_PPC_JMP_SLOT)
 
 // see linux' arch/powerpc/include/asm/elf.h 
-static inline void do_single_reloc(
+static inline int do_single_reloc(
 	struct dso *self, unsigned char *base_addr,
 	size_t *reloc_addr, int type, size_t addend,
 	Sym *sym, size_t sym_size,
@@ -37,6 +37,7 @@ static inline void do_single_reloc(
 			: self->tls_offset - 0x7000;
 		break;
 	}
+	return 0;
 }
 
 void __reloc_self(int c, size_t *a, size_t *dynv)
diff --git a/arch/sh/reloc.h b/arch/sh/reloc.h
index db3de081..a1393bb3 100644
--- a/arch/sh/reloc.h
+++ b/arch/sh/reloc.h
@@ -9,7 +9,7 @@
 #define IS_COPY(x) ((x) == R_SH_COPY)
 #define IS_PLT(x)  ((x) == R_SH_JMP_SLOT)
 
-static inline void do_single_reloc(
+static inline int do_single_reloc(
 	struct dso *self, unsigned char *base_addr,
 	size_t *reloc_addr, int type, size_t addend,
 	Sym *sym, size_t sym_size,
@@ -44,4 +44,5 @@ static inline void do_single_reloc(
 			: self->tls_offset + 8;
 		break;
 	}
+	return 0;
 }
diff --git a/arch/x32/reloc.h b/arch/x32/reloc.h
index f294eece..1261fb5d 100644
--- a/arch/x32/reloc.h
+++ b/arch/x32/reloc.h
@@ -7,7 +7,7 @@
 #define IS_COPY(x) ((x)==R_X86_64_COPY)
 #define IS_PLT(x) ((x)==R_X86_64_JUMP_SLOT)
 
-static inline void do_single_reloc(
+static inline int do_single_reloc(
 	struct dso *self, unsigned char *base_addr,
 	size_t *reloc_addr, int type, size_t addend,
 	Sym *sym, size_t sym_size,
@@ -43,4 +43,5 @@ static inline void do_single_reloc(
 			: 0 - self->tls_offset) + addend;
 		break;
 	}
+	return 0;
 }
diff --git a/arch/x86_64/reloc.h b/arch/x86_64/reloc.h
index 28cf7cc1..30f65614 100644
--- a/arch/x86_64/reloc.h
+++ b/arch/x86_64/reloc.h
@@ -7,7 +7,7 @@
 #define IS_COPY(x) ((x)==R_X86_64_COPY)
 #define IS_PLT(x) ((x)==R_X86_64_JUMP_SLOT)
 
-static inline void do_single_reloc(
+static inline int do_single_reloc(
 	struct dso *self, unsigned char *base_addr,
 	size_t *reloc_addr, int type, size_t addend,
 	Sym *sym, size_t sym_size,
@@ -43,4 +43,5 @@ static inline void do_single_reloc(
 			: 0 - self->tls_offset) + addend;
 		break;
 	}
+	return 0;
 }