This is an archive of the discontinued LLVM Phabricator instance.

Change creation of relative relocations on COFF
ClosedPublic

Authored by rafael on Jun 22 2017, 2:02 PM.

Details

Reviewers
ruiu
pcc
Summary

For whatever reason, when processing

.globl  foo

foo:

.data

bar:

.long   foo-bar

llvm-mc creates a relocation with the section:

0x0 IMAGE_REL_I386_REL32 .text

This is different than when the relocation is relative from the beginning. For example, a file with

call foo

produces

0x0 IMAGE_REL_I386_REL32 foo

I would like to refactor the logic for converting "foo - ." into a relative relocation so that it is shared with ELF. This is the first step and just changes the coff implementation to match what ELF (and COFF in the case of calls) does.

Diff Detail

Event Timeline

rafael created this revision.Jun 22 2017, 2:02 PM
ruiu accepted this revision.Jun 22 2017, 2:07 PM

LGTM

This revision is now accepted and ready to land.Jun 22 2017, 2:07 PM