https://sourceware.org/bugzilla/show_bug.cgi?id=23169

--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Fangrui Song from comment #11)
> (In reply to H.J. Lu from comment #9)
> 
> cat > ./a.s <<eof
> resolver:
>   ret
> 
> .globl ifunc, _start
> .type ifunc, @gnu_indirect_function
> .set ifunc, resolver
> 
> _start:
>   movq ifunc@GOTPCREL(%rip), %rax
>   call ifunc
> eof
> echo 'call ifunc' > ./b.s
> gcc -shared -fpic b.s -o b.so
> 
> ~/Dev/binutils-gdb/Debug/ld/ld-new is a top-of-tree ld.
> 
> % ~/Dev/binutils-gdb/Debug/ld/ld-new --export-dynamic a.o -o a && readelf -W
> -s a | grep ifunc
>      7: 0000000000401008     0 IFUNC   GLOBAL DEFAULT    3 ifunc

Symbol type in .symtab isn't relevant to ld.so.

> % ~/Dev/binutils-gdb/Debug/ld/ld-new --export-dynamic a.o ./b.so -o a &&
> readelf -W -s a | grep ifunc
>      5: 0000000000401010     0 FUNC    GLOBAL DEFAULT    7 ifunc
>      8: 0000000000401010     0 FUNC    GLOBAL DEFAULT    7 ifunc
> 
> % ~/Dev/binutils-gdb/Debug/ld/ld-new --export-dynamic -pie a.o -o a &&
> readelf -W --dyn-syms a | grep ifunc
>      5: 0000000000001020     0 IFUNC   GLOBAL DEFAULT    8 ifunc
> % ~/Dev/binutils-gdb/Debug/ld/ld-new --export-dynamic -pie a.o ./b.so -o a
> && readelf -W --dyn-syms a | grep ifunc
>      5: 0000000000001020     0 IFUNC   GLOBAL DEFAULT    8 ifunc
> 
> 
> Is this a -no-pie only behavior?

Yes.  We can do that only because position-dependent executable doesn't
need to be relocated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to