Re: "call Puts / int80"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Erich_B@xxxxxx wrote:

> I´m trying a little bit around with assembler and linux, and I have some questions...
> 
> To use some "Linux-API" for example to print a message on the terminal its possible to call int 80 to do this in assembler.
> 
> If i write a little "Hello World" Programm in C and have a look on it with an hex-editor/disassembler i can see, that gcc don`t use int80...
> and if i had a look on the temporary assembler code which gcc gives me I see that gcc use some C-Function Puts (in assembler ... "call Puts" ...)
> 
> So there must be another way to use "Linux-API".
> 
> My question is, does anyone know the assembler code that gcc use to print a message on the terminal ?

gcc doesn't know anything about int 80.  It just emits a library call to
the puts() function.  The C library (libc), which in the case of Linux
is glibc, is responsible for implementing puts() as the appropriate
syscall.  It would be insane for the compiler to try to implement an
entire C library inline because many functions do not translate into
simple syscalls, they involve significant processing.  Look at the size
of libc and you'll see that is is huge library, meaning that there is a
great deal of code necessary to implement the functionality between the
C API level and the syscall kernel level.  In short, this is the entire
reason why the C library exists -- layering and abstraction.

Brian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux