Package: dpkg
Version: 1.23.11
Severity: normal
Control: affects -1 src:marisa
Tags: ftbfs
X-Debbugs-CC: [email protected]

Hi,

Package marisa of version 0.3.1+git20250817-3 fails to build on x32.
Looking deeper, the problem lies in dpkg.

In package marisa for x32 architecture, the perl_makemaker helper passes
CFLAGS to the shared-extension link. pie-compile.specs injects -fPIE
during LTO even though the command contains -shared. The linker then
rejects an R_X86_64_PC32 relocation against the Perl symbol PL_thr_key.

https://buildd.debian.org/status/fetch.php?pkg=marisa&arch=x32&ver=0.3.1%2Bgit20250817-3&stamp=1790962362&raw=1

The PIE mask added for #1100187 in dpkg 1.23.3 still allows
hardening=+all to enable PIE on x32. The check compares "x32" with
$cpu, which is "amd64" on x32. The Debian architecture ($arch) and ABI
are both "x32".

On dpkg-dev and libdpkg-perl 1.23.12, the following is sufficient to
reproduce the flag selection from an amd64 host:

  export DEB_HOST_ARCH=x32
  export DEB_BUILD_MAINT_OPTIONS='hardening=+all optimize=+lto'
  dpkg-buildflags --query-features hardening | grep -A2 '^Feature: pie$'

  Feature: pie
  Enabled: yes
  Builtin: no

With these settings, dpkg-buildflags adds pie-compile.specs to CFLAGS
and CXXFLAGS and pie-link.specs to LDFLAGS. The x32 mask should leave
PIE disabled and omit both specs.

Thanks,
Boyuan Yang

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to