Package: src:reglookup
Version: 1.0.1+svn296-2
Severity: minor
Tags: patch

Hi,

In debian/patches/fix-install.patch, -fPIE -pie was prepended to the global 
LINKFLAGS in SConstruct:
  linkflags = '-fPIE -pie ' + os.environ.get('LDFLAGS','-z relro -z now')

Because LINKFLAGS is inherited by env.SharedLibrary(), libregfi.so is linked 
with -pie.
When building with link-time optimization (-flto=auto, as in Ubuntu), the code 
generation happens at link time, producing non-PIC code for the shared library 
and causing a fatal link error:
  relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used 
when making a shared object; recompile with -fPIC

Dropping hardcoded '-fPIE -pie' from linkflags in fix-install.patch allows the 
shared library to link cleanly. Executables remain PIE because GCC defaults to 
PIE.

Patch below:

--- a/debian/patches/fix-install.patch
+++ b/debian/patches/fix-install.patch
@@ -15,7 +15,7 @@
 +cflags += '-fPIE ' + os.environ.get('CFLAGS','-fstack-protector-strong 
-D_FORTIFY_SOURCE=2 -O2')
  
 -linkflags = "-fPIC " + os.environ.get('LDFLAGS',"-Wl,-z,relro,-z,now")
-+linkflags = '-fPIE -pie ' + os.environ.get('LDFLAGS','-z relro -z now')
++linkflags = os.environ.get('LDFLAGS','-z relro -z now')
  
  lib_src = ['lib/regfi.c',
             'lib/winsec.c',

-- 
Viktor Pashaiev

Reply via email to