[From nobody Tue Apr 21 20:35:13 2026
Received: (at submit) by bugs.debian.org; 23 Dec 2025 20:55:24 +0000
X-Spam-Checker-Version: SpamAssassin 4.0.1-bugs.debian.org_2005_01_02
 (2024-03-25) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=4.0 tests=BAYES_00, DATE_IN_PAST_06_12, 
 DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FOURLA,
 SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no
 version=4.0.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 37; hammy, 150; neutral, 323; spammy,
 0. spammytokens: hammytokens:0.000-+--XDebbugsCc,
 0.000-+--X-Debbugs-Cc, 0.000-+--HTo:N*Debian, 0.000-+--Wdatetime,
 0.000-+--wdatetime
Return-path: &lt;helmut@subdivi.de&gt;
Received: from isilmar-4.linta.de ([136.243.71.142]:54854)
 by buxtehude.debian.org with esmtps
 (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
 (Exim 4.96) (envelope-from &lt;helmut@subdivi.de&gt;) id 1vY9Pg-004gUl-1U
 for submit@bugs.debian.org; Tue, 23 Dec 2025 20:55:24 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdivi.de;
 s=k23.isilmar-4; t=1766523322;
 bh=IoNqmz2pbop15/jIlP9jRJdTMGN2SNM3Afm49zq7WnY=;
 h=Date:From:To:Subject:From;
 b=HFl5t8nYL7Jl3Zro8eWn8HLAXQXUhXjvn6TU3G9zkYhg6/AWui8ir4kN/dDRMz70+
 CuhW/1YMFA4IWwC8nQzZki1cVfvcTyS0ceOHG2tHgd8ZkaMlQurmS8o5AEbt0XZ3HL
 gA2sDoRapscBoYIyZenkPvCwXkxT156zkkaIme1glj9y7H6L9SKRQk34zKXtlWzBkU
 ImT1oL1nJsK7Yy2J91Byuz6HWHN+xsadu4iza8TCIy5sE6uMyIAETSXANLlVDqreZo
 ldMb17OaRUqXnFf3qAaswXMy7xhF3AE6+ARZyXCZ6yu1fEx4mjxerRQCLIfE90PR6Q
 VPZOCDM9AP7EA==
Received: from isilmar-4.linta.de (isilmar.linta [10.0.0.1])
 by isilmar-4.linta.de (Postfix) with ESMTP id C41E1200715
 for &lt;submit@bugs.debian.org&gt;; Tue, 23 Dec 2025 20:55:22 +0000 (UTC)
Date: Tue, 23 Dec 2025 13:19:24 +0100
From: Helmut Grohne &lt;helmut@subdivi.de&gt;
To: Debian Bug Tracking System &lt;submit@bugs.debian.org&gt;
Subject: libselinux FTBFS on x32: links without -fPIC
Message-ID: &lt;20251223121924.GA3338599@subdivi.de&gt;
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=&quot;4pMcE0BxXXCswbdH&quot;
Content-Disposition: inline
X-Reportbug-Version: 13.2.0
Delivered-To: submit@bugs.debian.org


--4pMcE0BxXXCswbdH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Source: libselinux
Version: 3.9-4
Severity: important
Justification: build regression for essential package on non-release archit=
ecture
Tags: ftbfs upstream
X-Debbugs-Cc: debian-amd64@lists.debian.org
User: debian-x32@lists.debian.org
Usertags: x32
User: helmutg@debian.org
Usertags: rebootstrap

Since a while, libselinux fails linking on x32.

| x86_64-linux-gnux32-gcc -Wdate-time -D_FORTIFY_SOURCE=3D2 -D_LARGEFILE64_=
SOURCE -g -O2 -Werror=3Dimplicit-function-declaration -ffile-prefix-map=3D/=
build/reproducible-path/libselinux-3.9=3D. -flto=3Dauto -ffat-lto-objects -=
specs=3D/usr/share/dpkg/pie-compile.specs -fstack-protector-strong -Wformat=
 -Werror=3Dformat-security -fcf-protection -fno-semantic-interposition -Wal=
l -Wextra -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=3D64 -I../include -D_GNU_=
SOURCE -DNO_ANDROID_BACKEND -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=3D8 -DHAVE_=
STRLCPY -DHAVE_REALLOCARRAY -flto=3Dauto -ffat-lto-objects -specs=3D/usr/sh=
are/dpkg/pie-link.specs -Wl,-z,relro -Wl,-z,now -shared -o libselinux.so.1 =
avc.lo avc_internal.lo avc_sidtab.lo booleans.lo callbacks.lo canonicalize_=
context.lo checkAccess.lo check_context.lo checkreqprot.lo compute_av.lo co=
mpute_create.lo compute_member.lo compute_relabel.lo compute_user.lo contex=
t.lo deny_unknown.lo disable.lo enabled.lo fgetfilecon.lo freecon.lo freeco=
nary.lo fsetfilecon.lo get_context_list.lo get_default_type.lo get_initial_=
context.lo getenforce.lo getfilecon.lo getpeercon.lo init.lo is_customizabl=
e_type.lo label.lo label_db.lo label_file.lo label_media.lo label_support.l=
o label_x.lo lgetfilecon.lo load_policy.lo lsetfilecon.lo mapping.lo matchm=
ediacon.lo matchpathcon.lo policyvers.lo procattr.lo query_user_context.lo =
regex.lo reject_unknown.lo selinux_check_securetty_context.lo selinux_confi=
g.lo selinux_internal.lo selinux_restorecon.lo sestatus.lo setenforce.lo se=
texecfilecon.lo setfilecon.lo setrans_client.lo seusers.lo sha1.lo stringre=
p.lo validatetrans.lo -lpcre2-8   -ldl -Wl,-soname,libselinux.so.1,--versio=
n-script=3Dlibselinux.map,-z,defs,-z,relro
| /usr/bin/ld: /tmp/cclRaeek.ltrans0.ltrans.o: relocation R_X86_64_TPOFF32 =
against hidden symbol `prev_current.lto_priv.0' can not be used when making=
 a shared object
| /usr/bin/ld: failed to set dynamic section sizes: bad value
| collect2: error: ld returned 1 exit status
| make[3]: *** [Makefile:171: libselinux.so.1] Error 1
| make[3]: Leaving directory '/build/reproducible-path/libselinux-3.9/src'
| make[2]: *** [Makefile:54: all] Error 1
| make[2]: Leaving directory '/build/reproducible-path/libselinux-3.9'
| make[1]: *** [debian/rules:46: build-all] Error 2
| make[1]: Leaving directory '/build/reproducible-path/libselinux-3.9'
| make: *** [debian/rules:37: binary-arch] Error 2

Since LTO is being used, code can be generated at the linking stage.
Unless passing -fPIC, this code is not position-independent as is
required for shared libraries. This happens to work on most
architectures but x32 by chance. The -fPIC flag really needs to passed
to the linker as well. It might also fix sh4 and it seems likely to also
fix m68k.

Patch attached.

Helmut

--4pMcE0BxXXCswbdH
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename=&quot;x32.patch&quot;

--- libselinux-3.9.orig/src/Makefile
+++ libselinux-3.9/src/Makefile
@@ -161,14 +161,14 @@
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $&lt;
 
 $(SWIGRUBYSO): $(SWIGRUBYLOBJ)
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(RUBYLIBS)
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -L. -fPIC -shared -o $@ $^ -lselinux $(RUBYLIBS)
 
 $(LIBA): $(OBJS)
 	$(AR) rcs $@ $^
 	$(RANLIB) $@
 
 $(LIBSO): $(LOBJS)
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ $(PCRE_LDLIBS) $(FTS_LDLIBS) -ldl -Wl,$(LD_SONAME_FLAGS)
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -fPIC -shared -o $@ $^ $(PCRE_LDLIBS) $(FTS_LDLIBS) -ldl -Wl,$(LD_SONAME_FLAGS)
 	ln -sf $@ $(TARGET)
 
 $(LIBPC): $(LIBPC).in ../VERSION

--4pMcE0BxXXCswbdH--
]