[PATCH] D61563: [ELF] Error on relocations to local undefined symbols

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 00:54:39 PDT 2019


grimar added inline comments.


================
Comment at: ELF/Relocations.cpp:1040
   if (oneof<R_HINT, R_NONE>(Expr))
     return;
 
----------------
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.


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