Unfortunately Ubuntu packages a fairly old (5.3.0) version of gcc-avr at the time of writing. Versions of gcc-avr from 8.3.0 onwards will produce significantly smaller binaries. The steps of building and installing a cutting-edge AVR toolchain on Ubuntu (tested on 20.04/WSL2 and 20.10/Baremetal) are outlined below.
Most of the procedure is loosely based on this manpage.
It's a good idea to run all of this from a folder dedicated to it.