<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">--- src/ld/OutputFile.cpp
+++ src/ld/OutputFile.cpp
@@ -2984,7 +2984,8 @@ void OutputFile::addClassicRelocs(ld::Internal&amp; state, ld::Internal::FinalSectio
 					if ( (target-&gt;combine() == ld::Atom::combineByName) 
 						&amp;&amp; (target-&gt;definition() == ld::Atom::definitionRegular)
 						&amp;&amp; (_options.outputKind() != Options::kStaticExecutable)
-						&amp;&amp; (_options.outputKind() != Options::kPreload) ) {
+						&amp;&amp; (_options.outputKind() != Options::kPreload) 
+						&amp;&amp; (atom != target) ) {
 						needsExternReloc = true;
 					}
 					else if ( _options.outputKind() == Options::kDynamicExecutable ) {
--- src/ld/parsers/macho_relocatable_file.cpp
+++ src/ld/parsers/macho_relocatable_file.cpp
@@ -2545,6 +2545,10 @@ void Parser&lt;A&gt;::addFixups(const SourceLocation&amp; src, ld::Fixup::Kind setKind, co
 			// backing string in CFStrings should always be direct
 			addFixup(src, cl, firstKind, target.atom);
 		}
+		else if ( (src.atom == target.atom) &amp;&amp; (target.atom-&gt;combine() == ld::Atom::combineByName) ) {
+			// reference to self should always be direct
+			addFixup(src, cl, firstKind, target.atom);
+		}
 		else {
 			// change direct fixup to by-name fixup
 			addFixup(src, cl, firstKind, false, target.atom-&gt;name());
</pre></body></html>