google-protobuf 0.36.2-release fails to compile for ARMv7: @progbits rejected in global_asm!

Open Beginner friendly
#31,619 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@farisbasha is already working on this.

Since Nov 18, 2026.

  • #31700 by @farisbasha — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
embedded-iot

Research direction

Read rust/upb_kernel/extension.rs around lines 32–45, where the Unix global_asm! block declares the sections, and compare the assembler syntax for ARM with the current directives. Reproduce the failure with the issue’s minimal Rust example targeting armv7a-none-eabi. Done when the ARM-targeted crate compiles successfully and the existing section declarations continue to work for supported Unix targets.

Written by the indexing model from the issue text.

Description

bug help wanted rust
Description

Cross-compiling a Rust application for armv7-unknown-linux-gnueabihf fails while rustc compiles google-protobuf 0.36.2-release. The failure is in the runtime crate’s assembly, not in the protoc binary or generated code from a .proto file.

The dependency chain is:

protobuf 4.36.2-release
└── google-protobuf 0.36.2-release

Environment
  • Rust: rustc 1.97.1
  • Target: armv7-unknown-linux-gnueabihf
  • Cross toolchain: Buildroot, using arm-buildroot-linux-gnueabihf-gcc as the linker
  • Crates: protobuf 4.36.2-release and google-protobuf 0.36.2-release
Actual result

The rustc invocation compiling --crate-name google_protobuf --target armv7-unknown-linux-gnueabihf fails with:

error: :2:38: expected '%' or ""
.section linkme_EXTENSIONS,"awR",@progbits
^

error: could not compile google-protobuf (lib)

In rust/upb_kernel/extension.rs (https://github.com/protocolbuffers/protobuf/blob/v36.2/rust/upb_kernel/extension.rs#L32-L45), a global_asm! block enabled for Unix targets uses @progbits in two .section directives. That guard includes ARM Linux. The GNU assembler documentation (https://www.sourceware.org/binutils/docs/as/Section.html) notes that ARM treats @ as a comment marker and uses % for section types.

Minimal reproduction

With the armv7a-none-eabi Rust target installed, save this as repro.rs:

#![no_std]

core::arch::global_asm!(
r#"
.section linkme_EXTENSIONS,"awR",@progbits
.globl LINKME_SENTINEL_EXTENSIONS
LINKME_SENTINEL_EXTENSIONS:
.size LINKME_SENTINEL_EXTENSIONS, 0
"#
);

Then run:

rustc --crate-type lib --target armv7a-none-eabi --emit=obj repro.rs

I reproduced the same expected '%' or "" error directly with rustc 1.97.1, without protoc. Changing @progbits to %progbits makes this minimal example compile successfully.

Dominant language
C++
Stars
72.2k
Forks
16.4k
Avg merge
1d 8h
Merged PRs (30d)
342

Getting set up

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 protocolbuffers/protobuf

All issues in protocolbuffers/protobuf

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.