Index: lib/Object/MachOObjectFile.cpp =================================================================== --- lib/Object/MachOObjectFile.cpp +++ lib/Object/MachOObjectFile.cpp @@ -1640,7 +1640,10 @@ iterator_range MachOObjectFile::exports(ArrayRef Trie) { ExportEntry Start(Trie); - Start.moveToFirst(); + if (Trie.size() == 0) + Start.moveToEnd(); + else + Start.moveToFirst(); ExportEntry Finish(Trie); Finish.moveToEnd(); Index: test/Object/objdump-export-list.test =================================================================== --- /dev/null +++ test/Object/objdump-export-list.test @@ -0,0 +1,4 @@ +RUN: llvm-objdump -exports-trie %p/Inputs/macho-no-exports.dylib | FileCheck %s + +; Test that we don't crash with an empty export list. +CHECK: macho-no-exports.dylib: file format Mach-O 64-bit x86-64