Linux static linking is dead?

前端 未结 6 2013
野性不改
野性不改 2020-11-28 19:42

In fact, -static gcc flag on Linux doesn\'t work now. Let me cite from the GNU libc FAQ:

2.22. Even statically linked programs need s

6条回答
  •  执笔经年
    2020-11-28 20:14

    Static linking is back on the rise!

    • Many (most?) Go programming language executables are statically linked.
      • The increased portability and backward compatibility is one reason for them being popular.
    • Other programming languages have similar efforts to make static linking really easy, for example:
      • Haskell (I am working on this effort)
      • Zig (see here for details)
    • Configurable Linux distributions / package sets like NixOS / nixpkgs make it possible to link a large fraction of their packages statically (for example, its pkgsStatic package set can provide all kinds of statically linked executables).
    • Static linking can result in better unused-code elimination at link time, making executables smaller.
    • libcs like musl make static linking easy and correct.
    • Some big software industry leaders agree on this. For example Google is writing new libc targeted at static linking ("support static non-PIE and static-PIE linking", "we do not intend to invest in at this point [in] dynamic loading and linking support").

提交回复
热议问题