Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22002

How do I force gcc to call a function directly in PIC code?

$
0
0

Consider the following function:

extern void test1(void);extern void test2(void) {    test1();}

This is the code gcc generates without -fpic on amd64 Linux:

test2:    jmp test1

When I compile with -fpic , gcc explicitly calls through the PLT to enable symbol interposition:

test2:    jmp test1@PLT

This however is not strictly needed for position independent code and could be left out if I don't want to support. If necessary, the linker rewrites the jump target to the PLT symbol anyway.

How can I, without changing the source code and without making the compiled code unsuitable for a shared library, make function calls go directly to their targets instead of going explicitly through the PLT?


Viewing all articles
Browse latest Browse all 22002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>