I'm calling an extern function that was developed in assembly using the follow snippet of code:
extern int myfunction();
Apart from the execution code, to declare a function in assembly, I'm using:
.section .text
.global myfunction
.type myfunction, @function
This should tell the compiler that assembly file contains a reference of the external function called myfunction
.
Then I compile the code, using the following commands:
gcc -m32 -o obj/main.o -c src/main.c
gcc -m32 -o obj/myfunction.o -c src/myfunction.s
gcc -o bin/myfunction obj/main.o obj/myfunction.o -m32
When I'm compiling using GCC 10, a warning is being shown:
/usr/bin/ld: warning: relocation in read-only section `.text'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
How can I suppress that warning?