Skip to content

Commit

Permalink
[RuntimeDyld][COFF] Report fatal error on error, rather than emiting …
Browse files Browse the repository at this point in the history
…diagnostic.

Report a fatal error if an IMAGE_REL_AMD64_ADDR32NB cannot be applied due to an
out-of-range target. Previously we emitted a diagnostic to llvm::errs and
continued.

Patch by Dale Martin. Thanks Dale!
  • Loading branch information
lhames committed Oct 6, 2020
1 parent 7193f72 commit b45b516
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ class RuntimeDyldCOFFX86_64 : public RuntimeDyldCOFF {
// The MemoryManager can make sure this is always true by forcing the
// memory layout to be: CodeSection < ReadOnlySection < ReadWriteSection.
const uint64_t ImageBase = getImageBase();
if (Value < ImageBase || ((Value - ImageBase) > UINT32_MAX)) {
llvm::errs() << "IMAGE_REL_AMD64_ADDR32NB relocation requires an"
<< "ordered section layout.\n";
write32BitOffset(Target, 0, 0);
} else {
if (Value < ImageBase || ((Value - ImageBase) > UINT32_MAX))
report_fatal_error("IMAGE_REL_AMD64_ADDR32NB relocation requires an "
"ordered section layout");
else {
write32BitOffset(Target, RE.Addend, Value - ImageBase);
}
break;
Expand Down

0 comments on commit b45b516

Please sign in to comment.