This is an archive of the discontinued LLVM Phabricator instance.

[lld] Allow rel iplt symbols with dynamic symbol table
ClosedPublic

Authored by smeenai on Aug 4 2017, 8:46 PM.

Details

Summary

Emit these symbols as long as we're building in a static configuration,
even if we're emitting a dynamic symbol table. This is consistent with
both bfd and gold.

Ordinarily, the combination of -static and -export-dynamic wouldn't make
much sense. Unfortunately, cmake versions prior to 3.4 forcefully
injected -rdynamic [1], so it seems worthwhile to support.

[1] https://cmake.org/cmake/help/v3.4/policy/CMP0065.html

Diff Detail

Repository
rL LLVM

Event Timeline

smeenai created this revision.Aug 4 2017, 8:46 PM

Instead of duplicating the test, I can either generalize the existing test to handle both the regular and --export-dynamic cases by replacing hardcoded values with regular expressions where necessary, or just add multiple check prefixes to the existing test and handle the value differences that way. Let me know what's preferable.

ruiu edited edge metadata.Aug 4 2017, 8:59 PM

I'd just check for the existence of __rela_iplt_{start,end} symbols. We don't need to verify its disassembly as that should already been tested by other tests.

smeenai updated this revision to Diff 109855.Aug 4 2017, 9:11 PM

Simplify test

ruiu requested changes to this revision.Aug 4 2017, 9:32 PM
ruiu added inline comments.
test/ELF/gnu-ifunc-dynsym.s
7 ↗(On Diff #109855)

Remove -DAG?

This revision now requires changes to proceed.Aug 4 2017, 9:32 PM
smeenai updated this revision to Diff 109857.Aug 4 2017, 9:34 PM
smeenai edited edge metadata.

Address comment

smeenai added inline comments.Aug 4 2017, 9:34 PM
test/ELF/gnu-ifunc-dynsym.s
7 ↗(On Diff #109855)

I had the -DAG because I don't care about the order in which the symbols appear, only that they're both present. I'm happy without it as well though.

smeenai added inline comments.Aug 4 2017, 9:36 PM
test/ELF/gnu-ifunc-dynsym.s
7 ↗(On Diff #109855)

To clarify, I meant their order in the llvm-nm output. Of course the end symbol should be after the start symbol in terms of addresses, but llvm-nm appears to print out symbols in reverse order of addresses, at least in this instance.

ruiu accepted this revision.Aug 4 2017, 9:56 PM

LGTM

test/ELF/gnu-ifunc-dynsym.s
7 ↗(On Diff #109855)

Ah, I didn't actually know that FileCheck had such feature.

This revision is now accepted and ready to land.Aug 4 2017, 9:56 PM
This revision was automatically updated to reflect the committed changes.