You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support configurable archive flags for output-format: lib #541
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
Create or open an ARM GCC project.
Set Linker -> Output Format to LIB.
Rebuild the project twice from unchanged source.
Compare the SHA-256 of the generated .a file.
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.
GNU ar (xPack GNU Arm Embedded GCC x86_64) 2.45.1.20251203
The deterministic archive flag D is only one concrete use case. Ideally this should not be limited to a dedicated deterministic-only checkbox. A more flexible solution would be to let projects configure the archive tool command/options more generally, for example:
expose generic AR Flags / Archive Flags for output-format: lib;
or allow overriding the linker-lib.$output template at project/toolchain level;
keep the current default -rcv ${out} ${in} for backward compatibility;
allow users to choose values such as -rcvD ${out} ${in}, -rcsD ${out} ${in}, --thin, --plugin, --target, --record-libdeps, etc. when their toolchain supports them.
That would solve reproducible archive builds without blocking other valid GNU ar options that may be needed later.
Activity
gaoguobin commentedon Jun 3, 2026
Additional local evidence and a broader configuration request:
I checked the generated
builder.paramsfrom a real ARM GCC library project. Sanitized paths below:{ "toolchain": "GCC", "toolchainLocation": "<user-home>/.eide/tools/xpack-arm-none-eabi-gcc-15.2.1-1.1", "toolchainCfgFile": "<user-home>/.vscode/extensions/cl.eide-3.27.0/res/data/models/arm.gcc.model.json", "options": { "global": { "toolPrefix": "arm-none-eabi-" }, "linker": { "output-format": "lib", "$use": "linker-lib" } } }The selected model then resolves
linker-libas:So for this project the actual archive tool is:
with:
The deterministic archive flag
Dis only one concrete use case. Ideally this should not be limited to a dedicated deterministic-only checkbox. A more flexible solution would be to let projects configure the archive tool command/options more generally, for example:AR Flags/Archive Flagsforoutput-format: lib;linker-lib.$outputtemplate at project/toolchain level;-rcv ${out} ${in}for backward compatibility;-rcvD ${out} ${in},-rcsD ${out} ${in},--thin,--plugin,--target,--record-libdeps, etc. when their toolchain supports them.That would solve reproducible archive builds without blocking other valid GNU
aroptions that may be needed later.github0null commentedon Jun 3, 2026
后面会进行改进的。
就目前而言,更好的替代方法是使用 lib 生成器,它作为 post-build 任务执行,因此可以在生成 elf 的同时也一并生成 lib, 可以一次生成多个 lib, 也支持 ar 参数的自定义 和 ar 路径自定义
gaoguobin commentedon Jun 8, 2026
感谢建议,我这边按照
lib 生成器的方式测试了一下。这个方案确实可以传自定义
ar参数,比如-rcvD,也能生成 deterministic archive。对需要在生成 ELF 后额外打包一个或多个 lib 的场景来说,这个功能很有用。不过在纯
output-format: lib工程里,用起来会有一点不太顺手。因为这类工程本身已经会在正常构建流程里生成主.a产物;启用lib 生成器后,post-build 又会在.lib/目录下再生成一个.a。这样最终会有两份库文件:output-format: lib生成的主.a;lib 生成器生成的.lib/*.a。我也简单对比了一下这两份
.a。解包后的.o成员内容是一致的,但 archive 文件本身不只是 timestamp 不同;成员顺序和 archive metadata 也可能不同。因此.lib/*.a不太适合作为主输出.a的 SHA 等价替代品。所以对纯 lib 工程来说,如果后续方便的话,还是希望能在正常
output-format: lib路径上支持可配置 archive flags。这样可以保持原来的输出路径、文件名和构建流程,只把linker-lib使用的ar参数从:配置为类似:
这样就不需要额外生成第二份
.a,也能保持现有 EIDE lib 输出流程不变。