[llvm-bugs] [Bug 35720] New: Link failure with -z notext (it changes behaviour, not just allows DT_TEXTREL)
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Dec 21 11:41:06 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35720
Bug ID: 35720
Summary: Link failure with -z notext (it changes behaviour, not
just allows DT_TEXTREL)
Product: lld
Version: unspecified
Hardware: PC
OS: FreeBSD
Status: NEW
Severity: enhancement
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: emaste at freebsd.org
CC: llvm-bugs at lists.llvm.org
-z notext should allow relocations in a read-only (i.e., the .text) segment,
but lld changes behaviour when -z notext is specified and linking a trivial
application on FreeBSD fails:
% cc -Wl,-z,notext hello.c
/usr/bin/ld: error: relocation R_X86_64_PC32 cannot be used against shared
object; recompile with -fPIC
>>> defined in /lib/libc.so.7
>>> referenced by crt1.c:63 (/usr/home/emaste/src/freebsd/lib/csu/amd64/crt1.c:63)
>>> /usr/lib/crt1.o:(_start)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
I do not have a reduced test case, but can attach a reproducer for the hello
world link if desired. However, I observe that RelExpr() bypasses the special
case for Sym.isFunc() if !Config->ZText. There's a comment in RelExpr() that
describes this same issue occurring with glibc.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171221/7d017b54/attachment.html>
More information about the llvm-bugs
mailing list