[PATCH] ELF: Add a standard method for unknown relocation errors

Will Newton will.newton at linaro.org
Thu Dec 4 04:17:55 PST 2014


Hi shankarke, atanasyan,

At present each TargetRelocationHandler generates a pretty similar error
string and calls llvm_unreachable() when encountering an unknown
relocation. This is not ideal for two reasons:

1. llvm_unreachable disappears in release builds but we still want to
   know if we encountered a relocation we couldn't handle in release
   builds.

2. Duplication is bad - there is no need to have a per-architecture error
   message.

This change adds a test for AArch64 to test whether or not the error
message actually works. The other architectures have not been tested
but they compile and check-lld passes.

http://reviews.llvm.org/D6523

Files:
  lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.cpp
  lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h
  lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
  lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp
  lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.cpp
  lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h
  lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
  lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
  lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h
  lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
  lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp
  lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
  lib/ReaderWriter/ELF/TargetHandler.h
  lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp
  lib/ReaderWriter/ELF/X86/X86RelocationHandler.h
  lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
  lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
  lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h
  lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
  test/elf/AArch64/rel-bad.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6523.16919.patch
Type: text/x-patch
Size: 16091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141204/e495dbcd/attachment.bin>


More information about the llvm-commits mailing list