Hi,

This patch detects PIE binaries with newer file (5.22), as
it no longer prints (uses shared libraries)

file 5.19

# file /usr/bin/su
/usr/bin/su: setuid ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 3.0.0, 
BuildID[sha1]=c22b7c2ca90323d07e30d742e97c08bb98313d8a, stripped

file 5.22
# file /usr/bin/su
/usr/bin/su: setuid ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), 
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 
3.0.0, BuildID[sha1]=030ed4b9e0129d19842cd0e3cbebbc614417d748, stripped

Ciao, Marcus
Index: cmake-3.2.0-rc1/Modules/GetPrerequisites.cmake
===================================================================
--- cmake-3.2.0-rc1.orig/Modules/GetPrerequisites.cmake
+++ cmake-3.2.0-rc1/Modules/GetPrerequisites.cmake
@@ -260,6 +260,13 @@ function(is_file_executable file result_
         return()
       endif()
 
+      # newer file version does not use (used shared libraries)
+      # but uses interpreter
+      if("${file_ov}" MATCHES "shared object.*interpreter")
+        set(${result_var} 1 PARENT_SCOPE)
+        return()
+      endif()
+
     else()
       message(STATUS "warning: No 'file' command, skipping execute_process...")
     endif()
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to