#1015387 dmalloc: ftbfs with LTO (link time optimization) enabled

#1015387#5
Date:
2022-07-19 16:51:31 UTC
From:
To:
This package currently fails to build (at least on the amd64
architecture) with link time optimizations enabled.  For a background
for LTO please see

https://wiki.debian.org/ToolChain/LTO

The goal is to enable this optimization by default in an upcoming
Debian release in dpkg-buildflags for 64bit architectures.  The goal
is to get this package to build with link time optimizations, or to
explicitly disable link time optimizations for this package build.

To reproduce the build failure, enable the lto optimization in
testing/unstable by adding "optimize=+lto" to DEB_BUILD_MAINT_OPTIONS
in the debian/rules file, or if this macro is unset, just set it:

export DEB_BUILD_MAINT_OPTIONS = optimize=+lto

Please try to fix the build with lto enabled, fixing the packaging or
forwarding the issue upstream. If the issue cannot be fixed,
explicitly disallow building the package with lto by adding to your
rules file:

export DEB_BUILD_MAINT_OPTIONS = optimize=-lto

or adding that string to your existing setting of DEB_BUILD_MAINT_OPTIONS.

The full build log can be found at:
http://qa-logs.debian.net/2022/06/09/dpkglto/dmalloc_5.5.2-14_unstable_dpkglto.log
The last lines of the build log are at the end of this report.

[...]
rm -f arg_check_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c arg_check.c -o ./arg_check_sl.o
rm -f compat_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c compat.c -o ./compat_sl.o
rm -f dmalloc_tab_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c dmalloc_tab.c -o ./dmalloc_tab_sl.o
rm -f env_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c env.c -o ./env_sl.o
rm -f heap_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c heap.c -o ./heap_sl.o
rm -f chunk_th_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c chunk.c -o ./chunk_th_sl.o
rm -f error_th_sl.o
rm -f malloc_th_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c error.c -o ./error_th_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c malloc.c -o ./malloc_th_sl.o
rm -f dmallocc.o
g++ -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c ./dmallocc.cc \
	-o ./dmallocc.o
rm -f dmallocc_sl.o
g++ -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c dmallocc.cc -o ./dmallocc_sl.o
rm -f chunk_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c chunk.c -o ./chunk_sl.o
rm -f error_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c error.c -o ./error_sl.o
rm -f malloc_sl.o
gcc -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -fPIE -D__NO_STRING_INLINES -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_STDARG_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_W32API_WINBASE_H=0 -DHAVE_W32API_WINDEF_H=0 -DHAVE_SYS_CYGWIN_H=0 -DHAVE_SIGNAL_H=1  -I. -I.  -c malloc.c -o ./malloc_sl.o
ar cr libdmalloc.a arg_check.o compat.o dmalloc_rand.o dmalloc_tab.o env.o heap.o chunk.o error.o malloc.o
ranlib libdmalloc.a
ar cr libdmalloccxx.a arg_check.o compat.o dmalloc_rand.o dmalloc_tab.o env.o heap.o chunk.o error.o malloc.o dmallocc.o
ranlib libdmalloccxx.a
rm -f dmalloc
gcc -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -fPIE -pie -o aout dmalloc.o dmalloc_argv.o compat.o env.o \
	-L.
ar cr libdmallocth.a arg_check.o compat.o dmalloc_rand.o dmalloc_tab.o env.o heap.o chunk_th.o error_th.o malloc_th.o
ar cr libdmallocthcxx.a arg_check.o compat.o dmalloc_rand.o dmalloc_tab.o env.o heap.o chunk_th.o error_th.o malloc_th.o dmallocc.o
ranlib libdmallocthcxx.a
ranlib libdmallocth.a
gcc -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -fPIE -pie -shared -Wl,-soname,libdmallocth.so.5 -o libdmallocth.so.5.5.2 arg_check_sl.o compat_sl.o dmalloc_rand_sl.o dmalloc_tab_sl.o env_sl.o heap_sl.o chunk_th_sl.o error_th_sl.o malloc_th_sl.o
gcc -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -fPIE -pie -shared -Wl,-soname,libdmallocthcxx.so.5 -o libdmallocthcxx.so.5.5.2 arg_check_sl.o compat_sl.o dmalloc_rand_sl.o dmalloc_tab_sl.o env_sl.o heap_sl.o chunk_th_sl.o error_th_sl.o malloc_th_sl.o dmallocc_sl.o
gcc -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -fPIE -pie -shared -Wl,-soname,libdmalloccxx.so.5 -o libdmalloccxx.so.5.5.2 arg_check_sl.o compat_sl.o dmalloc_rand_sl.o dmalloc_tab_sl.o env_sl.o heap_sl.o chunk_sl.o error_sl.o malloc_sl.o dmallocc_sl.o
gcc -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -fPIE -pie -shared -Wl,-soname,libdmalloc.so.5 -o libdmalloc.so.5.5.2 arg_check_sl.o compat_sl.o dmalloc_rand_sl.o dmalloc_tab_sl.o env_sl.o heap_sl.o chunk_sl.o error_sl.o malloc_sl.o
mv aout dmalloc
/usr/bin/ld: /tmp/ccytHyUT.ltrans0.ltrans.o: warning: relocation against `_dmalloc_iter_c' in read-only section `.text'
/usr/bin/ld: /tmp/ccytHyUT.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `_dmalloc_iter_c' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:275: libdmallocth.so.5.5.2] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/bin/ld: /tmp/ccYNGfwm.ltrans0.ltrans.o: warning: relocation against `_dmalloc_iter_c' in read-only section `.text'
/usr/bin/ld: /tmp/ccYNGfwm.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `_dmalloc_iter_c' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:282: libdmalloccxx.so.5.5.2] Error 1
/usr/bin/ld: /tmp/cc4G7RPe.ltrans0.ltrans.o: warning: relocation against `_dmalloc_iter_c' in read-only section `.text'
/usr/bin/ld: /tmp/cc4G7RPe.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `_dmalloc_iter_c' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:289: libdmallocthcxx.so.5.5.2] Error 1
/usr/bin/ld: /tmp/ccGqOoLU.ltrans0.ltrans.o: warning: relocation against `_dmalloc_iter_c' in read-only section `.text'
/usr/bin/ld: /tmp/ccGqOoLU.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `_dmalloc_iter_c' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:264: libdmalloc.so.5.5.2] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_build: error: make -j8 returned exit code 2
make[1]: *** [debian/rules:40: override_dh_auto_build] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:24: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2