From: Nick Kledzik Date: Wed, 12 Nov 2014 01:37:45 +0000 (+0000) Subject: Object, support both mach-o archive t.o.c file names X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f44dbda5427bcbdcb7f2c22c57bff8f901ff515a;p=platform%2Fupstream%2Fllvm.git Object, support both mach-o archive t.o.c file names For historical reasons archives on mach-o have two possible names for the file containing the table of contents for the archive: "__.SYMDEF SORTED" and "__.SYMDEF". But the libObject archive reader only supported the former. This patch fixes llvm::object::Archive to support both names. llvm-svn: 221747 --- diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index 070fe81..d169dbe 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -240,7 +240,7 @@ Archive::Archive(MemoryBufferRef Source, std::error_code &ec) if (ec) return; Name = NameOrErr.get(); - if (Name == "__.SYMDEF SORTED") { + if (Name == "__.SYMDEF SORTED" || Name == "__.SYMDEF") { SymbolTable = i; ++i; } diff --git a/llvm/test/Object/Inputs/macho-archive-unsorted-x86_64.a b/llvm/test/Object/Inputs/macho-archive-unsorted-x86_64.a new file mode 100644 index 0000000..6a2b570 Binary files /dev/null and b/llvm/test/Object/Inputs/macho-archive-unsorted-x86_64.a differ diff --git a/llvm/test/Object/archive-symtab.test b/llvm/test/Object/archive-symtab.test index 0899828b..01f17bcc 100644 --- a/llvm/test/Object/archive-symtab.test +++ b/llvm/test/Object/archive-symtab.test @@ -61,6 +61,7 @@ RUN: llvm-ranlib %t.a RUN: llvm-nm -M %t.a | FileCheck %s RUN: llvm-nm -M %p/Inputs/macho-archive-x86_64.a | FileCheck %s --check-prefix=BSD-MachO +RUN: llvm-nm -M %p/Inputs/macho-archive-unsorted-x86_64.a | FileCheck %s --check-prefix=BSD-MachO BSD-MachO: Archive map BSD-MachO: _bar in bar.o