i use the following command to see the symbol table of my binary:

readelf -s mybinary

you can see part of the output below: enter image description here

as you can see the value of all system calls such as printf and exit are 00000000. but i want to find the address of this system calls. what should i do? i search a lot but i don't find any thing.

1 Answer 1


The library containing the printf and exit functions is a shared library (*.so) that is dynamically loaded after the program is started. The addresses of these functions are not known until the dynamic linker has placed the library in the address space of the process. The addresses can change from one run of the program to another.

You can use the gdb debugger to find where the dynamic linker has placed a function by running the program until a breakpoint, and then type p printf at the debugger prompt.

To avoid dynamic linking, you can link the libraries to your program statically. If you do this, the addresses are known beforehand, and can be examined using readelf. To compile a program statically using gcc, add the -static option to the command line, e.g.:

gcc -static myprog.c -o myprog

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .