This is an archive of the discontinued LLVM Phabricator instance.

[RuntimeDyld] Fix range checks for R_X86_64_{8,16}
Needs RevisionPublic

Authored by rafauler on Mar 12 2021, 2:57 PM.

Details

Reviewers
MaskRay
lhames
Summary

D97899 added support for these relocations, but MaskRay noticed
the range check was incomplete. Fix it.

Diff Detail

Event Timeline

rafauler created this revision.Mar 12 2021, 2:57 PM
rafauler requested review of this revision.Mar 12 2021, 2:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2021, 2:57 PM

We probably should use a better mechanism than assert.

Maybe, but this discussion is orthogonal to this fix, right? I can't answer for other clients of RuntimeDyld (JIT stuff), but having asserts in the library is fine for BOLT.

Changing that would be more involved (as the entire lib has to change -- all code dealing with relocs from all targets).

lhames requested changes to this revision.Mar 15 2021, 8:20 PM

Changing that would be more involved (as the entire lib has to change -- all code dealing with relocs from all targets).

There is actually an existing error reporting mechanism, it's just *very* poorly used / documented. You can set HasError = true and ErrorStr = <msg>. That's the right way to check this.

What platforms is BOLT running on? You might be able to switch to JITLink either now or in the near future -- error handling is in a much better state there.

This revision now requires changes to proceed.Mar 15 2021, 8:20 PM

Thanks @lhames
Let me work on that
BOLT targets X86 and AArch64.

BOLT targets X86 and AArch64.

Linux only? Or Darwin and Windows too?

On Darwin JITLink already supports x86-64 and AArch64.
On Linux JITLink supports x86-64, and should support AArch64 in the not-too-distant future.
There is no Windows support for JITLink yet.

Ok. Keep an eye out for JITLink arm64 support. It's not going to land immediately, but I think Vassil is interested in it too, so I'm hoping we can get it done before LLVM 13. As soon as it's ready ORCv2 / JITLink will probably be an attractive option for you.