#define OK_TYPES (1<<STT_NOTYPE | 1<<STT_OBJECT | 1<<STT_FUNC | 1<<STT_COMMON | 1<<STT_TLS)
#define OK_BINDS (1<<STB_GLOBAL | 1<<STB_WEAK | 1<<STB_GNU_UNIQUE)
+#ifndef ARCH_SYM_REJECT_UND
+#define ARCH_SYM_REJECT_UND(s) 0
+#endif
+
static struct symdef find_sym(struct dso *dso, const char *s, int need_def)
{
uint32_t h = 0, gh = 0;
}
if (!sym) continue;
if (!sym->st_shndx)
- if (need_def || (sym->st_info&0xf) == STT_TLS)
+ if (need_def || (sym->st_info&0xf) == STT_TLS
+ || ARCH_SYM_REJECT_UND(sym))
continue;
if (!sym->st_value)
if ((sym->st_info&0xf) != STT_TLS)
if (!astype) continue;
type = remap_rel(astype);
if (!type) {
- error(errbuf, sizeof errbuf,
- "Error relocating %s: unsupported relocation type %d",
+ error("Error relocating %s: unsupported relocation type %d",
dso->name, astype);
continue;
}
def = find_sym(ctx, name, type==REL_PLT);
if (!def.sym && (sym->st_shndx != SHN_UNDEF
|| sym->st_info>>4 != STB_WEAK)) {
- error(errbuf, sizeof errbuf,
- "Error relocating %s: %s: symbol not found",
+ error("Error relocating %s: %s: symbol not found",
dso->name, name);
continue;
}
if (stride<3) addend = reloc_addr[1];
if (runtime && def.dso->tls_id >= static_tls_cnt) {
struct td_index *new = malloc(sizeof *new);
- if (!new) error(errbuf, sizeof errbuf,
+ if (!new) error(
"Error relocating %s: cannot allocate TLSDESC for %s",
dso->name, sym ? name : "(local)" );
new->next = dso->td_index;
if (p->dynv[i] != DT_NEEDED) continue;
dep = load_library(p->strings + p->dynv[i+1], p);
if (!dep) {
- error(errbuf, sizeof errbuf,
- "Error loading shared library %s: %m (needed by %s)",
+ error("Error loading shared library %s: %m (needed by %s)",
p->strings + p->dynv[i+1], p->name);
continue;
}
if (p->relro_start != p->relro_end &&
mprotect(p->base+p->relro_start, p->relro_end-p->relro_start, PROT_READ) < 0) {
- error(errbuf, sizeof errbuf,
- "Error relocating %s: RELRO protection failed: %m",
+ error("Error relocating %s: RELRO protection failed: %m",
p->name);
}