Page MenuHomePhabricator

[RISCV] Fix builtin fixup sizes (alternate approach)

Authored by asb on May 16 2018, 11:00 AM.



This is a different approach to fixing the problem described in D46746. RISCVAsmBackend currently depends on the getSize helper function returning the number of bytes a fixup may change (note: some other backends have a similar helper named getFixupNumKindBytes). As noted in that review, this doesn't return the correct size for FK_Data_1, FK_Data_2, or FK_Data_8 meaning that too few bytes will be written in the case of FK_Data_8, and there's the potential of writing outside the Data array for the smaller fixups.

D46746 extends getSize to recognise some of the builtin fixup types. Rather than having a function that needs to be kept up to date as new builtin or target-specific fixups are added, We can calculate an appropriate bound on the number of bytes that might be touched using Info.TargetSize and Info.TargetOffset.

This seems trivial, but posting for review in case there's something obvious I'm missing...

Diff Detail


Event Timeline

asb created this revision.May 16 2018, 11:00 AM
This revision was not accepted when it landed; it landed in state Needs Review.May 23 2018, 3:57 AM
This revision was automatically updated to reflect the committed changes.