HomePhabricator

[RISCV][MC] Don't fold symbol differences if requiresDiffExpressionRelocations…

Authored by asb on Aug 16 2018, 4:26 AM.

Description

[RISCV][MC] Don't fold symbol differences if requiresDiffExpressionRelocations is true

When emitting the difference between two symbols, the standard behavior is
that the difference will be resolved to an absolute value if both of the
symbols are offsets from the same data fragment. This is undesirable on
architectures such as RISC-V where relaxation in the linker may cause the
computed difference to become invalid. This caused an issue when compiling to
object code, where the size of a function in the debug information was already
calculated even though it could change as a consequence of relaxation in the
subsequent linking stage.

This patch inhibits the resolution of symbol differences to absolute values
where the target's AsmBackend has declared that it does not want these to be
folded.

Differential Revision: https://reviews.llvm.org/D45773
Patch by Edward Jones.

llvm-svn: 339864

Details

Committed
asbAug 16 2018, 4:26 AM
Differential Revision
D45773: [RISCV] Don't fold symbol diff
Parents
rG8f46505beb83: [ADT] Replace APInt::WORD_MAX with APInt::WORDTYPE_MAX
Branches
Unknown
Tags
Unknown