Hi all,
I have a question in SO regarding parameter passing in ELF binaries:

https://stackoverflow.com/questions/70150497/go-binaries-parameter-passing

One of the comments referenced me to this mailing list, so I'm re-posting 
here:

I’m trying to understand parameter passing in go ELF binaries

mov    %rdi,0x8(%rsp)   <----- first parameter (?)
mov    %r8,0x10(%rsp)   <----- second
mov    %r9,0x18(%rsp)   <----- third
mov    %r10,0x20(%rsp)  <----- fourth
mov    %rcx,0x28(%rsp)  <----- fifth
sub    %edx,%ebx
movslq %ebx,%rcx
mov    %rcx,0x30(%rsp)  <----- sixth
callq  5aaba0 <math/big.nat.shl> <----- call to native golang func

It seems that parameters are passed on stack, but when I look at the 
function here (line 681) <https://go.dev/src/math/big/nat.go>:

// z = x << s
func (z nat) shl(x nat, s uint) nat { ... }

The number of parameter is just *2*, and in the ELF it looks like *6* (?) 
​

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b6dadce8-e6b2-4694-8a06-11becf08a436n%40googlegroups.com.

Reply via email to