[PATCH] D66091: [ELF] Simplify handling of exportDynamic and isPreemptible

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 08:59:47 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: grimar, pcc, peter.smith, ruiu.
Herald added subscribers: llvm-commits, dexonsmith, arichardson, mehdi_amini, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

In Writer::includeInDynSym(), exportDynamic is used to decide if a
Defined should be included in .dynsym. It defaults to false, but can be changed to true by:

1. interposable SharedSymbol
2. --dynamic-list when producing an executable
3. -shared or --export-dynamic. This can be suppressed by canBeOmittedFromSymbolTable() when adding a bitcode file

To make the LTO canBeOmittedFromSymbolTable() optimization work,
-shared or --export-dynamic is placed in the member initializer.

When -shared, exportDynamic of most symbols is true. This makes it
incapable to record --dynamic-list information. We thus have
obscure:

  if (!config->shared)
    b->exportDynamic = true;
  else if (b->includeInDynsym())
    b->isPreemptible = true;

This patch adds another bit `Symbol::canOmitFromDynSym` to record
bitcode canBeOmittedFromSymbolTable(), and delays 3) to
includeInDynSym(). We can thus simplify 2) 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.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D66091

Files:
  ELF/InputFiles.cpp
  ELF/SymbolTable.cpp
  ELF/Symbols.cpp
  ELF/Symbols.h
  ELF/Writer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66091.214644.patch
Type: text/x-patch
Size: 5958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190812/32c6f71a/attachment.bin>


More information about the llvm-commits mailing list