TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

ELF101 a Linux executable walkthrough

102 pointsby ange4771_over 11 years ago

6 comments

United857over 11 years ago
A good intro but doesn&#x27;t go in depth enough, and it glosses over the interface between user and kernel mode.<p>Particularly, in modern Linux binaries, syscalls are not hardcoded as int instructions, but are dynamically mapped via a &quot;virtual DSO&quot; mechanism to the best instruction for the current architecture (int 80, or syscall&#x2F;sysenter).<p>Also, in practice, the ELF would be dynamically linking to libc, and libc would be making the calls.
评论 #6767744 未加载
评论 #6767818 未加载
评论 #6767812 未加载
thebossover 11 years ago
United857 is right. This totally gives a false impression that regular C code I write will use syscall instead of functions that exist in libc that are dynamically mapped in using the plt. My C code will never say int 0x80<p>Otherwise this I&#x27;d quite good. Helps people make the connection between Hello World in rodata and how it gets used
评论 #6769031 未加载
1_playerover 11 years ago
Very nice, too bad there are a few typos. For example, the &quot;write&quot; function arguments are not ordered correctly and it&#x27;s using the wrong line terminator. It should be:<p><pre><code> write(STDOUT, &quot;Hello World!\n&quot;, len(&quot;Hello World!\n&quot;));</code></pre>
评论 #6767483 未加载
评论 #6767408 未加载
ange4771_over 11 years ago
FYI it&#x27;s now available in professional-looking version <a href="http://i.imgur.com/m6kL4Lv.png" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;m6kL4Lv.png</a> and booklet <a href="https://speakerdeck.com/ange/elf101-a-linux-executable-walkthrough" rel="nofollow">https:&#x2F;&#x2F;speakerdeck.com&#x2F;ange&#x2F;elf101-a-linux-executable-walkt...</a> .
opkover 11 years ago
What does the number 101 refer to? It doesn&#x27;t seem to be a version number. The diagram nicely expands ELF to Executable and Linkable Format but no explanation of the number.
评论 #6768379 未加载
hornetblackover 11 years ago
That mouse-over trick is really annoying.
评论 #6767730 未加载
评论 #6767411 未加载