Compute A-B if both A and B are in the same comdat section.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 17 Apr 2015 20:05:17 +0000 (20:05 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 17 Apr 2015 20:05:17 +0000 (20:05 +0000)
commit560d73a4cc76f4ae0c5ba22ddd432663fee891ed
tree2a4c0bf2b636d651a6d9ea5f2ded34bf2f02c3e8
parent0f0d21e869726c947c958702f6db000e016203ce
Compute A-B if both A and B are in the same comdat section.

Part of pr23272.

A small annoyance with the assembly syntax we implement is that given an
expression there is no way to know if what is desired is the value of that
expression for the symbols in this file or for the final values of those
symbols in a link.

The first case is useful for use in sections that get discarded or ignored
if the section they are describing is discarded.

For axample, consider A-B where A and B are in the same comdat section.

We can compute the value of the difference in the section that is present in
the current .o and if that section survives to the final DSO the value will
still will be correct.

But the section is in a comdat. Another section from another object file
might be used istead. We know that that section will define A and B, but
we have no idea what the value of A-B might be.

In practice we have to assume that the intention is to compute the value
in the current section since otherwise the is no way to create something like
the debug aranges section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235222 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/ELFObjectWriter.cpp
test/MC/ELF/relocation.s