🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
1 messages
1 total messages Started by Viktor Pashaiev Sat, 10 Oct 2026 07:50
Bug#1150491: reglookup: shared library linked with -fPIE -pie breaks under LTO
#315
Author: Viktor Pashaiev
Date: Sat, 10 Oct 2026 07:50
40 lines
3932 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads