ARM: fail less catastrophically on invalid Windows input

Windows supports a restricted set of relocations (compared to ARM ELF).  In some
cases, we may end up generating an unsupported relocation.  This can occur with
bad input to the assembler in particular (the frontend should never generate
code that cannot be compiled).  Generate an error rather than just aborting.

The change in the API is driven by the desire to provide a slightly more helpful
message for debugging purposes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226779 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool
2015-01-22 04:03:32 +00:00
parent ac76e02882
commit 3f6dea4864
5 changed files with 40 additions and 14 deletions

View File

@@ -737,8 +737,9 @@ void WinCOFFObjectWriter::RecordRelocation(
++Reloc.Symb->Relocations;
Reloc.Data.VirtualAddress += Fixup.getOffset();
Reloc.Data.Type = TargetObjectWriter->getRelocType(Target, Fixup,
CrossSection);
Reloc.Data.Type =
TargetObjectWriter->getRelocType(Target, Fixup, CrossSection,
Asm.getBackend());
// FIXME: Can anyone explain what this does other than adjust for the size
// of the offset?