

Using LibC in x86 Assembly Programs - bearwithclaws
http://jdefr.swippet.com/2012/03/22/using-libc-with-assembly

======
georgecmu
_Using main and not _start is required by the gcc linker, any other symbol
name will not work!._

Not really; while main is default, -e flag allows you to specify an arbitrary
symbol as entry point.

~~~
KonradKlause
AFAIK it's -e, not -E.

------
ypcx
You can find more info on Linux (and System V) calling conventions, stack
layout, etc. in this document: <http://www.x86-64.org/documentation/abi.pdf>

~~~
KonradKlause
This covers only x8_64

~~~
ypcx
True. This doc covers more targets:
<http://agner.org./optimize/calling_conventions.pdf>

However, if I'm going to do low-level server work, I will not be doing it for
32-bit anymore. (There goes the 32-bit EC2 "small" machine, but so be it.)

------
drblast
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.

~~~
msbarnett
> Why would anyone do this?

Learning exercise? Curiosity? Fun?

------
OwlHuntr
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'.

~~~
jdefr89
A lot of the stuff you read on here can be found in documentation.. Who the
hell wants to go back and read all that nonsense?

