Bug: rust_binary linking fails for linux_aarch64_score_gcc_12_2_0_posix with non-PIC and missing outline atomic symbols

Open
#27 2 comments 0 reactions 1 assignee View on GitHub

@dcalavrezo-qorix is already working on this.

Since Jul 17, 2026.

Assessment

This issue has not been assessed yet.

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.

  1. 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
Dominant language
Starlark
Stars
1
Forks
11
Avg merge
11m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from eclipse-score/toolchains_rust

All issues in eclipse-score/toolchains_rust

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.