-
Notifications
You must be signed in to change notification settings - Fork 5
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
Linking fails with relocation truncated to fit
on linux/arm64
#28
Comments
...while investigating prysmaticlabs/hashtree#28
Can you provide the full toolchain and execution environment? Is this metal or stimulated? Is this running in docker? I can't reproduce on a RPi yet |
I have yet to dig into the details, but very broadly, that build is done inside a docker image on linux/amd64 using a cross compiler.. The repro is to do a fresh clone status-im/nimbus-eth2@137d969, then run |
There's probably an easier way to repro by drilling down into the flags used in that build, I just haven't had time yet for a more thorough investigation |
Can you link with
` |
Adding: this doesn't get triggered by cross-compiling on Arch either:
|
We faced the same issues on our native linux-arm machines (no cross compilation). https://github.com/ethpandaops/eth-client-docker-image-builder/blob/master/nimbus-eth2/Dockerfile.beacon |
I'm sorry all I see are nimbus specific compilation scripts and not something related to this library. Can you post me the result of the linking face with the LDFLAGS as above? I can't reproduce this neither natively compiling on ARM nor cross compiling from x86, so it's hard to rule out if this is not Nimbus or Docker related. |
Update, @barnabasbusa was kind enough to give me access to the same type of box they are using in ethPandaOps, no issue here, clean compile:
Inclined on closing this issue until I get a reproducible example. Edit: my guess will be that the Nim compilation takes the .text sections of the library and mixes it with the .text sections of Nimbus, similarly with the .rodata sections, this will definitely cause the relocation warnings since the rodata section will be pushed further from the 21 bit allows for the |
...while investigating prysmaticlabs/hashtree#28
indeed, we embed the genesis states in the executable which means there's a lot of data in general in there - this is my suspicion as well, that the issue would only be reproducible in large binaries. 21 bits is not a lot in this context. anyway, I intend to add more compilation info and repros soonish - just needed an open issue to start the documentation process of what's going on. |
yep, here's an easy repro.. #if defined(__APPLE__)
# define cdecl(s) _##s
#else
# define cdecl(s) s
#endif
#if defined(__linux__)
.section .note.GNU-stack, "", @progbits
.section .rodata,"a",@progbits
#elif defined(__APPLE__)
.section __TEXT,__const
#elif defined(__WIN32__)
.section .rdata,"dr"
#else
.text
#endif
# name_data = start of data
# name_end = end of data (without alignment)
# name = 64-bit pointer to data
# name_size = 64-bit length in bytes
eth2_mainnet_genesis_data:
.incbin "genesis.ssz"
eth2_mainnet_genesis_end:
.global cdecl(eth2_mainnet_genesis_size)
.p2align 3
cdecl(eth2_mainnet_genesis_size):
.quad eth2_mainnet_genesis_end - eth2_mainnet_genesis_data put this file in |
|
This seems to work with |
Consumers of the library, if they insert a lot of data between text and .rodata may hit a relocation issue when linking. Rather than tweaking the linker, this PR fixes the addressing modes by adding a couple of cycles when loading symbols allowing them to be separated to 32 bits. Fixes #28
Consumers of the library, if they insert a lot of data between text and .rodata may hit a relocation issue when linking. Rather than tweaking the linker, this PR fixes the addressing modes by adding a couple of cycles when loading symbols allowing them to be separated to 32 bits. Fixes #28
When linking the built files on linux/arm64, we hit a relocation truncation:
This looks similar to an issue openssl ran into with assembly code.
The text was updated successfully, but these errors were encountered: