What does callq 400b90 <signal@plt> do?
Call the signal function via the PLT (procedure linkage table). So more technical: It pushes the current instruction pointer onto the stack and jumps to signal@plt
.
How would it look line in C?
void* foo(void) {
return signal(2, (void *) 0x4012a0);
}
Let's look at your code line-by-line:
sub $0x8,%rsp
This reserves some stack space. You can ignore this (the stack space is unused).
mov $0x4012a0,%esi
mov $0x2,%edi
Put the value 0x4012a0
and 0x2
in the registers ESI and EDI. By the ABI, this is how arguments are passed to a function.
callq 400b90 <signal@plt>
Call the function signal
through the PLT. The PLT has something to do with the dynamic linker since we cannot be sure where the signal
function will end up in memory whenthis is built. Basically, this just finds the final memory location and calls signal
.
add $0x8,%rsp
retq
Undo the sub
from earlier and return to the caller.