google-protobuf 0.36.2-release fails to compile for ARMv7: @progbits rejected in global_asm!
Maintainers usually reply within 1 day
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
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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from protocolbuffers/protobuf
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
protocolbuffers/protobuf#31768 ·
Maintainers usually reply within 1 day
-
feature request packaging & distribution python
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
protocolbuffers/protobuf#31654 ·
Maintainers usually reply within 1 day
-
Null pointer passed to memcpy in lupb_decode() when the second argument is nilPossibly taken A pull request linked to this issue is open or already merged. Openbug help wanted lua
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
protocolbuffers/protobuf#31392 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
protocolbuffers/protobuf#31032 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
protocolbuffers/protobuf#31031 ·
Maintainers usually reply within 1 day
All issues in protocolbuffers/protobuf
Similar issues
-
Needs: Triage :mag: Platform: Android
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
react/react-native#60167 ·
Maintainers usually reply within 2 days
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
tests: ofx_render_test doesn't compile against FFmpeg 4.x (const AVCodec* to av_find_best_stream)Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NatronGitHub/openfx-io#221 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
subsurface/subsurface#5145 ·
Maintainers usually reply within 2 days