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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 01:56:15 PDT 2019


MaskRay added a comment.

In D61563#1493055 <https://reviews.llvm.org/D61563#1493055>, @grimar wrote:

> I also do not know if undefined local symbol can be a real thing.
>  So my comment is about implementation.


If I remove `SymIndex != 0` the following will break.

  arm-v4bx.test
  icf10.test
  icf11.test
  mips-abs-got.s
  relocation-dtrace.test
  relocation-none-aarch64.test
  relocation-none-i686.test

The relocation-dtrace.test looks quite reasonable. `R_ARM_NONE` (and `R_X86_64_NONE` etc) can be used to create references among sections to prevent garbage collection (https://lwn.net/Articles/741494/)
mips-abs-got.s `.reloc 0, R_MIPS_GOT_PAGE, 0` seems a reasonable relocation type other than `R_*_NONE` (hope @atanasyan can confirm)

So I have to keep `SymIndex != 0` (I did try to delete the check all together before I realized some are legitimate)


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