I barely know anything about Windows, but on macOS, we get the following options for code size:
"size": 850008,
"size.__bss": 4608,
"size.__common": 96,
"size.__const": 9160,
"size.__cstring": 96751,
"size.__data": 56704,
"size.__eh_frame": 156,
"size.__got": 1128,
"size.__stubs": 1620,
"size.__text": 496008,
"size.__unwind_info": 2048
Out of all of these, the one that is usually the most important is size.__text
, and sometimes size.__data
.
I’m not sure which one LNT loads by default in the UI (I only use compare.py
), but I think you probably want size.__text
.
But when I generate O1.exe and O3.exe from O1.s O3.s, the size of executable files are the same
This is probably because the change in the assembly is too small:
An executable image consists of several different regions, each of which require different memory protection; so the start of each section must be aligned to a page boundary
(Portable Executable - Wikipedia)
It’s likely that the original code + changed code fit within the same page, so you won’t see a change in total executable size.
(Apparently, on Windows, there’s an optional header (SizeOfCode
) which contains the sum of all code sections in an executable. Maybe there’s a way to get at that if you want to double-check what LNT is doing. See: PE Format - Win32 apps | Microsoft Docs)