[File] Detecting PIE binaries

Christos Zoulas christos at zoulas.com
Thu Jun 4 20:46:20 UTC 2020


Yes, and binutils/ld does it... The code in file handles it here: https://github.com/file/file/blob/master/src/readelf.c#L1113 <https://github.com/file/file/blob/master/src/readelf.c#L1113>
so it looks like it should work. I will wait until I can install a new version of current that has it, but perhaps you can also check
if the head of file on GitHub fixes the issue?

christos

> On Jun 4, 2020, at 10:19 AM, Ed Maste <emaste at freebsd.org> wrote:
> 
> 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/file/attachments/20200604/c0598836/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20200604/c0598836/attachment.asc>


More information about the File mailing list