]> git.saurik.com Git - apple/ld64.git/commitdiff
ld64-97.17.tar.gz developer-tools-325 developer-tools-326 ios-42 ios-43 ios-431 ios-432 ios-433 v97.17
authorApple <opensource@apple.com>
Mon, 14 Mar 2011 21:59:03 +0000 (21:59 +0000)
committerApple <opensource@apple.com>
Mon, 14 Mar 2011 21:59:03 +0000 (21:59 +0000)
ChangeLog
src/ld/LTOReader.hpp
src/ld/MachOReaderDylib.hpp
src/ld/Options.cpp
src/ld/ld.cpp

index 38543bce9ba1927727e5ac77ca30a0d6a1bea6f8..ebd56281d8bb21d0ce679cdd5b71050329887fdb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,27 @@
 
+----- Tagged ld64-97.17
+
+2010-09-07    Nick Kledzik    <kledzik@apple.com>
+
+       <rdar://problem/7989734> ld mis-handling std::tr1::anonymous symbols
+       Remove support for ordering gcc-4.0 compiled anonymous namespace symbols
+
+2010-09-07    Nick Kledzik    <kledzik@apple.com>
+
+       <rdar://problem/8388362> RedGarnet's linker does not honor $ld$hide for umbrella libraries
+
+----- Tagged ld64-97.16
+
+2010-08-10    Nick Kledzik    <kledzik@apple.com>
+
+       <rdar://problem/8303976> add -demangle noop to ld64-97
+
+----- Tagged ld64-97.15
+
+2010-08-10    Nick Kledzik    <kledzik@apple.com>
+
+       <rdar://problem/8212744> linker crash when using LTO in lto::Atom::getSymbolTableInclusion()
+
 ----- Tagged ld64-97.14
 
 2010-04-20    Nick Kledzik    <kledzik@apple.com>
index 9d00b006f3986d8f78421f98259ffb48e94cd29b..2e560cc15e0ef8db5479367bcd5bc4923709a1a2 100644 (file)
@@ -145,7 +145,7 @@ public:
        Scope                                                                           getScope() const                        { return (fRealAtom ? fRealAtom->getScope() : fScope); }
        DefinitionKind                                                          getDefinitionKind() const       { return (fRealAtom ? fRealAtom->getDefinitionKind() : fKind); }
        SymbolTableInclusion                                            getSymbolTableInclusion() const 
-                                                                                                                                                       { return fRealAtom->getSymbolTableInclusion(); }
+                                                                                                                                                       { return (fRealAtom ? fRealAtom->getSymbolTableInclusion() : ObjectFile::Atom::kSymbolTableIn); }
        bool                                                                            dontDeadStrip() const           { return false; }
        bool                                                                            isZeroFill() const                      { return (fRealAtom ? fRealAtom->isZeroFill() : false); }
        bool                                                                            isThumb() const                         { return false; }
