aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2021-02-02 09:47:06 -0800
committerFangrui Song <i@maskray.me>2021-02-02 09:47:06 -0800
commit57bfa2ddb6bf1f1814295a2423258fdd46cb702c (patch)
tree78ed728c47142ac205f153bc2ca8015dd7168000
parentd3e2e3740d0730cb6788c771bb01a8f3e935bf2e (diff)
downloadllvm-57bfa2ddb6bf1f1814295a2423258fdd46cb702c.zip
llvm-57bfa2ddb6bf1f1814295a2423258fdd46cb702c.tar.gz
llvm-57bfa2ddb6bf1f1814295a2423258fdd46cb702c.tar.bz2
[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.
-rw-r--r--lld/ELF/Config.h1
-rw-r--r--lld/ELF/Driver.cpp2
-rw-r--r--lld/ELF/Relocations.cpp10
-rw-r--r--lld/test/ELF/textrel.s40
4 files changed, 0 insertions, 53 deletions
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index c84b5f5..7881dfe 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 3b2a8ba..dce0a9c 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 da070e4..b4847da 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 fac67d5..0000000
--- 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,@function
-selector:
- movl $a_func_impl, %eax
- retq
-
-.globl a_func
-.type a_func,@gnu_indirect_function
-.set a_func, selector
-
-.globl _start
-.type _start,@function
-main:
- callq a_func
- retq