Skip to content

Commit 6db4029

Browse files
committed
---
yaml --- r: 318958 b: refs/heads/master-rebranch c: 71ffa22 h: refs/heads/master
1 parent f7b5d80 commit 6db4029

File tree

3 files changed

+198
-146
lines changed

3 files changed

+198
-146
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,4 +1457,4 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-02-a: ddd2b2976aa9bfde5f20fe37f6bd2
14571457
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-03-a: 171cc166f2abeb5ca2a4003700a8a78a108bd300
14581458
refs/heads/benlangmuir-patch-1: baaebaf39d52f3bf36710d4fe40cf212e996b212
14591459
refs/heads/i-do-redeclare: 8c4e6d5de5c1e3f0a2cedccf319df713ea22c48e
1460-
refs/heads/master-rebranch: 4971b164a463b7449e3bf4022450f70daa4d92c5
1460+
refs/heads/master-rebranch: 71ffa2251536a7663cad3854a298a3f4a556205c

branches/master-rebranch/include/swift/Reflection/ReflectionContext.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,21 @@ class ReflectionContext
322322
: llvm::StringRef(COFFSec->Name, llvm::COFF::NameSize);
323323
if (SectionName != Name)
324324
continue;
325-
auto Addr = ImageStart.getAddressData() + COFFSec->PointerToRawData;
325+
auto Addr = ImageStart.getAddressData() + COFFSec->VirtualAddress;
326326
auto Buf = this->getReader().readBytes(RemoteAddress(Addr),
327327
COFFSec->VirtualSize);
328328
const char *Begin = reinterpret_cast<const char *>(Buf.get());
329329
const char *End = Begin + COFFSec->VirtualSize;
330330
savedBuffers.push_back(std::move(Buf));
331-
return {{Begin, End},
332-
COFFSec->VirtualAddress - COFFSec->PointerToRawData};
331+
332+
// FIXME: This code needs to be cleaned up and updated
333+
// to make it work for 32 bit platforms.
334+
if (SectionName != ".sw5cptr") {
335+
Begin += 8;
336+
End -= 8;
337+
}
338+
339+
return {{Begin, End}, 0};
333340
}
334341
return {{nullptr, nullptr}, 0};
335342
};
@@ -338,20 +345,15 @@ class ReflectionContext
338345
findCOFFSectionByName(".sw5cptr");
339346
std::pair<std::pair<const char *, const char *>, uint32_t> TypeRefMdSec =
340347
findCOFFSectionByName(".sw5tyrf");
341-
342-
// FIXME: Make use of .sw5flmd section (the section content appears to be
343-
// incorrect on Windows at the moment).
344-
std::pair<std::pair<const char *, const char *>, uint32_t> FieldMdSec = {
345-
{nullptr, nullptr}, 0};
346-
// FIXME: Make use of .sw5asty.
347-
std::pair<std::pair<const char *, const char *>, uint32_t> AssocTySec = {
348-
{nullptr, nullptr}, 0};
349-
// FIXME: Make use of .sw5bltn.
350-
std::pair<std::pair<const char *, const char *>, uint32_t> BuiltinTySec = {
351-
{nullptr, nullptr}, 0};
352-
// FIXME: Make use of .sw5repl.
353-
std::pair<std::pair<const char *, const char *>, uint32_t> ReflStrMdSec = {
354-
{nullptr, nullptr}, 0};
348+
std::pair<std::pair<const char *, const char *>, uint32_t> FieldMdSec =
349+
findCOFFSectionByName(".sw5flmd");
350+
std::pair<std::pair<const char *, const char *>, uint32_t> AssocTySec =
351+
findCOFFSectionByName(".sw5asty");
352+
// FIXME: Use the section .sw5bltn instead.
353+
std::pair<std::pair<const char *, const char *>, uint32_t> BuiltinTySec =
354+
{{nullptr, nullptr}, 0};
355+
std::pair<std::pair<const char *, const char *>, uint32_t> ReflStrMdSec =
356+
findCOFFSectionByName(".sw5rfst");
355357

356358
if (FieldMdSec.first.first == nullptr &&
357359
AssocTySec.first.first == nullptr &&
@@ -457,12 +459,11 @@ class ReflectionContext
457459
if (SecName != Name)
458460
continue;
459461
auto SecStart =
460-
RemoteAddress(ImageStart.getAddressData() + Hdr->sh_offset);
462+
RemoteAddress(ImageStart.getAddressData() + Hdr->sh_addr);
461463
auto SecSize = Hdr->sh_size;
462464
auto SecBuf = this->getReader().readBytes(SecStart, SecSize);
463465
auto SecContents = reinterpret_cast<const char *>(SecBuf.get());
464-
return {{SecContents, SecContents + SecSize},
465-
Hdr->sh_addr - Hdr->sh_offset};
466+
return {{SecContents, SecContents + SecSize}, 0};
466467
}
467468
return {{nullptr, nullptr}, 0};
468469
};

0 commit comments

Comments
 (0)