This is an archive of the discontinued LLVM Phabricator instance.

Properly evaluate MCBinaryExpr with a constant on one side.
AbandonedPublic

Authored by colinl on Oct 20 2015, 2:28 PM.

Details

Summary

Previously these tests would fail with:
LLVM ERROR: expected relocatable expression

The logic is changed so EvaluateSymbolicAdd is only called if both sides have a relocatable expression.

If one side is a relocatable it combines the addends and creates a single relocatable expression.

Diff Detail

Repository
rL LLVM

Event Timeline

colinl updated this revision to Diff 37919.Oct 20 2015, 2:28 PM
colinl retitled this revision from to Properly evaluate MCBinaryExpr with a constant on one side..
colinl updated this object.
colinl added reviewers: rafael, sidneym.
colinl set the repository for this revision to rL LLVM.
colinl added a subscriber: llvm-commits.
rafael edited edge metadata.Nov 2 2015, 8:09 AM

Please git clang-format the patch.

How is EvaluateSymbolicAdd failing? It would seem better to make it able to handle adding an absolute value.

test/MC/ARM/dot-symbol-relocation.s
17

Please add a newline to the end.

Please use unix newlines.

Also, reduce the testcase all that is needed to fail currently:

.word 0x42 - .

It is not clear this patch handles '-' correctly. It should be inverting B and A, which is what the existing logic avoids to not produces a "null - B".

.... is what the existing logic avoids to not produces a "null - B".

Turns out the correct solution is just to allow "null - B" since ELF
can represent that some times: r251818.

Thanks,
Rafael

mcrosier resigned from this revision.Dec 2 2015, 12:07 PM
mcrosier removed a reviewer: mcrosier.

Has Rafael addressed the issue? If so, can this be abandoned?

colinl abandoned this revision.Dec 2 2015, 3:17 PM

Yes, the crash I was seeing went away. Thanks for the reminder.