forked from OSchip/llvm-project
[ELF] Don't define __rela_iplt_start for -pie/-shared
`clang -fuse-ld=lld -static-pie -fpie` produced executable currently crashes and this patch makes it work. See https://sourceware.org/bugzilla/show_bug.cgi?id=27164 and https://sourceware.org/pipermail/libc-alpha/2021-July/128810.html While it seems unreasonable to keep csu/libc-start.c ARCH_APPLY_IREL unclear in static-pie mode and have an unneeded diff -u =(ld.bfd --verbose) =(ld.bfd -pie --verbose) difference, glibc folks don't want to fix their code. I feel sad about that but this patch can remove an iffy condition for lld/ELF as well: `needsInterpSection()`.
This commit is contained in:
parent
80f9fd4ce3
commit
f8cb78e99a
|
@ -1088,7 +1088,7 @@ void PhdrEntry::add(OutputSection *sec) {
|
|||
// need these symbols, since IRELATIVE relocs are resolved through GOT
|
||||
// and PLT. For details, see http://www.airs.com/blog/archives/403.
|
||||
template <class ELFT> void Writer<ELFT>::addRelIpltSymbols() {
|
||||
if (config->relocatable || needsInterpSection())
|
||||
if (config->relocatable || config->isPic)
|
||||
return;
|
||||
|
||||
// By default, __rela_iplt_{start,end} belong to a dummy section 0
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
# RUN: ld.lld -shared %t.o -o %t2
|
||||
# RUN: llvm-readelf -s %t2 | FileCheck %s --check-prefix=PIC
|
||||
|
||||
# PIC: 0 NOTYPE LOCAL HIDDEN [[#]] __rela_iplt_start
|
||||
# PIC-NEXT: 0 NOTYPE LOCAL HIDDEN [[#]] __rela_iplt_end
|
||||
# PIC: 0 NOTYPE WEAK DEFAULT UND __rela_iplt_start
|
||||
# PIC-NEXT: 0 NOTYPE WEAK DEFAULT UND __rela_iplt_end
|
||||
|
||||
# DISASM: Disassembly of section .text:
|
||||
# DISASM-EMPTY:
|
||||
|
|
Loading…
Reference in New Issue