index 1d8f89b127663e42ea8666fbd3c53012eb2432ac..5a6c55368e93221005ceaace04baacfc467adc40 100644 (file)
@@ -832,7 +832,7 @@ void Reader<A>::processIndirectLibraries(DylibHander* handler)
                                ObjectFile::Reader* child = handler->findDylib(it->path, this->getPath());
                                if ( isPublicLocation(child->getInstallPath()) ) {
                                        // promote this child to be automatically added as a direct dependent if this already is
-                                       if ( this->explicitlyLinked() || this->implicitlyLinked() ) {
+                                       if ( (this->explicitlyLinked() || this->implicitlyLinked()) && (strcmp(it->path,child->getInstallPath()) == 0) ) {
                                                //fprintf(stderr, "processIndirectLibraries() implicitly linking %s\n", child->getInstallPath());
                                                ((Reader<A>*)child)->setImplicitlyLinked();
                                        }
index 01ce10f31027f0279b93e36e87a59072e2d929ba..492d140b4c780eb9b8d695589ad6347c6a12ac85 100644 (file)
@@ -2520,6 +2520,9 @@ void Options::parse(int argc, const char* argv[])
                                else
                                        warning("ignoring unrecognized argument (%s) to -objc_abi_version", version);
                        }
+                       else if ( strcmp(arg, "-demangle") == 0 ) {
+                               // <rdar://problem/8303976> add -demangle noop to ld64-97
+                       }
                        else {
                                throwf("unknown option: %s", arg);
                        }
index 48e1e882b73055fd01851fd6a51f3dcef3ca0416..115240e93b4745ae98e10f68c005e67f37f7850f 100644 (file)
@@ -2025,32 +2025,6 @@ static bool matchesObjectFile(ObjectFile::Atom* atom, const char* objectFileLeaf
 }
 
 
-static bool usesAnonymousNamespace(const char* symbol)
-{
-       return ( (strncmp(symbol, "__Z", 3) == 0) && (strstr(symbol, "_GLOBAL__N_") != NULL) );
-}
-
-
-//
-//  convert:
-//             __ZN20_GLOBAL__N__Z5main2v3barEv                                        =>  _ZN-3barEv
-//             __ZN37_GLOBAL__N_main.cxx_00000000_493A01A33barEv       =>  _ZN-3barEv
-//
-static void canonicalizeAnonymousName(const char* inSymbol, char outSymbol[])
-{
-       const char* globPtr = strstr(inSymbol, "_GLOBAL__N_");
-       while ( isdigit(*(--globPtr)) )
-               ; // loop
-       char* endptr;
-       unsigned long length = strtoul(globPtr+1, &endptr, 10);
-       const char* globEndPtr = endptr + length;
-       int startLen = globPtr-inSymbol+1;
-       memcpy(outSymbol, inSymbol, startLen);
-       outSymbol[startLen] = '-';
-       strcpy(&outSymbol[startLen+1], globEndPtr);
-}
-
-
 ObjectFile::Atom* Linker::findAtom(const Options::OrderedSymbol& orderedSymbol)
 {
        ObjectFile::Atom* atom = fGlobalSymbolTable.find(orderedSymbol.symbolName);
@@ -2061,7 +2035,6 @@ ObjectFile::Atom* Linker::findAtom(const Options::OrderedSymbol& orderedSymbol)
        else {
                // slow case.  The requested symbol is not in symbol table, so might be static function
                static SymbolTable::Mapper hashTableOfTranslationUnitScopedSymbols;
-               static SymbolTable::Mapper hashTableOfSymbolsWithAnonymousNamespace;
                static bool built = false;
                // build a hash_map the first time
                if ( !built ) {
@@ -2069,18 +2042,7 @@ ObjectFile::Atom* Linker::findAtom(const Options::OrderedSymbol& orderedSymbol)
                                atom = *it;
                                const char* name = atom->getName();
                                if ( name != NULL) {
-                                       if ( usesAnonymousNamespace(name) ) {
-                                               // symbol that uses anonymous namespace
-                                               char canonicalName[strlen(name)+2];
-                                               canonicalizeAnonymousName(name, canonicalName);
-                                               const char* hashName = strdup(canonicalName);
-                                               SymbolTable::Mapper::iterator pos = hashTableOfSymbolsWithAnonymousNamespace.find(hashName);
-                                               if ( pos == hashTableOfSymbolsWithAnonymousNamespace.end() )
-                                                       hashTableOfSymbolsWithAnonymousNamespace[hashName] = atom;
-                                               else
-                                                       hashTableOfSymbolsWithAnonymousNamespace[hashName] = NULL;      // collision, denote with NULL
-                                       }
-                                       else if ( atom->getScope() == ObjectFile::Atom::scopeTranslationUnit ) {
+                                       if ( atom->getScope() == ObjectFile::Atom::scopeTranslationUnit ) {
                                                // static function or data
                                                SymbolTable::Mapper::iterator pos = hashTableOfTranslationUnitScopedSymbols.find(name);
                                                if ( pos == hashTableOfTranslationUnitScopedSymbols.end() )
@@ -2119,37 +2081,6 @@ ObjectFile::Atom* Linker::findAtom(const Options::OrderedSymbol& orderedSymbol)
                        }
                }
                
-               // look for name in hashTableOfSymbolsWithAnonymousNamespace
-               if ( usesAnonymousNamespace(orderedSymbol.symbolName) ) {
-                       // symbol that uses anonymous namespace
-                       char canonicalName[strlen(orderedSymbol.symbolName)+2];
-                       canonicalizeAnonymousName(orderedSymbol.symbolName, canonicalName);
-                       SymbolTable::Mapper::iterator pos = hashTableOfSymbolsWithAnonymousNamespace.find(canonicalName);
-                       if ( pos != hashTableOfSymbolsWithAnonymousNamespace.end() ) {
-                               if ( (pos->second != NULL) && matchesObjectFile(pos->second, orderedSymbol.objectFileName) ) {
-                                       //fprintf(stderr, "found %s in anonymous namespace hash table\n", canonicalName);
-                                       return pos->second;
-                               }
-                               if ( pos->second == NULL )
-                               // name is in hash table, but atom is NULL, so that means there are duplicates, so we use super slow way
-                               for (std::vector<ObjectFile::Atom*>::iterator it=fAllAtoms.begin(); it != fAllAtoms.end(); it++) {
-                                       atom = *it;
-                                       const char* name = atom->getName();
-                                       if ( (name != NULL) && usesAnonymousNamespace(name) ) {
-                                               char canonicalAtomName[strlen(name)+2];
-                                               canonicalizeAnonymousName(name, canonicalAtomName);
-                                               if ( strcmp(canonicalAtomName, canonicalName) == 0 ) {
-                                                       if ( matchesObjectFile(atom, orderedSymbol.objectFileName) ) {
-                                                               if ( fOptions.printOrderFileStatistics() )
-                                                                       warning("%s specified in order_file but it exists in multiple .o files. "
-                                                                               "Prefix symbol with .o filename in order_file to disambiguate", orderedSymbol.symbolName);
-                                                               return atom;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
        }
        return NULL;
 }