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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 4 23:47:01 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: ruiu, grimar, tstellar.
Herald added subscribers: llvm-commits, atanasyan, kristof.beyls, arichardson, javed.absar, nhaehnle, jvesely, sdardis, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

The isLocal() condition can be weakened to getSymbol(Config->IsMips64EL) == 0.

For a reference to a local symbol, ld.bfd and gold error if the symbol
is defined in a discarded section but accept it if the symbol is
undefined. This inconsistent behavior seems unnecessary for us (it
probably makes sense for them as they differentiate local/global, the
error would mean more code).

We can probably just remove getSymbol(Config->IsMips64EL) == 0, but the
following tests (not sure whether they represent real scenarios) rely on
the ignored errors. So keep the weakened condition for now.

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


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D61563

Files:
  ELF/Relocations.cpp
  test/ELF/amdgpu-relocs.s
  test/ELF/local-undefined-symbol.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61563.198167.patch
Type: text/x-patch
Size: 3636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190505/89d87bf6/attachment.bin>


More information about the llvm-commits mailing list