dynamic linker: permit error returns from arch-specific reloc function
authorRich Felker <dalias@aerifal.cx>
Mon, 16 Jun 2014 07:09:07 +0000 (03:09 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 16 Jun 2014 07:09:07 +0000 (03:09 -0400)
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.

arch/arm/reloc.h
arch/i386/reloc.h
arch/microblaze/reloc.h
arch/mips/reloc.h
arch/powerpc/reloc.h
arch/sh/reloc.h
arch/x32/reloc.h
arch/x86_64/reloc.h

index 264b7ab..27c606d 100644 (file)
@@ -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
index 3923b54..bc86e96 100644 (file)
@@ -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;
 }
index 7bf3a5b..f2f6c3a 100644 (file)
@@ -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"
index 4ca8125..08d139d 100644 (file)
@@ -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)
index 38034c5..d5ba74a 100644 (file)
@@ -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)
index db3de08..a1393bb 100644 (file)
@@ -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;
 }
index f294eec..1261fb5 100644 (file)
@@ -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;
 }
index 28cf7cc..30f6561 100644 (file)
@@ -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;
 }