Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22290

Function call in the assembly language before linking

$
0
0

I was going through the assembly code generated by the compiler. I am using the C programming language and GCC compiler.

I wrote a function in C which adds two numbers by calling another function and stores the result in the variable pointed to by the pointer passed as an argument to the function.

void add_two_num(int x, int y, int * dest){  int val;  val = dummy(x, y);  *dest = val;}

I compiled the source code to object code (linking not done) and then disassembled the code using objdump -d

What is the meaning of the number +0x9 in the line call d <add_two_num+0x9>?
Is that useful at the stage of linking when that line will be replaced by the actual function call?

file format elf64-x86-640000000000000004 <add_two_num>:   4:   53                      push   %rbx   5:   48 89 d3                mov    %rdx,%rbx   8:   e8 00 00 00 00          call   d <add_two_num+0x9>   d:   89 03                   mov    %eax,(%rbx)   f:   5b                      pop    %rbx  10:   c3                      ret  

Viewing all articles
Browse latest Browse all 22290

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>