Skip to content

Support configurable archive flags for output-format: lib #541

@gaoguobin

Description

@gaoguobin

Summary

Please consider adding a way to configure archive (ar) flags for projects using output-format: lib.

At the moment, the ARM GCC model appears to route output-format: lib to the linker-lib tool, whose command template is fixed as:

"linker-lib": {
  "$path": "bin/${toolPrefix}ar",
  "$output": "-rcv ${out} ${in}",
  "$outputSuffix": ".a"
}

Because this command is model-defined, the existing Linker UI fields such as "Other Linker Options" / "Lib Flags" do not seem to provide a way to pass archive-specific flags such as GNU ar's D modifier.

Use case: reproducible library builds

For GNU ar, deterministic archives can be produced with D, for example:

arm-none-eabi-ar rcvD libfoo.a foo.o bar.o
# or rcsD if the symbol index should be created in the same step

Without D, repeated clean rebuilds of the same library project can produce .a files with different SHA-256 values, even when the object files themselves are unchanged. arm-none-eabi-ar tv shows archive member timestamps being set to the current build time.

This makes it difficult to use artifact SHA-256 values as provenance/reproducibility checks in CI.

Reproduction outline

  1. Create or open an ARM GCC project.
  2. Set Linker -> Output Format to LIB.
  3. Rebuild the project twice from unchanged source.
  4. Compare the SHA-256 of the generated .a file.
  5. Inspect the archive metadata:
arm-none-eabi-ar tv build/<target>/*.a

Observed behavior: archive member timestamps change between rebuilds, so the .a SHA changes. Individual .o files remain stable.

Suggested behavior

A project-level option for archive flags would make this configurable without changing behavior for existing users. For example:

  • Add an "Archive Flags" / "AR Flags" option for output-format: lib.
  • Keep the current default compatible with existing behavior, e.g. -rcv.
  • Allow users to set -rcvD or -rcsD for deterministic archives.

Another possible approach is to make the linker-lib.$output template overridable per project/toolchain configuration.

Environment where this was observed

  • EIDE: 3.27.0
  • Toolchain: xPack GNU Arm Embedded GCC 15.2.1
  • GNU ar / binutils: 2.45.1
  • Platform: Windows

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions