Loading...
src/threadLocalVariables.c dyld-551.3 dyld-421.2
--- dyld/dyld-551.3/src/threadLocalVariables.c
+++ dyld/dyld-421.2/src/threadLocalVariables.c
@@ -214,9 +214,6 @@
 		}
 		cmd = (const struct load_command*)(((char*)cmd)+cmd->cmdsize);
 	}
-    // no thread local storage in image: should never happen
-    if ( size == 0 )
-        return NULL;
 	
 	// allocate buffer and fill with template
 	void* buffer = malloc(size);
@@ -309,7 +306,7 @@
 }
 
 
-static void tlv_load_notification(const struct mach_header* mh, intptr_t slide)
+void tlv_load_notification(const struct mach_header* mh, intptr_t slide)
 {
 	// This is called on all images, even those without TLVs. So we want this to be fast.
 	// The linker sets MH_HAS_TLV_DESCRIPTORS so we don't have to search images just to find the don't have TLVs.
@@ -397,7 +394,7 @@
         pthread_setspecific(tlv_terminators_key, list);
     }
     else {
-        if ( list->useCount == list->allocCount ) {
+        if ( list->allocCount == list->allocCount ) {
             // handle resizing allocation 
             uint32_t newAllocCount = list->allocCount * 2;
             size_t newAllocSize = offsetof(struct TLVTerminatorList, entries[newAllocCount]);