This is an archive of the discontinued LLVM Phabricator instance.

[MC][WebAssembly] Fix provisional values for data alias relocations
ClosedPublic

Authored by sbc100 on Feb 7 2021, 8:26 PM.

Details

Summary

When calculating the symbol offsets to write as provisitonal values
in object files we are only interested in the offset of the symbol
itself. For aliases this offset already includes the offset of the
base symbol.

The test in question was added back in https://reviews.llvm.org/D87407
but I believe the expectations here were incorrect. sym_a lives
at offset 4 and sym_b lives 4 bytes into that (should be 8).

The addresses of the 3 symbosl in this object file are:

foo : 0
sym_a: 4
sym_b: 8

Diff Detail

Event Timeline

sbc100 created this revision.Feb 7 2021, 8:26 PM
sbc100 requested review of this revision.Feb 7 2021, 8:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2021, 8:26 PM
sbc100 edited the summary of this revision. (Show Details)Feb 7 2021, 8:26 PM
sbc100 added reviewers: ddcc, aardappel.
ddcc added a comment.Feb 7 2021, 10:00 PM

Makes sense to me, since the offsets now match the symbol table checked earlier in the test. But I'm not really familiar with symbol processing, and I don't have a local WAsm toolchain to test with.

@dschuff or @aardappel could you take a quick look at this?

dschuff accepted this revision.Feb 8 2021, 4:34 PM

This looks right to me too. But what are the provisional values used for in this case?

This revision is now accepted and ready to land.Feb 8 2021, 4:34 PM
sbc100 added a comment.Feb 8 2021, 4:54 PM

This looks right to me too. But what are the provisional values used for in this case?

Not really used for anything, but trigger warning in the linker if they are unexpected/wrong.

This revision was landed with ongoing or failed builds.Feb 8 2021, 5:00 PM
This revision was automatically updated to reflect the committed changes.