[PATCH] D61563: [ELF] Error on relocations to local undefined symbols
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 01:03:02 PDT 2019
MaskRay marked an inline comment as done.
MaskRay added inline comments.
================
Comment at: ELF/Relocations.cpp:1040
if (oneof<R_HINT, R_NONE>(Expr))
return;
----------------
grimar wrote:
> I tried to reorder/simplify the code slightly to avoid symbol index check:
>
> ```
> const uint8_t *RelocatedAddr = Sec.data().begin() + Rel.r_offset;
> RelExpr Expr = Target->getRelExpr(Type, Sym, RelocatedAddr);
>
> // Ignore "hint" relocations because they are only markers for relaxation.
> if (oneof<R_HINT, R_NONE>(Expr))
> return;
>
> // Skip if the target symbol is an erroneous undefined symbol.
> if (maybeReportUndefined(Sym, Sec, Rel.r_offset))
> return;
> ```
>
> With that the only test case that fails is mips-abs-got.s.
> I am not sure if we can do something with it, I am not a MIPS expert.
@atanasyan Can `R_MIPS_GOT_PAGE` be (reasonably) used with symbol index 0? If it is theoretically possible but unlikely emitted by compiles/humans in reality, `mips-abs-got.s` should probably be updated.
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61563/new/
https://reviews.llvm.org/D61563
More information about the llvm-commits
mailing list