Unused data goes too.option eliminate used to keep all data, and
everything data refers to. Data COMDATs, such as C++ virtual function
tables, type_info objects and jump tables, are now dropped when
nothing that stays refers to them; a vtable no longer keeps every
virtual function of its class, and with them most of a C++ library.
Aliases are followed. A reference to an ALIAS name is a reference
to the symbol it names, so the target is no longer dropped as
unreferenced.
Zero-filled BSS stays out of the file. A COMDAT in a BSS or
FAR_BSS class that holds only zeros is uninitialized, like the segment
it goes in, so with -fdata-sections BSS no longer takes room in a DOS
.EXE or .COM file.
Only the modules that are used. An NE file's module reference table
listed every module an import directive named. Windows loads every
module in the table, so with clang's windows.lnk, which imports the
whole Windows 3.1 API, every program needed SHELL, COMMDLG, TOOLHELP,
MMSYSTEM, VER and LZEXPAND, and could not load on Windows 3.0 or older.
Now only the modules that referenced imports come from are listed.
ELF init_array, fini_array and preinit_array sections are read,
priority sections (.init_array.NNN) are folded into their base
section, R_386_PLT32 is a 32-bit relative fixup, and undefined weak
symbols resolve to __elf_weak_null.
An uninitialized ELF or COFF section named .stack is the program's
stack, sized by option stack=.
Calls to imported functions drop the -4 that ELF keeps in the field,
which the LX loader already accounts for, and only the DLLs that
imports come from go in the module table.
A weak ELF definition gives way to one already seen, without a
"redefinition" error. C++ puts inline functions, template instances and
vtables in every object that uses them as weak symbols; the first
definition is used.