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.

Using LibC in x86 Assembly Programs

47 pointsby bearwithclawsabout 13 years ago

4 comments

georgecmuabout 13 years ago
<i>Using main and not _start is required by the gcc linker, any other symbol name will not work!.</i><p>Not really; while main is default, -e flag allows you to specify an arbitrary symbol as entry point.
评论 #3752974 未加载
评论 #3754604 未加载
ypcxabout 13 years ago
You can find more info on Linux (and System V) calling conventions, stack layout, etc. in this document: <a href="http://www.x86-64.org/documentation/abi.pdf" rel="nofollow">http://www.x86-64.org/documentation/abi.pdf</a>
评论 #3752969 未加载
drblastabout 13 years ago
Why would anyone do this? If you've accepted that you're going to pay the cost to link against libc, use C. If you need to do something that specifically requires assembly, write that function (and that function only) in assembly. GCC will handle all of this very cleanly for you. You don't have to write main() in assembly.
评论 #3753977 未加载
评论 #3756251 未加载
评论 #3754602 未加载
OwlHuntrabout 13 years ago
As well intentioned as I imagine the author to be, there's really nothing here that you couldn't learn from older documentation, as several commentors have pointed out. A more interesting example would have been to calculate running time of some function vs. it's recursive version. Essentially, something besides an extended 'hello world'.
评论 #3754613 未加载