[Debian-lego-team] Bug#1015360: Bug#1015360: Bug#1015360: binutils-h8300-hms: ftbfs with LTO (link time optimization) enabled

Matthew Sheets ms.github at outlook.com
Sat Nov 1 23:57:02 GMT 2025


> Yes, the question is more: “is it a known autoconf problem where the
> test for the existance of a functions fails to detect non-existance when
> LTO optimization is enabled?”.

I think I'm seeing something similar to what I believe Nicolas is reporting.

With LTO enabled, in looking at the build log generated by the GitHub Action:
"checking for sys/pstat.h... no"
 * c.f. https://github.com/BrickBot/GNU-Legacy-Toolchain/actions/runs/19002943925/job/54272230366#step:10:71

…but
"checking for pstat_getstatic... yes"
 * https://github.com/BrickBot/GNU-Legacy-Toolchain/actions/runs/19002943925/job/54272230366#step:10:173


>From the logged build error:

/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c: In function ‘physmem_total’:
/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c:96:23: error: storage size of ‘pss’ isn’t known
   96 |     struct pst_static pss;
      |                       ^~~
/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c:97:14: warning: implicit declaration of function ‘pstat_getstatic’ [-Wimplicit-function-declaration]
   97 |     if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0))
      |              ^~~~~~~~~~~~~~~
/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c:96:23: warning: unused variable ‘pss’ [-Wunused-variable]
   96 |     struct pst_static pss;
      |                       ^~~
/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c: In function ‘physmem_available’:
/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c:200:23: error: storage size of ‘pss’ isn’t known
  200 |     struct pst_static pss;
      |                       ^~~
/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c:201:24: error: storage size of ‘psd’ isn’t known
  201 |     struct pst_dynamic psd;
      |                        ^~~
/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c:203:17: warning: implicit declaration of function ‘pstat_getdynamic’ [-Wimplicit-function-declaration]
  203 |         && 0 <= pstat_getdynamic (&psd, sizeof psd, 1, 0))
      |                 ^~~~~~~~~~~~~~~~
/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c:201:24: warning: unused variable ‘psd’ [-Wunused-variable]
  201 |     struct pst_dynamic psd;
      |                        ^~~
/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/sym-combined/binutils216/libiberty/physmem.c:200:23: warning: unused variable ‘pss’ [-Wunused-variable]
  200 |     struct pst_static pss;
      |                       ^~~
make[2]: *** [Makefile:909: physmem.o] Error 1
make[2]: Leaving directory '/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/build/binutils216/libiberty'
make[1]: *** [Makefile:20154: all-libiberty] Error 2
make[1]: Leaving directory '/home/runner/work/GNU-Legacy-Toolchain/GNU-Legacy-Toolchain/build/binutils216'
make: *** [Makefile:36: all-binutils216] Error 2
Error: Process completed with exit code 2.
 * c.f. https://github.com/BrickBot/GNU-Legacy-Toolchain/actions/runs/19002943925/job/54272230366#step:10:667

…it obviously ended up inside a pstat-dependent block.
HAVE_SYS_PSTAT_H guards the include of sys/pstat.h, and
HAVE_PSTAT_GETSTATIC guards the code containing the pstat_getstatic() calls.
 * c.f. https://github.com/BrickBot/GNU-Legacy-Toolchain/blob/cc21dd8792c7c3609c217f489e4806da881c0eda/src-projects/gcc-4.4.7/libiberty/physmem.c#L94


In contract, on a passing version of the build (no `-flto` flag), the pstat_getstatic test returns a different result:
"checking for pstat_getstatic... no"
 * c.f. https://github.com/BrickBot/GNU-Legacy-Toolchain/actions/runs/19002787909/job/54271877057#step:10:173


Thanks,
Matthew



More information about the Debian-lego-team mailing list