frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Static Bundle Object: Modernizing Static Linking

https://medium.com/@eyal.itkin/static-bundle-object-modernizing-static-linking-f1be36175064
24•ingve•2d ago

Comments

stabbles•4h ago
I would be really happy if instead of a dumb tool like

    ar -r libexample.a f.o g.o
it was like creating shared libraries

    ld --static -o libexample.a f.o g.o -L /somewhere/lib -ldep1 -ldep2 -rpath /somewhere/lib
And that this would make the linker:

1. check whether all "undefined" symbols can be resolved in dependencies mentioned in `-l`, otherwise fail

2. store metadata of "used" libraries.

So, it would create an archive `libexample.a` containing:

    f.o
    g.o
    METADATA
where METADATA contains the search path `/somewhere/lib` and needed libraries `dep1` and `dep2`.

So that ultimately when you compile and link `gcc foo.c -lexample`, the linker resolves the dependencies just like in shared linking.

eyalitki•3h ago
OP here, it was also my opinion that the handling of static libraries should significantly be improved, and ld should have a "--static-lib" flag to properly handle it. Sadly, the ELF committee prefers a more subtle approach, hence even the proposed build of the static bundle object is done on top of the existing "ld -r", and the output is still wrapped inside a .a archive for compatibility.

I hope that once integrated to linkers the adoption of this new format will help convince that it deserves significantly better tooling.

lb90•3h ago
That would be awesome!
wyldfire•3h ago
How do .rlibs work? Do those resemble these .sbos? .rlibs look like archives IIRC but maybe they're able to resolve relocations internal to them?

EDIT: after some brief searching around, I believe .rlibs are little more than archives with rust-specific metadata and internal relocations are not resolved.

eyalitki•3h ago
There is nothing magical in resolving the local relocations. It is just that current static libraries (static archives of plain .o files) are produced directly using "ar" and don't even go through the linker... The changes to the linker so to apply the relocation finalization are less than 50 lines of code on top of the existing "ld -r" that creates a relocatable object (which despite its name, does not handle relocations).

The key point in the proposal for a static-bundle-object is to properly handle static libraries as linked objects, instead of as a bunch of plain .o files.

bonzini•2h ago
Regarding --whole-archive, is it correct that it would be the default and you could opt-out of it with the function-sections/gc-sections combination?

Are there cases in which function-sections doesn't work (GCs too much) but a hypothetical "file-sections" does? For example cases in which the code relies on side effects of global constructors, but those would be left out by function-sections?

eyalitki•2h ago
> Regarding --whole-archive, is it correct that it would be the default and you could opt-out of it with the function-sections/gc-sections combination?

This is the current intention, as implemented in the up-to-date draft: https://github.com/bminor/binutils-gdb/commit/99aef6ba8db670.... Please note however that one would no longer need to specify the "--whole-archive" flag, hence resolving issues with potential duplicate placement of the static library in the linker's CLI.

> Are there cases in which function-sections doesn't work (GCs too much) but a hypothetical "file-sections" does? For example cases in which the code relies on side effects of global constructors, but those would be left out by function-sections?

