[ELF] Read IFUNC symbols correctly as typeResolver.

llvm-svn: 173299
This commit is contained in:
Michael J. Spencer 2013-01-23 22:08:46 +00:00
parent 4f2162f8f8
commit 563d33a6f1
5 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,6 @@
include "llvm/Option/OptParser.td"
def core : Flag<["-"], "core">;
def flavor : Separate<["-"], "flavor">;
def target : Separate<["-"], "target">, HelpText<"Target triple to link for">;
def mllvm : Separate<["-"], "mllvm">, HelpText<"Options to pass to LLVM">;

View File

@ -236,6 +236,9 @@ public:
ContentType ret = typeUnknown;
uint64_t flags = _section->sh_flags;
if (_symbol->getType() == llvm::ELF::STT_GNU_IFUNC)
return typeResolver;
if (_symbol->st_shndx == llvm::ELF::SHN_COMMON)
return typeZeroFill;

View File

@ -0,0 +1,14 @@
.text
.globl hey;
.type hey, @function;
hey:
.type hey, @gnu_indirect_function;
leaq __hey_1(%rip), %rax
ret
.text
.type __hey_1, @function;
.globl __hey_1;
__hey_1:
movq $42, %rax
ret

Binary file not shown.

6
lld/test/elf/ifunc.test Normal file
View File

@ -0,0 +1,6 @@
RUN: lld -core -target x86_64-linux -emit-yaml -output=- %p/Inputs/ifunc.x86-64 \
RUN: | FileCheck %s
CHECK: name: hey
CHECK: scope: global
CHECK: type: resolver