0

I am trying to add security flags to an executable but it seem that when compiling with -pie (as linker flags), the file tool sees it as a shared library, although I can run it without problems. Is this normal? Can this be fixed?

I am using add_link_options(-pie) (so all CMake executables can benefit)

untitled3: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=f33e240db8bf52c2566b2cad14b4be67fdb6b35a, with debug_info, not stripped

LE: it seems it was a bug in file tool, fixed here:

Taw
  • 479
  • 3
  • 15
  • This is normal. Old versions of `file` can't tell the difference between a position-independent executable and a shared library. To fix this upgrade to `file` version `5.36` or above. – S.S. Anne Jan 10 '20 at 01:01
  • Yep, thanks, I updated `file` and it seems ok. – Taw Jan 10 '20 at 07:04

1 Answers1

2

Executables compiled with -pie are shared objects. file now has special support to deal with these. The answers to this question go into this in more detail.

S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
saagarjha
  • 2,221
  • 1
  • 20
  • 37