[PATCH] D28430: ELF: Implement support for .gnu.linkonce.t.*.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 9 12:37:36 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291474: ELF: Discard .gnu.linkonce.* sections. (authored by pcc).
Changed prior to commit:
https://reviews.llvm.org/D28430?vs=83662&id=83671#toc
Repository:
rL LLVM
https://reviews.llvm.org/D28430
Files:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/test/ELF/comdat-linkonce.s
Index: lld/trunk/test/ELF/comdat-linkonce.s
===================================================================
--- lld/trunk/test/ELF/comdat-linkonce.s
+++ lld/trunk/test/ELF/comdat-linkonce.s
@@ -0,0 +1,9 @@
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/comdat.s -o %t2.o
+// RUN: ld.lld -shared %t.o %t2.o -o %t
+// RUN: ld.lld -shared %t2.o %t.o -o %t
+
+.section .gnu.linkonce.t.zed
+.globl abc
+abc:
+nop
Index: lld/trunk/ELF/InputFiles.cpp
===================================================================
--- lld/trunk/ELF/InputFiles.cpp
+++ lld/trunk/ELF/InputFiles.cpp
@@ -418,6 +418,14 @@
if (Config->Strip != StripPolicy::None && Name.startswith(".debug"))
return &InputSection<ELFT>::Discarded;
+ // The linkonce feature is a sort of proto-comdat. Some glibc i386 object
+ // files contain definitions of symbol "__x86.get_pc_thunk.bx" in linkonce
+ // sections. Drop those sections to avoid duplicate symbol errors.
+ // FIXME: This is glibc PR20543, we should remove this hack once that has been
+ // fixed for a while.
+ if (Name.startswith(".gnu.linkonce."))
+ return &InputSection<ELFT>::Discarded;
+
// The linker merges EH (exception handling) frames and creates a
// .eh_frame_hdr section for runtime. So we handle them with a special
// class. For relocatable outputs, they are just passed through.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28430.83671.patch
Type: text/x-patch
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170109/4fb37680/attachment.bin>
More information about the llvm-commits
mailing list