-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Unable to link Pony programs with gcc defaulting to PIE #1484
Comments
@Praetonus I see you did something back in October with Linux and libponyrt-pic. Any thoughts on this? |
I'm a bit lost on that one. The correct |
@Theodus is emailing the user list to try and get more input on "is this related specifically to this version of Ubuntu". |
This is likely because Ubuntu 16.10 enabled |
Nice catch, @dipinhora ! I think the options are:
Can anybody think of a nice way to detect if |
We can check for output from the command |
During the last sync meeting we decided to experiment with using LLD as the linker rather than depending on whatever linker is used by the C compiler building pony. |
I have finally figured out the combination of flags required to link stdlib.o with LLD, but now the resulting binary results in a segfault. here is the backtrace from LLDB:
This is the full command used to create the binary using LLD 5.0.0 (trunk 293818): ./build/debug/ponyc -d -r=obj packages/stdlib && \
ld.lld -o ./stdlib -O3 ./stdlib.o \
-L/home/theodus/dev/ponyc/build/release/ \
--rpath /home/theodus/dev/ponyc/build/release \
-L/home/theodus/dev/ponyc/build/release/../../packages \
--rpath /home/theodus/dev/ponyc/build/release/../../packages \
-L/usr/lib/x86_64-linux-gnu/ \
-L/usr/lib/gcc/x86_64-linux-gnu/6.2.0/ \
-L/usr/local/lib \
--rpath /usr/local/lib \
--start-group -lrt -lcrypto -lpcre2-8 -lssl \
--end-group -lponyrt -lpthread -ldl -lc -lm -lgcc -lgcc_eh \
--entry main |
@Theodus Can you try it with a debug build of the runtime to see if you get any additional information? |
@Praetonus Here is the LLDB output for the binary with the debug runtime:
|
I have also tested this with compiler-rt and libunwind instead of libgcc with the same result. Here is the updated command:
|
It should also be noted that linking with clang and |
Had another user report this same problem in #1588. Closed that ticket in favor of this one, and directed this user to this ticket. |
Also note that if we solve this issue in an automated way, we can revert #1152, which added instructions telling Arch Linux users to always specify the |
I'm on Ubuntu 16.10 and I get this error even when I pass the --pic flag. Also, on a semi-related note, I would be pro "always provide --pic". This is the sane, safe default. Here is the full error output: http://pastebin.com/G8PQKPZV Update: I think I had an old version of pony installed + the new version. After removing the old version the --pic flag fix works. I would recommend this as the default. |
Closing in favor of #1811 |
I am reopening this one, as it hits us again on ubuntu 18.04 when compiling with gcc which has Interestingly this only hits us with LLVM 7.0.1 compiled from source (with vendored LLVM using Steps to reproduce:
Failure:
Somehow
In an object file produced by
I am not sure where the differences in the generated object files come from. Will investigate further, but marking this as What might work (as we don't use lld yet) is to detect a |
Im unable to reproduce this using vendored LLVM from source. ONLY from the 7.0.1 download from LLVM. Are you sure it isn't a problem with how that 7.0.1 download was built? |
To add color @mfelsche, I have built using the vendored LLVM 7.0.1 multiple times without issue. |
To add even more color: I have two **EDIT: Mistakes were made. IR is identical, bitcode, asm and object file differs. |
I don't think this issue is the one you've reopened @mfelsche. I have been unable to reproduce except with the LLVM 7.0.1 from LLVM releases. The fix for the previous problem is being done. I think what you are looking at is a different issues. |
Originally reported by james on the user group here
ponyc fails when gcc is used as the linker with the following error:
I believe the problem is that stdlib.o is being linked with libponyrt-pic.a which is position-independent, so stdlib.o also has to be made position independent by compiling with
--pic
. The question is why this doesn't occur when clang is used as the linker.The text was updated successfully, but these errors were encountered: