- //if ( fixup.binding == ld::Fixup::bindingDirectlyBound )
- // fprintf(stderr, "offset=0x%08X, name=%s\n", fixup.offsetInAtom, fixup.u.target->name());
+ if ( (fixup.offsetInAtom - 8) % (3*sizeof(pint_t)) == 0 ) {
+ // <rdar://problem/8642343> warning when a method is overridden in a category in the same link unit
+ assert(fixup.binding == ld::Fixup::bindingsIndirectlyBound && "malformed category method list");
+ const ld::Atom* target = state.indirectBindingTable[fixup.u.bindingIndex];
+ assert(target->contentType() == ld::Atom::typeCString && "malformed method list");
+ // this objc pass happens after cstrings are coalesced, so we can just compare the atom addres instead of its content
+ if ( baseMethodListMethodNameAtoms.count(target) != 0 ) {
+ warning("%s method '%s' in category from %s overrides method from class in %s",
+ (meta ? "meta" : "instance"), target->rawContentPointer(),
+ categoryMethodListAtom->file()->path(), baseMethodList->file()->path() );
+ }
+ if ( categoryMethodNameAtoms.count(target) != 0 ) {
+ warning("%s method '%s' in category from %s conflicts with same method from another category",
+ (meta ? "meta" : "instance"), target->rawContentPointer(),
+ categoryMethodListAtom->file()->path());
+ }
+ categoryMethodNameAtoms.insert(target);
+ }