Bug#1121530: libreoffice: Please build with -fPIE on sparc64 to fix FTBFS

John Paul Adrian Glaubitz <[email protected]> Thu, 27 Nov 2025 22:13:24 +0100
Newsgroups gmane.linux.debian.ports.sparc
Message-ID <176427800474.2640251.5677411202118248.reportbug__35995.7662339852$1764278144$gmane$org@login1.physik.fu-berlin.de>
This is a multi-part MIME message sent by reportbug.


--===============3607789875858306002==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Source: libreoffice
Version: 4:25.8.3-1
Severity: normal
Tags: patch
User: [email protected]
Usertags: sparc64
X-Debbugs-Cc: [email protected]

Hi,

on sparc64, libreoffice fails to build from source due to some GOT offsets
being too large for the dynamic linker:

lp_MDO.o: in function `getMDO':
lp_MDO.c:(.text+0x6f4): relocation truncated to fit: R_SPARC_GOT13 against symbol `mdo_free' defined in .text section in lp_MDO.o
lp_MDO.c:(.text+0x6fc): relocation truncated to fit: R_SPARC_GOT13 against symbol `mdo_calloc' defined in .text section in lp_MDO.o
mmio.o: in function `mm_read_mtx_crd':
mmio.c:(.text+0x938): relocation truncated to fit: R_SPARC_GOT13 against symbol `stdin@@GLIBC_2.2' defined in .data section in /lib/sparc64-linux-gnu/libc.so.6
mmio.c:(.text+0x9f8): relocation truncated to fit: R_SPARC_GOT13 against symbol `stdin@@GLIBC_2.2' defined in .data section in /lib/sparc64-linux-gnu/libc.so.6
mmio.c:(.text+0xa7c): relocation truncated to fit: R_SPARC_GOT13 against symbol `stdin@@GLIBC_2.2' defined in .data section in /lib/sparc64-linux-gnu/libc.so.6
mmio.o: in function `mm_read_unsymmetric_sparse':
mmio.c:(.text+0xce8): relocation truncated to fit: R_SPARC_GOT13 against symbol `stderr@@GLIBC_2.2' defined in .data section in /lib/sparc64-linux-gnu/libc.so.6
mmio.c:(.text+0xd24): relocation truncated to fit: R_SPARC_GOT13 against symbol `stderr@@GLIBC_2.2' defined in .data section in /lib/sparc64-linux-gnu/libc.so.6
mmio.o: in function `mm_write_mtx_crd':
mmio.c:(.text+0xdd0): relocation truncated to fit: R_SPARC_GOT13 against symbol `stdout@@GLIBC_2.2' defined in .data section in /lib/sparc64-linux-gnu/libc.so.6
mmio.c:(.text+0xf44): relocation truncated to fit: R_SPARC_GOT13 against symbol `stdout@@GLIBC_2.2' defined in .data section in /lib/sparc64-linux-gnu/libc.so.6
myblas.o: in function `is_nativeBLAS':
myblas.c:(.text+0x7a0): relocation truncated to fit: R_SPARC_GOT13 against symbol `hBLAS' defined in .bss section in myblas.o
myblas.o: in function `load_BLAS':
myblas.c:(.text+0x7c0): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status

This can be fixed by passing "-fPIE" which makes sure the compiler makes sure
that the GOT entries are capable of handling large offsets.

I propose the following patch:

--- debian/rules.orig   2025-11-08 21:28:26.000000000 +0100
+++ debian/rules        2025-11-27 22:11:18.063514133 +0100
@@ -1146,6 +1146,11 @@
        DEB_CXXFLAGS_MAINT_APPEND = -ffp-contract=off
 endif
 
+ifneq (,$(filter sparc64,$(DEB_HOST_ARCH)))
+       DEB_CFLAGS_MAINT_APPEND = -fPIE
+       DEB_CXXFLAGS_MAINT_APPEND = -fPIE
+endif
+
 ifneq (,$(filter s390x,$(DEB_HOST_ARCH)))
   ifeq (,$(shell gcc -v 2>&1 | grep disable-s390-excess-float-precision))
        DEB_CFLAGS_MAINT_APPEND = -fexcess-precision=fast

I'm attaching the patch to this bug report as well.

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

--===============3607789875858306002==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="loffice-sparc64-fPIE.diff"

--- debian/rules.orig	2025-11-08 21:28:26.000000000 +0100
+++ debian/rules	2025-11-27 22:11:18.063514133 +0100
@@ -1146,6 +1146,11 @@
 	DEB_CXXFLAGS_MAINT_APPEND = -ffp-contract=off
 endif
 
+ifneq (,$(filter sparc64,$(DEB_HOST_ARCH)))
+	DEB_CFLAGS_MAINT_APPEND = -fPIE
+	DEB_CXXFLAGS_MAINT_APPEND = -fPIE
+endif
+
 ifneq (,$(filter s390x,$(DEB_HOST_ARCH)))
   ifeq (,$(shell gcc -v 2>&1 | grep disable-s390-excess-float-precision))
 	DEB_CFLAGS_MAINT_APPEND = -fexcess-precision=fast

--===============3607789875858306002==--