Commit Graph

4 Commits

Author SHA1 Message Date
Rafael Espindola cceacd7113 Don't depend on lld creating relocations in ro segments.
We currently don't do a good job of diagnosing inputs that would require
dynamic relocations to be applied to read only segments.

I am about to improve lld in that area, but unfortunately we developed
tests that depend on the current behavior.

To make clear what is actually changing, this first patch just updates
tests to not depend on the current behavior. In most cases this just
means using a rw section instead of a ro one, but that unfortunately
changes many addresses.

llvm-svn: 268145
2016-04-30 00:49:10 +00:00
Rafael Espindola 8caf33c483 Cleanup the handling of MustBeInDynSym and IsUsedInRegularObj.
Now MustBeInDynSym is only true if the symbol really must be in the
dynamic symbol table.

IsUsedInRegularObj is only true if the symbol is used in a .o or -u. Not
a .so or a .bc.

A benefit is that this is now done almost entirilly during symbol
resolution. The only exception is copy relocations because of aliases.

This includes a small fix in that protected symbols in .so don't force
executable symbols to be exported.

This also opens the way for implementing internalize for -shared.

llvm-svn: 265826
2016-04-08 18:39:03 +00:00
Rafael Espindola a15fb15b05 Don't lower the visibility because of shared symbols.
If a shared library has a protected symbol 'foo', that doesn't imply
that the symbol 'foo' in the output should be protected or not.

llvm-svn: 265794
2016-04-08 16:11:42 +00:00
Rafael Espindola b729b2131d Produce STV_DEFAULT for symbols in shared libraries.
The spec says:
If a symbol definition with STV_PROTECTED visibility from a shared
object is taken as resolving a reference from an executable or another
shared object, the SHN_UNDEF symbol table entry created has STV_DEFAULT
visibility.

llvm-svn: 265792
2016-04-08 15:43:43 +00:00