Binary size difference between gnat 14.2.0 and 15.2.1

Usually, I compile Tada with GNAT from Debian Trixie (14.2.0). In the release profile, the resulting binary is around 1.2MB. When compiled with GNAT 15.2.1 (from Alire toolchain), same profile, the binary size around 3.4MB.

Why is that?

Things I would check:

  • Linking type: dynamic vs static
  • Debug info
  • Optimization settings, e.g. aggressive inlining

Thanks, same settings for both. The only things that changed were GNAT and GPRBuild, but the GPR file was the same.

Maybe more runtime features from Ada2022 added between the two versions? Just guessing mind you, I don’t know for sure.

But gpr is not all settings. Alire might add something on top.

I’m not using Alire. This is Tada (no magic) on top of GPRBuild. I fully control the configuration.

You said you take GCC 15 from Alire. What is with a native GNAT 15? Fedora has it.

Debian, Ubuntu, Fedora have Ada run-time in a shared library, which comes as a separate package. (Hint for tada design :grinning: I will not elaborate risking to be banned). Use the ldd and compare the outputs.

I was testing local and global settings for Tada. I use “gnat” and “gprbuild” packages on Debian. But I also have Alire installed so I could access its toolchain.

Not much difference over here, by the way I had to remove with “tada_deps.gpr”; to bootstrap it:

GNAT 15.2.0 20250808 (release) -=> GNAT [FreeBSD64]
Copyright 1996-2025, Free Software Foundation, Inc.

radziecki> gprbuild -P tada.gpr
(...)
radziecki> mv target target15


radziecki> export PATH=/usr/local/gnat14/bin:$PATH 

GNAT 14.2.0 20240801 (release) -=> GNAT [FreeBSD64]
Copyright 1996-2024, Free Software Foundation, Inc.

radziecki> gprbuild -P tada.gpr
(...)
radziecki> mv target target14

radziecki> du -k target14 | sort +2
1479	target14/debug/obj
2253	target14/debug/bin
3733	target14
3733	target14/debug
radziecki> du -k target15 | sort +2
1447	target15/debug/obj
2265	target15/debug/bin
3713	target15
3713	target15/debug
radziecki> file target14/debug/bin/tada 
target14/debug/bin/tada: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 16.0 (1600012), FreeBSD-style, with debug_info, not stripped
radziecki> file target15/debug/bin/tada
target15/debug/bin/tada: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 16.0 (1600012), FreeBSD-style, with debug_info, not stripped

Are you sure you are comparing 64-bit binaries to 64-bit binaries? If you compare an installed version vs uninstalled you might get debug symbols stripped. Please try the above sequence of commands to find out…