[lld] 57bfa2d - [ELF] Delete unused --warn-ifunc-textrel
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 2 09:47:13 PST 2021
Author: Fangrui Song
Date: 2021-02-02T09:47:06-08:00
New Revision: 57bfa2ddb6bf1f1814295a2423258fdd46cb702c
URL: https://github.com/llvm/llvm-project/commit/57bfa2ddb6bf1f1814295a2423258fdd46cb702c
DIFF: https://github.com/llvm/llvm-project/commit/57bfa2ddb6bf1f1814295a2423258fdd46cb702c.diff
LOG: [ELF] Delete unused --warn-ifunc-textrel
The option catches incompatibility between `R_*_IRELATIVE` and DT_TEXTREL/DF_TEXTREL
before glibc 2.29. Newer glibc versions are more common nowadays and I don't
think this option has ever been used. Diagnosing this problem is also
straightforward by reading the stack trace.
Added:
Modified:
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/Relocations.cpp
Removed:
lld/test/ELF/textrel.s
################################################################################
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index c84b5f5bdfda..7881dfe82c87 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -215,7 +215,6 @@ struct Configuration {
bool warnBackrefs;
std::vector<llvm::GlobPattern> warnBackrefsExclude;
bool warnCommon;
- bool warnIfuncTextrel;
bool warnMissingEntry;
bool warnSymbolOrdering;
bool writeAddends;
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 3b2a8ba19293..dce0a9c0f318 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1093,8 +1093,6 @@ static void readConfigs(opt::InputArgList &args) {
config->warnBackrefs =
args.hasFlag(OPT_warn_backrefs, OPT_no_warn_backrefs, false);
config->warnCommon = args.hasFlag(OPT_warn_common, OPT_no_warn_common, false);
- config->warnIfuncTextrel =
- args.hasFlag(OPT_warn_ifunc_textrel, OPT_no_warn_ifunc_textrel, false);
config->warnSymbolOrdering =
args.hasFlag(OPT_warn_symbol_ordering, OPT_no_warn_symbol_ordering, true);
config->zCombreloc = getZFlag(args, "combreloc", "nocombreloc", true);
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index da070e4a2880..b4847dace4f7 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1317,16 +1317,6 @@ static void scanReloc(InputSectionBase &sec, OffsetGetter &getOffset, RelTy *&i,
if (expr == R_NONE)
return;
- if (sym.isGnuIFunc() && !config->zText && config->warnIfuncTextrel) {
- warn("using ifunc symbols when text relocations are allowed may produce "
- "a binary that will segfault, if the object file is linked with "
- "old version of glibc (glibc 2.28 and earlier). If this applies to "
- "you, consider recompiling the object files without -fPIC and "
- "without -Wl,-z,notext option. Use -no-warn-ifunc-textrel to "
- "turn off this warning." +
- getLocation(sec, sym, offset));
- }
-
// Read an addend.
int64_t addend = computeAddend<ELFT>(rel, end, sec, expr, sym.isLocal());
diff --git a/lld/test/ELF/textrel.s b/lld/test/ELF/textrel.s
deleted file mode 100644
index fac67d542af7..000000000000
--- a/lld/test/ELF/textrel.s
+++ /dev/null
@@ -1,40 +0,0 @@
-# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnu %s -o %t.o
-
-# Without --warn-text-ifunc, lld should run fine:
-# RUN: ld.lld -z notext %t.o -o %t2
-
-# With --warn-text-ifunc, lld should run with warnings:
-# RUN: ld.lld --warn-ifunc-textrel -z notext %t.o -o /dev/null 2>&1 | FileCheck %s
-# CHECK: using ifunc symbols when text relocations are allowed may produce
-# CHECK-SAME: a binary that will segfault, if the object file is linked with
-# CHECK-SAME: old version of glibc (glibc 2.28 and earlier). If this applies to
-# CHECK-SAME: you, consider recompiling the object files without -fPIC and
-# CHECK-SAME: without -Wl,-z,notext option. Use -no-warn-ifunc-textrel to
-# CHECK-SAME: turn off this warning.
-# CHECK: >>> defined in {{.*}}
-# CHECK: >>> referenced by {{.*}}:(.text+0x8)
-
-# Without text relocations, lld should run fine:
-# RUN: ld.lld --fatal-warnings %t.o -o /dev/null
-
-.text
-.globl a_func_impl
-a_func_impl:
- nop
-
-.globl selector
-.type selector, at function
-selector:
- movl $a_func_impl, %eax
- retq
-
-.globl a_func
-.type a_func, at gnu_indirect_function
-.set a_func, selector
-
-.globl _start
-.type _start, at function
-main:
- callq a_func
- retq
More information about the llvm-commits
mailing list