eclipse-score / eclipse-score/toolchains_rust
Bug: rust_binary linking fails for linux_aarch64_score_gcc_12_2_0_posix with non-PIC and missing outline atomic symbols
- Dominant language
- Starlark
- Stars
- 1
- Forks
- 11
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
### Description
Building any rust_binary that depends on C++ static libraries fails when using --config linux_aarch64_score_gcc_12_2_0_posix.
Root Causes (two distinct issues):
1. Non-PIC static libraries + PIE linker default
The score_gcc_aarch64_toolchain (GCC 12.2.0) is built without --enable-default-pie, meaning its static C++ and system libraries (e.g. libacl) are compiled without -fPIC
The Rust linker defaults to -pie (Position Independent Executable) on Linux for security
Linking non-PIC objects with -pie causes relocation errors against symbols.
2. Missing aarch64 outline atomic helpers
GCC 12.2.0 generates calls to outline atomic helper functions (__aarch64_ldadd4_acq_rel, __aarch64_cas2_acq_rel, __aarch64_swp4_acq_rel, __aarch64_ldset4_acq_rel) for aarch64.
### Analysis results
_No response_
### Solution
We need to add - --@rules_rust//:extra_rustc_flags=-Clink-arg=-no-pie, -Clink-arg=-lgcc
### Error Occurrence Rate
None
### How to reproduce
bazel build //score/mw/com/example/com-api-example --config linux_aarch64_score_gcc_12_2_0_posix
### Supporting Information
_No response_
### Classification
Minor
### First Affected Release
not released (main)
### Last Affected Release
not released (main)
### Expected Fixed Release
before release (main)
### Category
- [ ] Safety Relevant
- [ ] Security Relevant
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.