Article View: linux.debian.bugs.dist
Article #315Bug#1150491: reglookup: shared library linked with -fPIE -pie breaks under LTO
From: Viktor Pashaiev
Date: Sat, 10 Oct 2026 07:50
Date: Sat, 10 Oct 2026 07:50
40 lines
3932 bytes
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
Technical Details
Message-ID:
<NMA09-4Esc-7@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Viktor Pashaiev <w.paszajew@gmail.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1150491: reglookup: shared library linked with -fPIE -pie breaks under LTO
Date: Sat, 10 Oct 2026 09:50:01 +0200
Message-ID: <NMA09-4Esc-7@gated-at.bofh.it>
X-Original-To: submit@bugs.debian.org
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Sat Oct 10 07:45:11 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -0.548
Reply-To: Viktor Pashaiev <w.paszajew@gmail.com>, 1150491@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: team+pkg-security@tracker.debian.org
X-Debian-Pr-Message: report 1150491
X-Debian-Pr-Package: src:reglookup
X-Debian-Pr-Keywords: patch
X-Debian-Pr-Source: reglookup
X-Gm-Message-State: AFq9FYLNXM60fPf4QWHcaJPxCTv5VvyixH62pX85lDuy223tGBcL9Upg
bs4mlzRp/VNST20nRZ6vZhFX0NyXikioSEuIoHK/z9KPx5UKQFf+rjrO7jeKFw==
X-Gm-Gg: AYBFou3ZQZJPsk9PWFAqZTyLFFKbb9TTijBwXU+Ldm8Cda9Jug5GLW+i2xifL+5dcSs
Z1kFEmKQFgaEzgeaArEylNrJxlgIAUo9EN2E2978RZl5uYBfHfneXlR6LhR3P0nfJ8JIxkXzRVT
XjvMz9arFdJOTE/T2JatYHUX1SyBfO7Z3Hsf82LmCIK/pPvXQ38hrL8PZMo4fwc6yvjLxKGchn6
SdSvfHqxhT96W/ySosmn184hjo3aH2CfDV4SUp1sLhfJ1uEAhRl+qK5DLTRjchr67g3uKWiYM4C
wv8XZWaanQUmyqfOBL4xX3dhPNxcze2LY5Ipk1RlPIk1mJoNw/f37qvP9pj+b7QQOUqt/273LGy
g2npBqx65tadUjrbE44EL4SpyT4nZyyC8M/a6szeAyq0KetkM2NzVafCpzleeilj1qVoTQVP1/E
1QloHi+b6nd7Vr376rUY5gGcV+lRbBoBufrJFDkt/JW4rQluTGzgtJTfSewxKXT/i0LMHVZ9rLR
ab9BE3WpcA4kTCJG2VZV6pGI0pvBlvJqg==
X-Received: by 2002:a05:600c:3d96:b0:4a1:76dd:8c57 with SMTP id 5b1f17b1804b1-4a18e4bed95mr76289975e9.24.1791618166596;
Sat, 10 Oct 2026 00:42:46 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1996006
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 40
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sat, 10 Oct 2026 00:42:46 -0700 (PDT)
X-Original-Message-ID: <6ac9ec76.b6e7be8d.8d9d.5f74@mx.google.com>