This does not support TPOFF32 relocations to local symbols as the address calculations are separate. Support for this will be a separate patch.
llvm-svn: 251998
This is a case where there is inconsistency among ELF linkers:
* The spec says nothing special about empty sections.
* BFD ld removes them.
* Gold handles them like regular sections.
We were outputting them but sometimes ignoring them. This would create
odd looking outputs where a rw section could be in a ro segment for example.
The bfd way of doing things is also strange for the case where a symbol
points to the empty section.
Now we match gold and what seems to be the intention of the spec.
llvm-svn: 251988
It is required to fill up the GNU hash table section before its
finalize() method is called.
Differential Revision: http://reviews.llvm.org/D14196
llvm-svn: 251789
MachODefinedCustomSectionAtom.
The section names for these atoms are initialized from temporaries (e.g.
segName + "/" + sectName), so we can't use StringRef here.
llvm-svn: 251610
It is the GNU hash table section that should be reaponsible for storing its own
data and applying its requirements for the order to dynamic symbols.
Differential Revision: http://reviews.llvm.org/D14084
llvm-svn: 251502
GNU linkers accept both variants and at least for MIPS target gcc passes
joined variant of the '-m' option.
Differential Revision: http://reviews.llvm.org/D14133
llvm-svn: 251497
This matches ld.bfd and ld.gold behavior. The change is simple enough
and avoid trouble to consumers (they don't have to change their Makefiles).
Side note: found while trying to build FreeBSD base system with lld.
llvm-svn: 251408
There was a threading issue in the ICF code for COFF. That seems like
a venign bug in the sense that it doesn't produce an incorrect output,
but it oftentimes misses reducible sections. As a result, mergeable
sections could remain in outputs, which makes the output nondeterministic.
Basically the algorithm we are using for ICF is this: We group sections
so that identical sections will eventually be in the same group. Initially,
all sections are in one group. We split the group by relocation targets
until we get a convergence (if relocation targets are in different gruops,
the sections are different). Once a group is split, they will never be
merged.
Each section has a group ID. That variable itself is atomic, so there's
no threading issue at the level that we can use thread sanitizer.
The point is, when we split a group, we re-assign new group IDs to group
of sections. That are multiple separate writes to atomic varaibles.
Thus, splitting a group is not an atomic operation, and there's a small
chance that the other thread observes inconsistent group IDs.
Over-splitting is always "safe", so it will never create incorrect output.
I suspect that the nondeterminism stems from that point. However, I
cannot prove or fix that at this moment, so I'm going to avoid using
threads here.
llvm-svn: 251300
getFileOff functions defined for other classes return an offset
from beginning of the file. StringTableSection's getFileOff however
returned an offset from beginning of the section. That was confusing.
llvm-svn: 251192