Bug 727959 - Don't error out when missing symbol for PLT relocations is weak. r=nfroyd

This commit is contained in:
Mike Hommey 2012-03-08 08:29:39 +01:00
parent bf43c7e164
commit 471d20d072
2 changed files with 12 additions and 3 deletions

View File

@ -679,9 +679,12 @@ CustomElf::RelocateJumps()
symptr = GetSymbolPtrInDeps(strtab.GetStringAt(sym.st_name));
if (symptr == NULL) {
log("%s: Error: relocation to NULL @0x%08" PRIxAddr " for symbol \"%s\"",
GetPath(), rel->r_offset, strtab.GetStringAt(sym.st_name));
return false;
log("%s: %s: relocation to NULL @0x%08" PRIxAddr " for symbol \"%s\"",
GetPath(),
(ELF_ST_BIND(sym.st_info) == STB_WEAK) ? "Warning" : "Error",
rel->r_offset, strtab.GetStringAt(sym.st_name));
if (ELF_ST_BIND(sym.st_info) != STB_WEAK)
return false;
}
/* Apply relocation */
*(void **) ptr = symptr;

View File

@ -26,12 +26,18 @@
#define ELFCLASS ELFCLASS64
#define ELF_R_TYPE ELF64_R_TYPE
#define ELF_R_SYM ELF64_R_SYM
#ifndef ELF_ST_BIND
#define ELF_ST_BIND ELF64_ST_BIND
#endif
#define PRIxAddr "lx"
#else
#define Elf_(type) Elf32_ ## type
#define ELFCLASS ELFCLASS32
#define ELF_R_TYPE ELF32_R_TYPE
#define ELF_R_SYM ELF32_R_SYM
#ifndef ELF_ST_BIND
#define ELF_ST_BIND ELF32_ST_BIND
#endif
#define PRIxAddr "x"
#endif