Have you looked at the
size command source code? The size man page footer shows that
size is part of the GNU binutils package. Netsearching for binutils and "source code" finds
GNU's binutils page which has a link to the source code. There's no better reference or authority than that