commit
24ab82bd9bf18f3efc69a131d73577940941e1b7 upstream.
When the relocs tool throws an error, let the error message say if it
is an absolute or relative symbol. This should make it a lot more
clear what action the programmer needs to take and should help us find
the reason if additional symbol bugs show up.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Elf32_Sym *sym;
unsigned r_type;
const char *symname;
Elf32_Sym *sym;
unsigned r_type;
const char *symname;
rel = &sec->reltab[j];
sym = &sh_symtab[ELF32_R_SYM(rel->r_info)];
r_type = ELF32_R_TYPE(rel->r_info);
rel = &sec->reltab[j];
sym = &sh_symtab[ELF32_R_SYM(rel->r_info)];
r_type = ELF32_R_TYPE(rel->r_info);
+ shn_abs = sym->st_shndx == SHN_ABS;
+
switch (r_type) {
case R_386_NONE:
case R_386_PC32:
switch (r_type) {
case R_386_NONE:
case R_386_PC32:
symname = sym_name(sym_strtab, sym);
if (!use_real_mode)
goto bad;
symname = sym_name(sym_strtab, sym);
if (!use_real_mode)
goto bad;
- if (sym->st_shndx == SHN_ABS) {
if (is_reloc(S_ABS, symname))
break;
else if (!is_reloc(S_SEG, symname))
if (is_reloc(S_ABS, symname))
break;
else if (!is_reloc(S_SEG, symname))
case R_386_32:
symname = sym_name(sym_strtab, sym);
case R_386_32:
symname = sym_name(sym_strtab, sym);
- if (sym->st_shndx == SHN_ABS) {
if (is_reloc(S_ABS, symname))
break;
else if (!is_reloc(S_REL, symname))
if (is_reloc(S_ABS, symname))
break;
else if (!is_reloc(S_REL, symname))
break;
bad:
symname = sym_name(sym_strtab, sym);
break;
bad:
symname = sym_name(sym_strtab, sym);
- die("Invalid %s relocation: %s\n",
+ die("Invalid %s %s relocation: %s\n",
+ shn_abs ? "absolute" : "relative",
rel_type(r_type), symname);
}
}
rel_type(r_type), symname);
}
}