[lld] 6be457c - [ELF] Work around not-fully-supported .gnu.linkonce.t.__x86.get_pc_thunk.bx
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 15 14:48:33 PDT 2022
Author: Fangrui Song
Date: 2022-03-15T14:48:29-07:00
New Revision: 6be457c14dafd634989c2c0b702a9231b438e2c4
URL: https://github.com/llvm/llvm-project/commit/6be457c14dafd634989c2c0b702a9231b438e2c4
DIFF: https://github.com/llvm/llvm-project/commit/6be457c14dafd634989c2c0b702a9231b438e2c4.diff
LOG: [ELF] Work around not-fully-supported .gnu.linkonce.t.__x86.get_pc_thunk.bx
Added:
Modified:
lld/ELF/Driver.cpp
lld/test/ELF/i386-linkonce.s
Removed:
################################################################################
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 15434cc4c7f67..72eff694acb10 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -2490,6 +2490,10 @@ void LinkerDriver::link(opt::InputArgList &args) {
parallelForEach(bitcodeFiles, [](BitcodeFile *file) { file->postParse(); });
for (auto &it : ctx->nonPrevailingSyms) {
Symbol &sym = *it.first;
+ // See the FIXME in InputFiles.cpp.
+ if (sym.getName() == "__x86.get_pc_thunk.bx" ||
+ sym.getName() == "__i686.get_pc_thunk.bx")
+ continue;
sym.replace(Undefined{sym.file, sym.getName(), sym.binding, sym.stOther,
sym.type, it.second});
cast<Undefined>(sym).nonPrevailing = true;
diff --git a/lld/test/ELF/i386-linkonce.s b/lld/test/ELF/i386-linkonce.s
index f7da0aed4af58..08727e0c29d4f 100644
--- a/lld/test/ELF/i386-linkonce.s
+++ b/lld/test/ELF/i386-linkonce.s
@@ -2,9 +2,11 @@
// RUN: llvm-mc -filetype=obj -triple=i386-linux-gnu %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=i386-linux-gnu %p/Inputs/i386-linkonce.s -o %t2.o
// RUN: llvm-ar rcs %t2.a %t2.o
-// RUN: not ld.lld %t.o %t2.a -o /dev/null 2>&1 | FileCheck %s
-// CHECK: error: relocation refers to a symbol in a discarded section: __i686.get_pc_thunk.bx
+/// crti.o in i386 glibc<2.32 has .gnu.linkonce.t.__x86.get_pc_thunk.bx that is
+/// not fully supported. Test that we don't report
+/// "relocation refers to a symbol in a discarded section: __x86.get_pc_thunk.bx".
+// RUN: ld.lld %t.o %t2.a -o /dev/null
.globl _start
_start:
More information about the llvm-commits
mailing list