[PATCH] D58510: [yaml2obj]Allow explicit symbol indexes in relocations and emit error for bad names

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 07:44:45 PST 2019


jhenderson created this revision.
jhenderson added reviewers: grimar, ruiu, jakehehrlich.
Herald added subscribers: jdoerfert, rupprecht, arphaman, arichardson, nhaehnle, jvesely, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added a project: LLVM.

Prior to this change, the "Symbol" field of a relocation would always be assumed to be a symbol name, and if no such symbol existed, the relocation would reference index 0. This confused me when I tried to use a literal symbol index in the field: since "0x1" was not a known symbol name, the symbol index was set as 0. This change fallsback to treating unknown symbol names as integers, and emits an error if the name is not found and the string is not an integer.

Note that the Symbol field is optional, so if a relocation doesn't reference a symbol, it shouldn't be specified. The new error required a number of test updates.

This change relies on D58508 <https://reviews.llvm.org/D58508> landing first with LLD test changes (I haven't got a monorepo checkout sorted out yet).


Repository:
  rL LLVM

https://reviews.llvm.org/D58510

Files:
  test/ExecutionEngine/RuntimeDyld/X86/ELF_x86-64_none.yaml
  test/Object/AMDGPU/elf64-relocs.yaml
  test/Object/Lanai/yaml2obj-elf-lanai-rel.yaml
  test/Object/X86/yaml-elf-x86-rel-broken.yaml
  test/Object/yaml2obj-elf-rel-noref.yaml
  test/tools/llvm-objcopy/ELF/Inputs/compress-debug-sections.yaml
  test/tools/llvm-objdump/X86/disasm-zeroes-relocations.test
  test/tools/sanstats/elf.test
  test/tools/yaml2obj/relocation-explicit-symbol-index.yaml
  test/tools/yaml2obj/relocation-missing-symbol.yaml
  tools/yaml2obj/yaml2elf.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58510.187796.patch
Type: text/x-patch
Size: 10569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190221/faa49ad4/attachment.bin>


More information about the llvm-commits mailing list