In Writer::includeInDynSym(), exportDynamic is used by a Defined with
protected or default visibility, to record whether it is required to be
exported into .dynsym. It is set when any of the following conditions
hold:
- There is an interposable symbol from a DSO (Undefined or SharedSymbol with default visibility)
- If -shared or --export-dynamic is specified, any symbol in an object file/bitcode sets this property, unless suppressed by canBeOmittedFromSymbolTable().
- --dynamic-list when producing an executable
Bullet 3) does not play well with 1) and 2). When -shared is specified,
exportDynamic of most symbols is true. This makes it incapable to record
--dynamic-list marked symbols. We thus have obscure:
if (!config->shared) b->exportDynamic = true; else if (b->includeInDynsym()) b->isPreemptible = true;
This patch adds another bit Symbol::inDynamicList to record
3). We can thus simplify handleDynamicList() by unifying the DSO and
executable cases. It also allows us to simplify isPreemptible - now
the field is only used in finalizeSections() and later stages.
Post variable naming change, could we use newDefined or newSym to avoid the New (presumably to avoid clash with new).