TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Sta.li: Static Linux

150 点作者 Xyzodiac超过 11 年前

22 条评论

ChuckMcM超过 11 年前
Ah kids, they crack me up!<p>Lot of fun reading that, I looked around briefly but couldn&#x27;t find my email archive from Sun, but I was in the kernel group when folks got the idea that &quot;Gee if you shared the text segment of libraries, that would give you more memory for your buffer cache or user pages!&quot; One of the guys in my group re-wrote the linker to scan through and realign text segments so that the maximum number of read-only pages (and thus shareable) could be allocated. And of course code that had static buffers and what not (go look at the 4.1BSD code, they were everywhere). It made my Sun 3&#x2F;75 which had, wait for it 32 Megabytes of RAM (yes, less than the L2 cache in some machines these days) run quite a bit faster. Took a long time to get right too.<p>Shared libraries gave you three distinct advantages, one you cut down on the working set size, two you cut down on file load time, and three it became possible to &quot;interpose&quot; on the library and run two versions of the library at the same time for backwards compatibility.<p>Building a static system might be fun but for a 64 bit system, building one where libraries were fixed in the address space in flash or something might actually be even better.
评论 #7262269 未加载
评论 #7262825 未加载
评论 #7262111 未加载
评论 #7270440 未加载
kev009超过 11 年前
In case it&#x27;s not obvious: if you static link to a library, say libpng, and a vuln hits, every binary that linked to libpng potentially needs to be rebuilt and distributed.<p>If the OS has rigid dependency tracking (maybe source distros like Gentoo, or a cryptographically tracked binary distribution like freebsd-update), maybe you can live with that.<p>So there&#x27;s some trade off of &quot;dll hell&quot; for binary hell, and perhaps some other security advantages to dynamic libs. IMHO shared libraries are pretty well understood now days and static linking should be avoided unless you have a very good reason.
评论 #7262876 未加载
评论 #7262881 未加载
评论 #7262550 未加载
khc超过 11 年前
From the FAQ:<p>&quot;Also a security issue with dynamically linked libraries are executables with the suid flag. A user can easily run dynamic library code using LD_PRELOAD in conjunction with some trivial program like ping. Using a static executable with the suid flag eliminates this problem completely.&quot;<p>Have the authors actually tried this? Using LD_PRELOAD with suid programs won&#x27;t work.
评论 #7265074 未加载
davidp超过 11 年前
I&#x27;m puzzled by the idea of a system being leaner&#x2F;faster with n copies of a library in physical RAM rather than 1 copy mapped via VMM into whatever process wants it. IIRC this was the main point of shared libraries, not pluggability or changing code during runtime. Am I missing something?
评论 #7261953 未加载
评论 #7262200 未加载
评论 #7262326 未加载
评论 #7261869 未加载
评论 #7262809 未加载
评论 #7262040 未加载
评论 #7262883 未加载
vinkelhake超过 11 年前
On binary sizes:<p>&gt; Linking a stripped hello world program with glibc results in 600kb. Linking it with uclibc in about 7kb.<p>That&#x27;s nice for uclibc, but we&#x27;re typically linking dynamically. The comparison should be between dynamically and statically linked binaries. A stripped and dynamically linked hello world results in a 6kb program on my machine (glibc).<p>There&#x27;s also a lot of handwaving on memory usage in the FAQ.
评论 #7262565 未加载
评论 #7261874 未加载
评论 #7261896 未加载
chj超过 11 年前
&quot;The reason why dynamic linking has been invented was not to decrease the general executable sizes or to save memory consumption, or to speed up the exec() -- but to allow changing code during runtime -- and that&#x27;s the real purpose of dynamic linking, we shouldn&#x27;t forget that.&quot;<p>Not sure about &quot;changing code during runtime&quot;, but one of the great benefits of dynamic-link libraries are for writing plugins. And I don&#x27;t think it would take much time for an app to look up its own plugin folder.
default_name超过 11 年前
It&#x27;s not meant to be just another Linux distribution. It will be whole new system with Linux kernel at the core. It will be more in line with BSDs. That&#x27;s why static linking will make sense. Your updates are just rsync away.<p>As I see it suckless.org community prefers &#x27;linking&#x27; in form of shell scripts or communication via pipes, ideally via system&#x27;s VFS.<p>You will get lean and minimalistic base system. If something will not share same ideals it will not be in the base system (like glib[c]?, bash, Firefox). It is possible that dynamic linking will be allowed in &#x2F;emul chroot as stated in &#x27;Filesystem&#x27; page.<p>I see sta.li as rock solid minimalistic base system, which you can use on it&#x27;s own (how I belive many suckless.org folks will use it) or as a base system, that you can build upon. Even more than that, you will be able to use sta.li components in generic distributions with ease, because of static linking.<p>Go-lang is in my opinion next step for Bell Labs folks in lean development for the masses. Don&#x27;t take this too literally ;) Plan 9 [1] was first step, but people did not want whole new system. Inferno [2] was next one, but VM system was too much also. Go allows to use some of Plan 9 features in edible form for the masses. Without requirement to install specific system or VM to run your programs. That to some extent is what makes sta.li&#x27;s ideals similar to go-lang&#x27;s.<p>Development of sta.li is at slow pace, but many experiments are under development [3]. Probably some of them will be included in sta.li. Most probably sta.li will include X11, but we are seeing some developments with Wayland [4].<p>[1] - <a href="http://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Plan_9_from_Bell_Labs</a> [2] - <a href="http://en.wikipedia.org/wiki/Inferno_%28operating_system%29" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Inferno_%28operating_system%29</a> [3] - <a href="https://github.com/henrysher/sinit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;henrysher&#x2F;sinit</a> - <a href="http://galos.no-ip.org/sdhcp" rel="nofollow">http:&#x2F;&#x2F;galos.no-ip.org&#x2F;sdhcp</a> - <a href="http://git.suckless.org/dmc/" rel="nofollow">http:&#x2F;&#x2F;git.suckless.org&#x2F;dmc&#x2F;</a> [4] - <a href="https://github.com/michaelforney/swc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;michaelforney&#x2F;swc</a>
prewett超过 11 年前
Building Gentoo with USE=static might be a good way to experiment without have to build an entire new distribution. Try one with the flag, one without, do the same operations in each and watch the memory usage and time to completion.
评论 #7262861 未加载
评论 #7262670 未加载
ch215超过 11 年前
The developer, Anselm Garbe, gave a talk about Stali (among other things) at last year&#x27;s Suckless conference...<p><a href="http://www.youtube.com/watch?v=Zu9Qm9bNMUU" rel="nofollow">http:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Zu9Qm9bNMUU</a><p>I&#x27;m not qualified to comment on Stali itself but, more generally, I can&#x27;t recommend Suckless software highly enough.<p>Since I switched to Linux a few years back I&#x27;ve found myself using more and more of their programs--DWM, Dmenu, ST, Tabbed, Slock and Surf.<p>Before, I&#x27;d hop from one window manager, terminal or browser to another but, for me, Suckless programs just tend to stick because of the minimal philosophy.
vezzy-fnord超过 11 年前
It&#x27;s an admirable initiative, but I&#x27;m pretty sure that at this point sta.li has been in the &quot;design phase&quot; for years. It&#x27;s vaporware. I&#x27;d love to be proven wrong, though.
评论 #7261685 未加载
评论 #7261681 未加载
评论 #7262923 未加载
nathell超过 11 年前
One useful set of gcc flags to consider when building a statically-linkable library&#x2F;executable and aiming to reduce executable size is -Os -ffunction-sections -fdata-sections -Wl,-gc-sections.<p>This causes gcc to put each function in a separate section in the resulting object file, and the -gc-sections option makes ld strip the sections that are not reachable by calls from main (basically a tree-shaker).
cgh超过 11 年前
I enjoyed this from their description of their dwm window manager, which took me back to the general state of Linux circa 1999:<p>&quot;Because dwm is customized through editing its source code, it’s pointless to make binary packages of it. This keeps its userbase small and elitist. No novices asking stupid questions. There are some distributions that provide binary packages though.&quot;
评论 #7262151 未加载
评论 #7262364 未加载
mrich超过 11 年前
They missed a chance to call a project &#x27;Stalin&#x27;.
评论 #7263217 未加载
评论 #7262573 未加载
Ziomislaw超过 11 年前
Stali currently does not exist, but there are others statically linked distros out there, ie. <a href="http://starchlinux.org/" rel="nofollow">http:&#x2F;&#x2F;starchlinux.org&#x2F;</a>
mrottenkolber超过 11 年前
I like what the guys are doing and would love to try it out, but frankly the page didn&#x27;t change much for the last two years and all the discussion of strategy isn&#x27;t worth much without a working distribution with which you can experiment.<p>Furthermore I suspect the scope of stali will be so narrow that I will never be able to run say a CL implementation on it. Pretty much the same as Plan9, I love the design but it&#x27;s practically useless for me. :(
ommunist超过 11 年前
For this kind of thing Stal.in is a better domain name.
oofabz超过 11 年前
The group behind Sta.li also makes a great terminal emulator. It is notable for supporting font antialiasing without depending on the large GTK or QT libraries - it uses Xft directly. And it is much smaller than even xterm or rxvt.<p><a href="http://st.suckless.org/" rel="nofollow">http:&#x2F;&#x2F;st.suckless.org&#x2F;</a>
julie1超过 11 年前
I was dreaming of it, and knew that no matter how much it was itching I could never scratch it. Thanks
matiasb超过 11 年前
Sounds good, what about Golang based tools? (considering the default static binary generation)
评论 #7262457 未加载
anon35超过 11 年前
Static linking also relative in a discussion about coupling and OS dependencies : <a href="http://unix.stackexchange.com/a/38914/17683" rel="nofollow">http:&#x2F;&#x2F;unix.stackexchange.com&#x2F;a&#x2F;38914&#x2F;17683</a>
jbb555超过 11 年前
With the use of link time code generation too, this could be better than expected perhaps?
paulannesley超过 11 年前
MONDAY, FEBRUARY 1, 2010 Stali: <a href="http://wayback.archive.org/web/20110727064007/http://elevenislouder.blogspot.com/2010/02/stali.html" rel="nofollow">http:&#x2F;&#x2F;wayback.archive.org&#x2F;web&#x2F;20110727064007&#x2F;http:&#x2F;&#x2F;eleveni...</a>