Skip to content
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

[arm32] R_ARM_PREL31 relocation at offset 0x18 against symbol `__gxx_personality_v0' #545

Closed
lancethepants opened this issue Jun 17, 2022 · 9 comments

Comments

@lancethepants
Copy link
Contributor

For a project of mine I compile a bunch of packages for arm32.
The majority link with mold, but of that ones that do not this is the most prevalent issue.

R_ARM_PREL31 relocation at offset 0x18 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
@lancethepants
Copy link
Contributor Author

I did try adding -fPIC but still got the same error.

@rui314
Copy link
Owner

rui314 commented Jun 18, 2022

It is hard to fix it without the object file causing this error. If your project is open-source, please share its URL so that I can try to built it on my machine.

@jpalus
Copy link
Contributor

jpalus commented Jun 18, 2022

Just tried mold 1.3.0 on armv7 to check if #442 improved and got the same error specifically when compiling pulseaudio.

Object file: webrtc.cc.o.zip

Compiled with:

armv7hnl-pld-linux-gnueabi-g++ -Isrc/modules/echo-cancel/libwebrtc-util.so.p -Isrc/modules/echo-cancel -I../src/modules/echo-cancel -I. -I.. -Isrc -I../src -I/usr/include/webrtc_aud
io_processing -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++11 -O2 -fwrapv -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -f
stack-protector-strong --param=ssp-buffer-size=4 -Werror=trampolines -fomit-frame-pointer -mfpu=neon-vfpv3 -march=armv7-a -mfloat-abi=hard -mthumb -fPIC -DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD -
DWEBRTC_POSIX -DHAVE_CONFIG_H -D_GNU_SOURCE -D__INCLUDED_FROM_PULSE_AUDIO -MD -MQ src/modules/echo-cancel/libwebrtc-util.so.p/webrtc.cc.o -MF src/modules/echo-cancel/libwebrtc-util.so.p/webrt
c.cc.o.d -o src/modules/echo-cancel/libwebrtc-util.so.p/webrtc.cc.o -c ../src/modules/echo-cancel/webrtc.cc  

Linker invocation with error:

armv7hnl-pld-linux-gnueabi-g++  -o src/modules/echo-cancel/libwebrtc-util.so src/modules/echo-cancel/libwebrtc-util.so.p/webrtc.cc.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--sta
rt-group -Wl,-soname,libwebrtc-util.so -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,-z,relro -Wl,-z,combreloc -Wl,-fuse-ld=mold -O2 -fwrapv -pipe -Wformat -Werror=format-security -Wp,-
D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=trampolines -fomit-frame-pointer -mfpu=neon-vfpv3 -march=armv7-a -mfloat-abi=hard -mthumb '-Wl,-rpath,$ORIGIN/../
../pulse:$ORIGIN/../..:$ORIGIN/../../pulsecore' -Wl,-rpath-link,/home/users/builder/rpm/BUILD/pulseaudio-16.0/build/src/pulse -Wl,-rpath-link,/home/users/builder/rpm/BUILD/pulseaudio-16.0/bui
ld/src -Wl,-rpath-link,/home/users/builder/rpm/BUILD/pulseaudio-16.0/build/src/pulsecore src/pulse/libpulse.so.0.24.2 src/libpulsecommon-16.0.so src/pulsecore/libpulsecore-16.0.so -Wl,-z,node
lete -Wl,--unresolved-symbols=ignore-in-object-files /usr/lib/libwebrtc_audio_processing.so -Wl,--end-group
mold: error: src/modules/echo-cancel/libwebrtc-util.so.p/webrtc.cc.o:(.ARM.extab): R_ARM_PREL31 relocation at offset 0x24 against symbol `__gxx_personality_v0' can not be used; recompile with
 -fPIC   

@jpalus
Copy link
Contributor

jpalus commented Jun 18, 2022

Same issue, same reproducer with armv6 in ARM mode (armv7 used Thumb).

@rui314 rui314 closed this as completed in 5294300 Jun 19, 2022
@rui314 rui314 reopened this Jun 19, 2022
@rui314
Copy link
Owner

rui314 commented Jun 19, 2022

Can you try again with the above commit?

@turkerali
Copy link

Hi there,
I tried the above commit, but this time I get SIGSEGV errors while building my rust project:

error: failed to run custom build command for libc v0.2.126

Caused by:
process didn't exit successfully: /srv/emmc/aet_rust/project1/target/debug/build/libc-038fb7a43663205c/build-script-build (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for proc-macro2 v1.0.39

Caused by:
process didn't exit successfully: /srv/emmc/aet_rust/project1/target/debug/build/proc-macro2-475e27ce17eff2b4/build-script-build (signal: 11, SIGSEGV: invalid memory reference)
error: failed to run custom build command for libc v0.2.126

Caused by:
process didn't exit successfully: /srv/emmc/aet_rust/project1/target/debug/build/libc-ceba8fa7b5020822/build-script-build (signal: 11, SIGSEGV: invalid memory reference)
error: failed to run custom build command for syn v1.0.98

Caused by:
process didn't exit successfully: /srv/emmc/aet_rust/project1/target/debug/build/syn-5bb2bb3ff346bd4b/build-script-build (signal: 11, SIGSEGV: invalid memory reference)

@jpalus
Copy link
Contributor

jpalus commented Jun 19, 2022

@rui314 with your commit pulseaudio links and works fine on both armv6 and armv7. Thanks!

I suppose above segfault is unrelated issue and if needed new ticket should be opened. Feel free to close this one.

@rui314
Copy link
Owner

rui314 commented Jun 19, 2022

OK, let me close this bug.

@turkerali Can you reopen a bug with a link to a repository which I can build on my machine, so that I can reproduce your issue locally?

@rui314 rui314 closed this as completed Jun 19, 2022
@lancethepants
Copy link
Contributor Author

The patch does fix my issue as well. Thanks a bunch! Linkers must be black magic looking at that patch.

I've also had issues linking rust on armv7, but that'll be a different issue. I suspect the firefox issue might be related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants