REF | NOREF
/OPT:REF eliminates functions and/or data that are never referenced while /OPT:NOREF keeps functions and/or data that are never referenced.
LINK removes unreferenced packaged functions by default. An object contains packaged functions (COMDATs) if it has been compiled with the /Gy option. This optimization is called transitive COMDAT elimination. To override this default and keep unreferenced COMDATs in the program, specify /OPT:NOREF. You can use the /INCLUDE option to override the removal of a specific symbol.
If /DEBUG is specified, the default for /OPT is NOREF (otherwise, it is REF), and all functions are preserved in the image. To override this default and optimize a debugging build, specify /OPT:REF. The /OPT:REF option disables incremental linking.
You have to explicitly mark data as a COMDAT; use __declspec(selectany).
If /OPT:REF is specified, /OPT:ICF is on by default. If you want /OPT:REF but not /OPT:ICF, you must specify the following:
link /opt:ref /opt:noicf
Specifying /OPT:ICF does not activate the /OPT:REF option.