[llvm] [DirectX] Add ObjectFile boilerplate for objdump (PR #151434)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 22:54:31 PDT 2025


================
@@ -542,11 +542,28 @@ DXContainerObjectFile::getSymbolSection(DataRefImpl Symb) const {
   return make_error<DXNotSupportedError>("Symbol sections");
 }
 
+Expected<StringRef> DXContainerObjectFile::getSymbolName(DataRefImpl) const {
+  return make_error<DXNotSupportedError>("Symbol names");
+}
+
 Expected<uint64_t>
 DXContainerObjectFile::getSymbolAddress(DataRefImpl Symb) const {
   return make_error<DXNotSupportedError>("Symbol addresses");
 }
 
+uint64_t DXContainerObjectFile::getSymbolValueImpl(DataRefImpl Symb) const {
+  llvm_unreachable("DXContainer does not support symbols");
----------------
lhames wrote:

@bogner @llvm-beanz I think the `DXContainerObjectFile` should present as if it had empty symbol and relocation tables, rather than making these operations unreachable.

>From a design perspective you _should_ be able to iterate over the set of symbols and relocations in an object file, and empty sets are perfectly legal.

As a practical matter presenting empty sets will allow `llvm-objdump -r` and `llvm-objdump -t` to behave sensibly, whereas unreachable will cause them to crash.

https://github.com/llvm/llvm-project/pull/151434


More information about the llvm-commits mailing list