Android - calling C function without redistributing text in x86 assembler

The definition of the function in the gas is added at the end of the text section. For example, this defines a function foo:

.text
.globl foo
foo:
   <foo body>

Everything is fine before you want to call the C function inside the body of the asm function. Adding a command call(using x86 assembler) results warning: shared library text segment is not shareablein compiling the Android NDK due to redistribution of text (you can compile the library with them, but for the API less than 23)

I am not very good at assembler, so my question is: can I somehow call the C function from the asm function without redistributing the text? Maybe I can move the function definition to another section (if possible) or replace it call?

I am using assembler syntax and x86 syntax

+4
1

@fuz ( call foo@PLT) , . PLT ( ) , ( GOT).

- __attribute__((visibility("hidden"))). call foo .

0

Source: https://habr.com/ru/post/1693081/


All Articles