Home > Net >  Why does -fPIC hinder inlining?
Why does -fPIC hinder inlining?

Time:09-30

I have this foo.cpp:

int add(int a, int b) {
    return a   b;
}

int add_wrapper(int a, int b) {
    return add(a,b);
}

Compiling like so

g   -c -S -fPIC -O4 -finline-functions  foo.cpp -o foo.s

Gives the (demangled) assembly:

    .globl  add(int, int)
    .type   add(int, int), @function
add(int, int):
.LFB0:
    .cfi_startproc
    endbr64
    leal    (%rdi,%rsi),            
  • Related