tools/ci: Add the FDPIC binutils to the Linux CI image. - #19992
Merged
Conversation
An FDPIC module is compiled by the stock arm-none-eabi GCC, which emits correct FDPIC objects for both C and C++, but it cannot be assembled or linked by that toolchain: its as rejects the FDPIC relocations, and its ld carries the armelf emulation alone. Linking FDPIC objects with the stock ld does not fail, which is the awkward part. It produces an object marked "UNIX - System V" instead of "ARM FDPIC" and turns every import into an R_ARM_JUMP_SLOT where the ABI wants an R_ARM_FUNCDESC_VALUE. A jump slot is one word and a descriptor is two, a code address and the GOT that goes with it, so the module links cleanly and then calls out of itself with the caller's data base still in the PIC register. No distribution packages the arm-uclinuxfdpiceabi target, so the image builds it, the way the Renesas stage already builds its own binutils. Only binutils is needed, no GCC and no C library, so the stage takes about a minute and the install is 20 MB stripped. The tarball comes from sourceware.org, the binutils project's own host, because ftp.gnu.org is not reliably reachable from every builder. curl runs with --fail so that a bad fetch says so, rather than piping an error page into tar and failing as "File format not recognized". Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
xiaoxiang781216
approved these changes
Aug 28, 2026
acassis
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FDPIC modules cannot be built anywhere CI can reach, because the linker they need is not packaged by any distribution. This adds it to the Linux CI image so that the FDPIC module build can be integrated into the normal in-tree ELF build rather than living in a separate out-of-tree toolchain, which is what was asked for in the review of #19940.
An FDPIC module is compiled by the stock
arm-none-eabiGCC, which emits correct FDPIC objects for both C and C++. What that toolchain cannot do is assemble or link them: itsasrejects the FDPIC relocations, and itsldis configured with thearmelfemulation alone.Linking FDPIC objects with the stock
ldanyway does not fail, which is the awkward part. It produces an object markedUNIX - System Vinstead ofARM FDPIC, and turns every import into anR_ARM_JUMP_SLOTwhere the ABI wants anR_ARM_FUNCDESC_VALUE. A jump slot is one word and a descriptor is two, a code address and the GOT that goes with it, so such a module links cleanly and then calls out of itself with the caller's data base still in the PIC register.So the image builds
arm-uclinuxfdpiceabibinutils in its own stage, the way the Renesas stage already builds its own binutils. Only binutils is needed, no GCC and no C library.The tarball comes from
sourceware.org, the binutils project's own host, becauseftp.gnu.orgis not reliably reachable from every builder.curlruns with--failso a bad fetch says so, rather than piping an error page intotarand failing asFile format not recognized, which is what happened while writing this.Impact
Build infrastructure only. No target code, no configuration, no documentation.
The image grows by 20 MB, stripped, and the stage takes about 35 seconds. For scale,
gcc-arm-none-eabiin the same image is several hundred megabytes.Nothing in the tree uses the new toolchain yet. It is a prerequisite for the FDPIC module build, which follows.
Testing
Host: macOS 15 on Apple Silicon, Docker 29.4.0.
The stage was built on its own and the result exercised in a container.
The linker carries the emulation that the stock one does not:
against the stock toolchain, which is the failure this exists to prevent:
Linking a C++ module inside the container, one with a static global object, gives a correct FDPIC shared object:
The same objects linked with the stock
arm-none-eabi-ldlink without error and produceOS/ABI: UNIX - System Vwith threeR_ARM_JUMP_SLOTentries instead, which is the silent breakage described above.Installed size in the image:
tools/checkpatch.sh -c -u -m -gpasses.