-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
Binary linking with libprotobuf.a got segmentation fault on CentOS 7 #1113
Comments
cc @zonyitoo |
It took a little bit of time to debug this thing, but it looks like your executable contains both LLVM lld failed to produce a working executable, too. I think we should make a change to mold so that it prints out a warning message if the output contains both |
Thanks for your debug. |
Did you rebuild |
I rebuild libprotobuf.a with gcc 7.5, then it runs well. If only building the test program with gcc 7.5 or 10.0, but with old version libprotobuf.a, it still has segmentation fault. |
BTW, if mold can print warning under this circumstance, it would be great to know the result better. |
There's no flaw in gcc 4.8.5, that's just too old. The old compiler produces To turn warnings into errors, pass |
As for the warning message if the output contains both .ctors and .init_array, when could we expect using this new feature? |
We could detect and address the situation by translating |
We are planning to rebuild static libraries with newer gcc version to avoid having |
No need to send me a PR. Let me do that got you. |
I've implemented a feature to translate .ctors/.dtors to .init_array/.fini_array, so that mold would work in your environment. Can you try again with the git head? |
Thanks for supporting this, I will have a try |
With the git head version, it works well in my environment. Thanks again for supporting this feature. |
Cool! Thank you for verifying. |
.init_array/.fini_array haven't completely replace .ctors/.dtors, so we need to convert .ctors/.dtors to .init_array/.fini_array. Fixes rui314#1113
The following test program crashes (segmentation fault) when building and running on CentOS 7 x86_64 (with glibc 2.17, gcc 4.8.5 and mold 2.2.0)
Protobuf version is 3.5.1 and the static library is prebuilt on the same system.
Binary built command
The binary works as expected when linking with gold, but got segmentation fault when linking with mold.
The backtraces are listed below
The repro tar file(had to zip it because GitHub wouldn't allow to upload a tarball), source code and protobuf library are uploaded.
test_datapiece_mold.repro.tar.zip
mold_case.zip
The text was updated successfully, but these errors were encountered: