mirror of git://git.musl-libc.org/musl
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.
This commit is contained in:
parent
4e5c7a2176
commit
bfa09700b9
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue