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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

151-byte static Linux binary in Rust

191 点作者 adito超过 10 年前

8 条评论

Alupis超过 10 年前
reminds me a bit of the &quot;Creating Really Teensy ELF Executables&quot; writeup[1], which got down to 45 bytes.<p>But honestly... does it really matter how small your executable is? I&#x27;d care a lot more about performance characteristics than binary size.<p>[1] <a href="http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html" rel="nofollow">http:&#x2F;&#x2F;www.muppetlabs.com&#x2F;~breadbox&#x2F;software&#x2F;tiny&#x2F;teensy.htm...</a>
评论 #8869335 未加载
评论 #8869398 未加载
评论 #8869310 未加载
评论 #8870001 未加载
评论 #8869771 未加载
评论 #8869343 未加载
swetland超过 10 年前
This is cute, but is there a way to actually create static binaries with the standard tooling and not jumping through hoops?<p>Hello World in Rust with tip of tree (as of yesterday) is a ~500K binary that depends on glibc and friends.<p>Switching from println!() to std::io...write_str() actually made it larger!
评论 #8870849 未加载
yazaddaruvala超过 10 年前
I&#x27;d actually love to ask Linus&#x27; on his opinion of the practical uses of Rust in the Linux kernel. Does he think it could have a place, if not, why? Can those issues be addressed, etc?<p>Even if that means him dismissing me&#x2F;my question entirely lol.
评论 #8870798 未加载
评论 #8869661 未加载
userbinator超过 10 年前
That main() can still be improved... try this:<p><pre><code> push 1 pop eax mov edi, eax mov esi, 400008h push 7 pop edx syscall push 3ch pop eax xor edi, edi syscall </code></pre> It should be 10 bytes shorter.
评论 #8869435 未加载
评论 #8872879 未加载
starmole超过 10 年前
Wow. This is seriously impressive. Rust looks like it actually might be capable as a systems programming tool to match C. I have to learn more about it now! :)
评论 #8869669 未加载
tdicola超过 10 年前
That is really impressive. Now for comedy, someone find the size of a similar program in Go.
评论 #8869327 未加载
评论 #8869388 未加载
CyberShadow超过 10 年前
I did something similar in D&#x2F;Win32:<p><a href="http://forum.dlang.org/post/qcbicxrtmjmwiljsyhdf@forum.dlang.org" rel="nofollow">http:&#x2F;&#x2F;forum.dlang.org&#x2F;post&#x2F;qcbicxrtmjmwiljsyhdf@forum.dlang...</a><p>The PE format is rather bulkier than ELF, though.
Keyframe超过 10 年前
I just had a look. Installed nightly Rust on OSX and ran through it a hello world program - 307K! HW in C with gcc 4.2.1 (LLVM) makes 8.7K.
评论 #8870299 未加载