[llvm-branch-commits] [lld] r352355 - Merging r352302:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 28 05:38:10 PST 2019
Author: hans
Date: Mon Jan 28 05:38:10 2019
New Revision: 352355
URL: http://llvm.org/viewvc/llvm-project?rev=352355&view=rev
Log:
Merging r352302:
Redirecting to URL 'https://llvm.org/svn/llvm-project/lld/trunk':
------------------------------------------------------------------------
r352302 | nickdesaulniers | 2019-01-27 03:54:23 +0100 (Sun, 27 Jan 2019) | 33 lines
lld: elf: discard more specific .gnu.linkonce section
Summary:
lld discards .gnu.linonce.* sections work around a bug in glibc.
https://sourceware.org/bugzilla/show_bug.cgi?id=20543
Unfortunately, the Linux kernel uses a section named
.gnu.linkonce.this_module to store infomation about kernel modules. The
kernel reads data from this section when loading kernel modules, and
errors if it fails to find this section. The current behavior of lld
discards this section when kernel modules are linked, so kernel modules
linked with lld are unloadable by the linux kernel.
The Linux kernel should use a comdat section instead of .gnu.linkonce.
The minimum version of binutils supported by the kernel supports comdat
sections. The kernel is also not relying on the old linkonce behavior;
it seems to have chosen a name that contains a deprecated GNU feature.
Changing the section name now in the kernel would require all kernel
modules to be recompiled to make use of the new section name. Instead,
rather than discarding .gnu.linkonce.*, let's discard the more specific
section name to continue working around the glibc issue while supporting
linking Linux kernel modules.
Link: https://github.com/ClangBuiltLinux/linux/issues/329
Reviewers: pcc, espindola
Reviewed By: pcc
Subscribers: nathanchance, emaste, arichardson, void, srhines
Differential Revision: https://reviews.llvm.org/D57294
------------------------------------------------------------------------
Added:
lld/branches/release_80/test/ELF/no-discard-this_module.s
- copied unchanged from r352302, lld/trunk/test/ELF/no-discard-this_module.s
Modified:
lld/branches/release_80/ (props changed)
lld/branches/release_80/ELF/InputFiles.cpp
lld/branches/release_80/test/ELF/comdat-linkonce.s
Propchange: lld/branches/release_80/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 28 05:38:10 2019
@@ -1 +1 @@
-/lld/trunk:351326,351335,351898-351899,352068,352082,352257
+/lld/trunk:351326,351335,351898-351899,352068,352082,352257,352302
Modified: lld/branches/release_80/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_80/ELF/InputFiles.cpp?rev=352355&r1=352354&r2=352355&view=diff
==============================================================================
--- lld/branches/release_80/ELF/InputFiles.cpp (original)
+++ lld/branches/release_80/ELF/InputFiles.cpp Mon Jan 28 05:38:10 2019
@@ -736,7 +736,8 @@ InputSectionBase *ObjFile<ELFT>::createI
// 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."))
+ if (Name == ".gnu.linkonce.t.__x86.get_pc_thunk.bx" ||
+ Name == ".gnu.linkonce.t.__i686.get_pc_thunk.bx")
return &InputSection::Discarded;
// If we are creating a new .build-id section, strip existing .build-id
Modified: lld/branches/release_80/test/ELF/comdat-linkonce.s
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_80/test/ELF/comdat-linkonce.s?rev=352355&r1=352354&r2=352355&view=diff
==============================================================================
--- lld/branches/release_80/test/ELF/comdat-linkonce.s (original)
+++ lld/branches/release_80/test/ELF/comdat-linkonce.s Mon Jan 28 05:38:10 2019
@@ -4,7 +4,12 @@
// 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
+.section .gnu.linkonce.t.__x86.get_pc_thunk.bx
.globl abc
abc:
nop
+
+.section .gnu.linkonce.t.__i686.get_pc_thunk.bx
+.globl def
+def:
+nop
More information about the llvm-branch-commits
mailing list