This is an archive of the discontinued LLVM Phabricator instance.

PE/COFF: rework how we handle base relocations
ClosedPublic

Authored by compnerd on Jan 16 2015, 2:01 PM.

Details

Reviewers
ruiu
Summary

Generalise the base relocation handling slightly to support multiple base
relocation types in PE/COFF. This is necessary to generate proper executables
for WoA.

Track the base relocation type from the decision that we need a base relocation
to the point where we emit the base relocation into base relocation directory.

Diff Detail

Event Timeline

compnerd updated this revision to Diff 18320.Jan 16 2015, 2:01 PM
compnerd retitled this revision from to PE/COFF: rework how we handle base relocations.
compnerd updated this object.
compnerd edited the test plan for this revision. (Show Details)
compnerd added a reviewer: ruiu.
compnerd set the repository for this revision to rL LLVM.
compnerd added a project: lld.
compnerd added a subscriber: Unknown Object (MLST).
ruiu accepted this revision.Jan 16 2015, 2:09 PM
ruiu edited edge metadata.

LGTM with these fixes.

lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
769

Not directly related to this change, but can you remove this TODO? It's obsolete.

785

I'd do like this because this switch has only one non-default case.

if (ref->kindValue() == llvm::COFF::IMAGE_REL_I386_DIR32)
  reloc = std::make_pair(...);
break;
795

ditto

799

In other switches default is after all cases. (But my personal preference is if () {...} else if () {...} break.)

This revision is now accepted and ready to land.Jan 16 2015, 2:09 PM
compnerd closed this revision.Jan 16 2015, 2:35 PM

Thanks; committed as SVN r226335 with the requested changes.