Skip to content

Commit d9a7842

Browse files
authored
Merge pull request swiftlang#19931 from dcci/remotemirrorsfix50
Cherry-pick: [RemoteMirrors] Fix the computation of the section start address in r…
2 parents 2df30cf + 7c4ee16 commit d9a7842

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/swift/Reflection/ReflectionContext.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ class ReflectionContext
154154
SectAddress + (I * sizeof(typename T::Section)));
155155
if (strncmp(S->sectname, Name.c_str(), strlen(Name.c_str())) != 0)
156156
continue;
157-
auto SecStart = Start + S->offset;
157+
auto Slide = ImageStart.getAddressData() - Command->vmaddr;
158+
auto RemoteSecStart = S->addr + Slide;
159+
auto LocalSecStart = RemoteSecStart - ImageStart.getAddressData() + Start;
158160
auto SecSize = S->size;
159-
return {{SecStart, SecStart + SecSize}, 0};
161+
return {{LocalSecStart, LocalSecStart + SecSize}, 0};
160162
}
161163
return {{nullptr, nullptr}, 0};
162164
};

0 commit comments

Comments
 (0)