HomeFreeBSD

Pull in r315334 from upstream lld trunk (by Rafael Espindola):
AuditedrS326831

Description

Pull in r315334 from upstream lld trunk (by Rafael Espindola):

Don't create a dummy __tls_get_addr.

We just don't need one with the current setup.

We only error on undefined references that are used by some
relocation.

If we managed to relax all uses of __tls_get_addr, no relocation uses
it and we don't produce an error.

This is less code and fixes the case were we fail to relax. Before we
would produce a broken output, but now we produce an error.

Pull in r320390 from upstream lld trunk (by Rafael Espindola):

Create reserved symbols early so they can be versioned.

This fixes pr35570.

We were creating these symbols after parsing version scripts, so they
could not be versioned.

We cannot move the version script parsing later because we need it for
lto.

One option is to move both addReservedSymbols and
createSyntheticSections earlier. The disadvantage is that some
sections created by createSyntheticSections replace other input
sections. For example, gdb index replaces .debug_gnu_pubnames, so it
wants to run after gc sections so that it can set S->Live to false.

What this patch does instead is to move just the ElfHeader creation
early.

Pull in r320412 from upstream lld trunk (by Rafael Espindola):

Handle symbols pointing to output sections.

Now that gc sections runs after linker defined symbols are added it
can see symbols that point to an OutputSection.

Should fix a bot failure.

Pull in r320431 from upstream lld trunk (by Peter Collingbourne):

ELF: Do not follow relocation edges to output sections during GC.

This fixes an assertion error introduced by r320390.

Differential Revision: https://reviews.llvm.org/D41095

Together these fix handling of reserved symbols, in particular _end,
which is needed to make brk(2) and sbrk(2) work correctly. This
unbreaks the emacs ports on amd64, and also appears to unbreak most of
world on i386.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13466

Details

Auditors
emaste
Provenance
dimAuthored on
Differential Revision
D13466: Apply upstream lld fixes for correct _end handling
Parents
rS326830: MFC r326748:
Branches
Unknown
Tags
Unknown

Event Timeline

emaste added a subscriber: emaste.

LGTM. I compared this to my backport+the three additional commits you identified, and the only difference was an addReservedSymbols declaration that I forgot in a header.

All concerns with this commit have now been addressed.Dec 13 2017, 7:51 PM