+bool InternalState::inMoveRWChain(const ld::Atom& atom, const char* filePath, const char*& dstSeg, bool& wildCardMatch)
+{
+ if ( !_options.hasDataSymbolMoves() )
+ return false;
+
+ auto pos = _pendingSegMove.find(&atom);
+ if ( pos != _pendingSegMove.end() ) {
+ dstSeg = pos->second;
+ return true;
+ }
+
+ bool result = false;
+ if ( _options.moveRwSymbol(atom.name(), filePath, dstSeg, wildCardMatch) )
+ result = true;
+
+ for (ld::Fixup::iterator fit=atom.fixupsBegin(); fit != atom.fixupsEnd(); ++fit) {
+ if ( fit->kind == ld::Fixup::kindNoneFollowOn ) {
+ if ( fit->binding == ld::Fixup::bindingDirectlyBound ) {
+ if ( inMoveRWChain(*(fit->u.target), filePath, dstSeg, wildCardMatch) )
+ result = true;
+ }
+ }
+ }
+
+ if ( result ) {
+ for (ld::Fixup::iterator fit=atom.fixupsBegin(); fit != atom.fixupsEnd(); ++fit) {
+ if ( fit->kind == ld::Fixup::kindNoneFollowOn ) {
+ if ( fit->binding == ld::Fixup::bindingDirectlyBound ) {
+ _pendingSegMove[fit->u.target] = dstSeg;
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+
+bool InternalState::inMoveROChain(const ld::Atom& atom, const char* filePath, const char*& dstSeg, bool& wildCardMatch)
+{
+ if ( !_options.hasCodeSymbolMoves() )
+ return false;
+
+ auto pos = _pendingSegMove.find(&atom);
+ if ( pos != _pendingSegMove.end() ) {
+ dstSeg = pos->second;
+ return true;
+ }
+
+ bool result = false;
+ if ( _options.moveRoSymbol(atom.name(), filePath, dstSeg, wildCardMatch) )
+ result = true;
+
+ for (ld::Fixup::iterator fit=atom.fixupsBegin(); fit != atom.fixupsEnd(); ++fit) {
+ if ( fit->kind == ld::Fixup::kindNoneFollowOn ) {
+ if ( fit->binding == ld::Fixup::bindingDirectlyBound ) {
+ if ( inMoveROChain(*(fit->u.target), filePath, dstSeg, wildCardMatch) )
+ result = true;
+ }
+ }
+ }
+
+ if ( result ) {
+ for (ld::Fixup::iterator fit=atom.fixupsBegin(); fit != atom.fixupsEnd(); ++fit) {
+ if ( fit->kind == ld::Fixup::kindNoneFollowOn ) {
+ if ( fit->binding == ld::Fixup::bindingDirectlyBound ) {
+ _pendingSegMove[fit->u.target] = dstSeg;
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+
+
+