diff options
-rw-r--r-- | lld/lib/Driver/CoreOptions.td | 1 | ||||
-rw-r--r-- | lld/lib/ReaderWriter/ELF/AtomsELF.h | 3 | ||||
-rw-r--r-- | lld/test/elf/Inputs/ifunc.S | 14 | ||||
-rw-r--r-- | lld/test/elf/Inputs/ifunc.x86-64 | bin | 0 -> 733 bytes | |||
-rw-r--r-- | lld/test/elf/ifunc.test | 6 |
5 files changed, 24 insertions, 0 deletions
diff --git a/lld/lib/Driver/CoreOptions.td b/lld/lib/Driver/CoreOptions.td index 143e9974f40..7c5c6d43601 100644 --- a/lld/lib/Driver/CoreOptions.td +++ b/lld/lib/Driver/CoreOptions.td @@ -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">; diff --git a/lld/lib/ReaderWriter/ELF/AtomsELF.h b/lld/lib/ReaderWriter/ELF/AtomsELF.h index f9ee661cda9..e184d37f985 100644 --- a/lld/lib/ReaderWriter/ELF/AtomsELF.h +++ b/lld/lib/ReaderWriter/ELF/AtomsELF.h @@ -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; diff --git a/lld/test/elf/Inputs/ifunc.S b/lld/test/elf/Inputs/ifunc.S new file mode 100644 index 00000000000..ff9ac2dfc0e --- /dev/null +++ b/lld/test/elf/Inputs/ifunc.S @@ -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 diff --git a/lld/test/elf/Inputs/ifunc.x86-64 b/lld/test/elf/Inputs/ifunc.x86-64 Binary files differnew file mode 100644 index 00000000000..273c75eca04 --- /dev/null +++ b/lld/test/elf/Inputs/ifunc.x86-64 diff --git a/lld/test/elf/ifunc.test b/lld/test/elf/ifunc.test new file mode 100644 index 00000000000..0e636a49617 --- /dev/null +++ b/lld/test/elf/ifunc.test @@ -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 |