summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2013-09-27 21:30:27 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2013-09-27 21:30:27 +0000
commit102f82a74eb9916a8ba67e210947e12b7fc8a142 (patch)
treebe6bb57b7aab78fba3b30938b91ddeb27a3938b5
parent3b364730070cf90af27a06b6c68288201087e880 (diff)
downloadbcm5719-llvm-102f82a74eb9916a8ba67e210947e12b7fc8a142.tar.gz
bcm5719-llvm-102f82a74eb9916a8ba67e210947e12b7fc8a142.zip
[ELF] Handle copy relocations for PC32.
This will eventually need to be refactored to better handle COPY relocations, as other relocations can also generate them. I'm not yet sure the exact circumstances in which they are needed yet. llvm-svn: 191567
-rw-r--r--lld/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp5
-rw-r--r--lld/test/elf/Inputs/undef-pc32.obin0 -> 1248 bytes
-rw-r--r--lld/test/elf/undef-from-main-dso.test3
3 files changed, 7 insertions, 1 deletions
diff --git a/lld/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp b/lld/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
index 2ef6f388a83..33c919eefd9 100644
--- a/lld/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
+++ b/lld/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
@@ -407,7 +407,10 @@ public:
if (auto sla = dyn_cast<SharedLibraryAtom>(ref.target())) {
if (sla->type() == SharedLibraryAtom::Type::Code)
return handlePLT32(ref);
- else
+ else if (sla->type() == SharedLibraryAtom::Type::Data) {
+ const_cast<Reference &>(ref).setTarget(getObjectEntry(sla));
+ return error_code::success();
+ } else
return handleGOTPCREL(ref);
}
return handleIFUNC(ref);
diff --git a/lld/test/elf/Inputs/undef-pc32.o b/lld/test/elf/Inputs/undef-pc32.o
new file mode 100644
index 00000000000..954916d5999
--- /dev/null
+++ b/lld/test/elf/Inputs/undef-pc32.o
Binary files differ
diff --git a/lld/test/elf/undef-from-main-dso.test b/lld/test/elf/undef-from-main-dso.test
index c1e7962f5b5..64c3d2e8fb7 100644
--- a/lld/test/elf/undef-from-main-dso.test
+++ b/lld/test/elf/undef-from-main-dso.test
@@ -1,6 +1,9 @@
RUN: lld -flavor gnu -e main -o %t -L%p/Inputs -lundef %p/Inputs/undef.o
RUN: llvm-readobj -relocations -symbols %t | FileCheck %s
+RUN: lld -flavor gnu -e main -o %t -L%p/Inputs -lundef %p/Inputs/undef-pc32.o
+RUN: llvm-readobj -relocations -symbols %t | FileCheck %s
+
# DSO source code:
# int x[2] = { 1, 2 };
#
OpenPOWER on IntegriCloud