[llvm] r221747 - Object, support both mach-o archive t.o.c file names

Nick Kledzik kledzik at apple.com
Tue Nov 11 17:37:45 PST 2014


Author: kledzik
Date: Tue Nov 11 19:37:45 2014
New Revision: 221747

URL: http://llvm.org/viewvc/llvm-project?rev=221747&view=rev
Log:
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.

Added:
    llvm/trunk/test/Object/Inputs/macho-archive-unsorted-x86_64.a   (with props)
Modified:
    llvm/trunk/lib/Object/Archive.cpp
    llvm/trunk/test/Object/archive-symtab.test

Modified: llvm/trunk/lib/Object/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Archive.cpp?rev=221747&r1=221746&r2=221747&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Archive.cpp (original)
+++ llvm/trunk/lib/Object/Archive.cpp Tue Nov 11 19:37:45 2014
@@ -240,7 +240,7 @@ Archive::Archive(MemoryBufferRef Source,
     if (ec)
       return;
     Name = NameOrErr.get();
-    if (Name == "__.SYMDEF SORTED") {
+    if (Name == "__.SYMDEF SORTED" || Name == "__.SYMDEF") {
       SymbolTable = i;
       ++i;
     }

Added: llvm/trunk/test/Object/Inputs/macho-archive-unsorted-x86_64.a
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/macho-archive-unsorted-x86_64.a?rev=221747&view=auto
==============================================================================
Binary file - no diff available.

Propchange: llvm/trunk/test/Object/Inputs/macho-archive-unsorted-x86_64.a
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: llvm/trunk/test/Object/archive-symtab.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/archive-symtab.test?rev=221747&r1=221746&r2=221747&view=diff
==============================================================================
--- llvm/trunk/test/Object/archive-symtab.test (original)
+++ llvm/trunk/test/Object/archive-symtab.test Tue Nov 11 19:37:45 2014
@@ -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





More information about the llvm-commits mailing list