[File] Detecting PIE binaries

Ed Maste emaste at freebsd.org
Thu Jun 4 14:19:39 UTC 2020


On Wed, 3 Jun 2020 at 17:42, Christos Zoulas <christos at zoulas.com> wrote:
>
> I don't see it in mine!
>
> christos
>
> vmb1:~/src/file [5:39pm] 22#cc -pie -fPIE hello.c -o hello
> vmb1:~/src/file [5:40pm] 23#readelf -d hello
>
...
> vmb1:~/src/file [5:41pm] 24#uname -a
> FreeBSD vmb1.astron.com 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r361567: Thu May 28 04:59:08 UTC 2020     root at releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

Oh, I should have included a note that support is very new in FreeBSD:

r361740 lld: Set DF_1_PIE for -pie
https://reviews.freebsd.org/rS361740

But as I understand it GNU ld has been setting the flag since sometime
in 2015, although perhaps only for certain OS targets.


More information about the File mailing list