[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/23169] IFUNC pointer should be allowed in executable
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/23169] IFUNC pointer should be allowed in executable |
Date: |
Mon, 18 Jan 2021 22:26:38 +0000 |
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.
- [Bug ld/23169] IFUNC pointer should be allowed in executable, cvs-commit at gcc dot gnu.org, 2021/01/16
- [Bug ld/23169] IFUNC pointer should be allowed in executable, i at maskray dot me, 2021/01/16
- [Bug ld/23169] IFUNC pointer should be allowed in executable, hjl.tools at gmail dot com, 2021/01/17
- [Bug ld/23169] IFUNC pointer should be allowed in executable, cvs-commit at gcc dot gnu.org, 2021/01/18
- [Bug ld/23169] IFUNC pointer should be allowed in executable, i at maskray dot me, 2021/01/18
- [Bug ld/23169] IFUNC pointer should be allowed in executable,
hjl.tools at gmail dot com <=
- [Bug ld/23169] IFUNC pointer should be allowed in executable, hjl.tools at gmail dot com, 2021/01/18