-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link failure with -z notext (it changes behaviour, not just allows DT_TEXTREL) #35068
Comments
Also I think the sense of this comment is backwards: // Or, if we are allowed to create dynamic relocations against That should be "i.e., if "-z notext" is given" |
Looking at this. But you also helped to find bug in google translate :) |
Reduced test case is following. main.s: dso.s: llvm-mc -filetype=obj -triple=x86_64-pc-linux main.s -o main.o ld.lld test.o -o out dso.so -z notext
|
First fix for 'hello world' was committed as r321400. |
Second fix is https://reviews.llvm.org/D41551, |
Last piece: r321473. |
Extended Description
-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
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.
The text was updated successfully, but these errors were encountered: