This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 34f25ed2286 tools/ci: Add the FDPIC binutils to the Linux CI image.
34f25ed2286 is described below

commit 34f25ed22862daed4b2933ba4821e926fb306f54
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Aug 28 12:32:50 2026 +0200

    tools/ci: Add the FDPIC binutils to the Linux CI image.
    
    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 <[email protected]>
---
 tools/ci/docker/linux/Dockerfile | 41 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/tools/ci/docker/linux/Dockerfile b/tools/ci/docker/linux/Dockerfile
index 831ba92e5db..7fd4c2df56d 100644
--- a/tools/ci/docker/linux/Dockerfile
+++ b/tools/ci/docker/linux/Dockerfile
@@ -156,6 +156,43 @@ RUN mkdir -p gcc-arm-none-eabi && \
   curl -s -L  
"https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi.tar.xz";
 \
   | tar -C gcc-arm-none-eabi --strip-components 1 -xJ
 
+###############################################################################
+# Build image for tool required by FDPIC module builds
+###############################################################################
+FROM nuttx-toolchain-base AS nuttx-toolchain-fdpic
+# Build the arm-uclinuxfdpiceabi binutils.  The stock arm-none-eabi compiler
+# emits correct FDPIC objects, but its assembler and linker cannot handle
+# them: ld is configured with the armelf emulation alone and links an FDPIC
+# object into an ordinary shared object, turning every import into an
+# R_ARM_JUMP_SLOT where the ABI wants an R_ARM_FUNCDESC_VALUE.  No
+# distribution packages this target, so it is built here.
+RUN apt-get update -qq && DEBIAN_FRONTEND="noninteractive" apt-get install -y 
-qq \
+  bison \
+  flex \
+  g++ \
+  gcc \
+  make \
+  texinfo \
+  zlib1g-dev
+
+RUN mkdir -p /tools/fdpic-tools/source && \
+  curl -s -L --fail 
"https://sourceware.org/pub/binutils/releases/binutils-2.43.tar.xz"; \
+  | tar -C /tools/fdpic-tools/source --strip-components=1 -xJ
+
+# MAKEINFO=true because the info pages are of no use here and building them
+# is the slowest part of a binutils build.
+
+RUN mkdir -p /tools/fdpic-tools/build && cd /tools/fdpic-tools/build && \
+  /tools/fdpic-tools/source/configure \
+  --target=arm-uclinuxfdpiceabi \
+  --prefix=/tools/binutils-arm-uclinuxfdpiceabi \
+  --disable-nls \
+  --disable-werror \
+  --with-system-zlib && \
+  make -j$(nproc) MAKEINFO=true && make install-strip MAKEINFO=true && \
+  rm -rf /tools/binutils-arm-uclinuxfdpiceabi/share && \
+  cd /tools && rm -rf fdpic-tools
+
 ###############################################################################
 # Build image for tool required by ARM64 builds
 ###############################################################################
@@ -470,6 +507,10 @@ ENV PATH="/tools/gcc-arm-none-eabi/bin:$PATH"
 COPY --from=nuttx-toolchain-arm64 /tools/gcc-aarch64-none-elf/ 
gcc-aarch64-none-elf/
 ENV PATH="/tools/gcc-aarch64-none-elf/bin:$PATH"
 
+# FDPIC module toolchain
+COPY --from=nuttx-toolchain-fdpic /tools/binutils-arm-uclinuxfdpiceabi/ 
binutils-arm-uclinuxfdpiceabi/
+ENV PATH="/tools/binutils-arm-uclinuxfdpiceabi/bin:$PATH"
+
 # AVR32 toolchain
 COPY --from=nuttx-toolchain-avr32 /tools/gcc-avr32-gnu/ gcc-avr32-gnu/
 ENV PATH="/tools/gcc-avr32-gnu/bin:$PATH"

Reply via email to