I have an asm file (I use gas) and a c file. My asm file contains a function, something like this
.global myfunc
.type myfunc, @function
myfunc:
pusha
.
.
.
now I want to get the address of the myfunc label from my c file, so I wrote
extern uintptr_t _myfunc asm("myfunc");
my program links are no problem, but when I execute my program, the _myfunc variable does not contain the correct address.
Change 1
it may be useful to know that this piece of code is part of a simple program
Edit 2
using prototype function solved problem
void function() asm("myfunc");
uintptr_t _myfunc = (uintptr_t)&myfunc;
source
share