Good question. In the first article in this series I discussed issues with global constructors and was pretty much waved away, being told that code should not be written this way. One of the members of the ELF committee did suggest an alternative for handling it yet pretty much mentioned that there are still missing pieces that require handling for their proposal to work (https://groups.google.com/g/generic-abi/c/sT25-xfX9yc/m/NRo0...).

bonzini•38m ago
Would you consider adding something like "file-sections" support to -r, preserving file boundaries as separate subsections? I have no idea how hard it would be.
M3Henry•3h ago
This is great, static linking has always been my preferred way to build.
Panzerschrek•2h ago
Modernizing of static libraries doesn't solve their main problem. They still contain compiled binary code, which is used by linker mostly as is. It maybe was fine 40 years ago, but nowadays this limitation leads to result binaries with suboptimal performance. Something better should be used instead, like compiler-dependent libraries containing intermediate code, which may be further composed and optimized, like it happens with LTO for non-static-library code.
stabbles•2h ago
Hm, `-ffat-lto-objects` exists, and tools like `gcc-ar` and `llvm-ar`. Linker plugins can work with these objects.
zoobab•2h ago
"Glibc static compilation is broken for political purposes"

http://stalinux.wikidot.com/

tux3•1h ago
Very nice to see an update!

I have to admit the pushback on ET_STAT is not completely unexpected. I can see why the gABI thread would argue that it can be solved without a new e_type. It would be a major change that requires updating all toolchains, on the consumer and producer side. It would certainly take over a decade for the support to percolate everywhere, including some of the mobile and embedded toolchains where I've had these static linking & symbol visibility issues before.

The reason I still wouldn't mind ET_STAT is that I feel it does remove some complexity in the long run by not relying on things like ar archives, their hidden members with special meaning, and their different flavors. We will still be working with ELF many decades from now, so I still see some value in doing these slow migrations that simplify the final design. I would be happy if fifty or a hundred years from now ar archives becomes history, like ELF has done to the a.out format.

That aside, there are also some interesting alternative ideas in the gABI thread (STB_LIBLOCAL is intriguing), but it seems like the path forward is through the toolchain first.

I'd consider it a very nice result if third-party tools like armerge are deprecated by upstream support in the native toolchain (but I appreciate the mention in the article!)

And thank you for continuing to work on this, really appreciate the work you've been doing there.

eyalitki•1h ago
Thanks, appreciate your feedback. Crossing my fingers that my PR for GNU ld will go as planned.
noncoml•1h ago
Why was their build broken?

Igalia, Servo, and the Sovereign Tech Fund

https://www.igalia.com/2025/10/09/Igalia,-Servo,-and-the-Sovereign-Tech-Fund.html
230•robin_reala•4h ago•33 comments

Ryanair flight landed at Manchester airport with six minutes of fuel left

https://www.theguardian.com/business/2025/oct/10/ryanair-flight-landed-at-manchester-airport-with...
164•mazokum•1h ago•130 comments

Show HN: I invented a new generative model and got accepted to ICLR

https://discrete-distribution-networks.github.io/
326•diyer22•7h ago•35 comments

Notes on Switching to Helix from Vim

https://jvns.ca/blog/2025/10/10/notes-on-switching-to-helix-from-vim/
29•chmaynard•2h ago•7 comments

I'm in Vibe Code Hell

https://blog.boot.dev/education/vibe-code-hell/
88•wagslane•1h ago•31 comments

The Molecular Basis of Long Covid Brain Fog

https://www.yokohama-cu.ac.jp/english/news/20251001takahashi.html
47•onnnon•1h ago•16 comments

NanoMi: Open-source transmission electron microscope

https://sites.google.com/view/nanomi-org?usp=sharing
26•pillars•2d ago•1 comments

Ask HN: What's the best hackable smart TV?

37•xrd•4d ago•38 comments

All-Natural Geoengineering with Frank Herbert's Dune

https://www.governance.fyi/p/all-natural-geoengineering-with-frank
30•toomuchtodo•2h ago•6 comments

Boring Company cited for almost 800 environmental violations in Las Vegas

https://www.propublica.org/article/elon-musk-boring-company-violations-fines-vegas-loop
29•maxeda•37m ago•6 comments

A story about bypassing air Canada's in-flight network restrictions

https://ramsayleung.github.io/en/post/2025/a_story_about_bypassing_air_canadas_in-flight_network_...
116•samray•8h ago•89 comments

Ohno Type School

https://ohnotype.co/blog/ohno-type-school-a
127•tobr•4d ago•49 comments

My approach to building large technical projects (2023)

https://mitchellh.com/writing/building-large-technical-projects
252•mad2021•13h ago•35 comments

Nobel Peace Prize 2025: María Corina Machado

https://www.nobelprize.org/prizes/peace/2025/summary/
469•pykello•7h ago•473 comments

Weave (YC W25) is hiring a founding AI engineer

https://www.ycombinator.com/companies/weave-3/jobs/SqFnIFE-founding-ai-engineer
1•adchurch•4h ago

Origami Patterns Solve a Major Physics Riddle

https://www.quantamagazine.org/origami-patterns-solve-a-major-physics-riddle-20251006/
25•westurner•4d ago•1 comments

Show HN: Lights Out: my 2D Rubik's Cube-like Game

https://raymondtana.github.io/projects/pages/Lights_Out.html
12•raymondtana•12h ago•4 comments

Python 3.14 is here. How fast is it?

https://blog.miguelgrinberg.com/post/python-3-14-is-here-how-fast-is-it
656•pjmlp•1d ago•481 comments

Examples Are the Best Documentation

https://rakhim.exotext.com/examples-are-the-best-documentation
306•Bogdanp•21h ago•116 comments

Show HN: Gitcasso – Syntax Highlighting and Draft Recovery for GitHub Comments

https://github.com/diffplug/gitcasso
4•etwigg•1h ago•2 comments

PSA: Always use a separate domain for user content

https://www.statichost.eu/blog/google-safe-browsing/
116•ericselin•3h ago•104 comments

QA-use-MCP: MCP for E2E testing

https://www.npmjs.com/package/@desplega.ai/qa-use-mcp
4•tarasyarema•4d ago•1 comments

You can't build Nixpkgs if you are in the UK

https://github.com/NixOS/nixpkgs/issues/444342
5•RGBCube•1h ago•1 comments

I Switched from Htmx to Datastar

https://everydaysuperpowers.dev/articles/why-i-switched-from-htmx-to-datastar/
255•ksec•10h ago•183 comments

Parallelizing Cellular Automata with WebGPU Compute Shaders

https://vectrx.substack.com/p/webgpu-cellular-automata
44•ibobev•7h ago•5 comments

An MVCC-like columnar table on S3 with constant-time deletes

https://www.shayon.dev/post/2025/277/an-mvcc-like-columnar-table-on-s3-with-constant-time-deletes/
28•shayonj•4d ago•3 comments

Show HN: A collection of Claude Code plugin marketplaces

https://claudecodeplugin.org
3•pekingzcc•1h ago•0 comments

OpenGL is getting mesh shaders as well, via GL_EXT_mesh_shader

https://www.supergoodcode.com/mesh-shaders-in-the-current-year/
67•pjmlp•4h ago•62 comments

Fascism Can't Mean Both a Specific Ideology and a Legitimate Target

https://www.astralcodexten.com/p/fascism-cant-mean-both-a-specific
15•feross•34m ago•9 comments

A small number of samples can poison LLMs of any size

https://www.anthropic.com/research/small-samples-poison
1077•meetpateltech•1d ago•396 comments