[all-commits] [llvm/llvm-project] 9559bd: [LTO][Legacy] Add new API to check presence of cto...

w2yehia via All-commits all-commits at lists.llvm.org
Wed Jul 28 05:43:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9559bd19908bf6421f2abed1578219dacdc49169
      https://github.com/llvm/llvm-project/commit/9559bd19908bf6421f2abed1578219dacdc49169
  Author: Wael Yehia <wyehia at ca.ibm.com>
  Date:   2021-07-28 (Wed, 28 Jul 2021)

  Changed paths:
    M llvm/include/llvm-c/lto.h
    M llvm/include/llvm/LTO/legacy/LTOModule.h
    M llvm/lib/LTO/LTOModule.cpp
    A llvm/test/tools/llvm-lto/ltomodule.ll
    M llvm/tools/llvm-lto/llvm-lto.cpp
    M llvm/tools/lto/lto.cpp
    M llvm/tools/lto/lto.exports

  Log Message:
  -----------
  [LTO][Legacy] Add new API to check presence of ctor/dtor functions.

On AIX, the linker needs to check whether a given lto_module_t contains
any constructor/destructor functions, in order to implement the behavior
of the -bcdtors:all flag. See
https://www.ibm.com/docs/en/aix/7.2?topic=l-ld-command for the flag's
documentation.
In llvm IR, constructor (destructor) functions are added to a special
global array @llvm.global_ctors (@llvm.global_dtors).
However, because these two symbols are artificial, they are not visited
during the symbol traversal (using the
lto_module_get_[num_symbols|symbol_name|symbol_attribute] API).

This patch adds a new function to the libLTO interface that checks the
presence of one or both of these two symbols.

Reviewed By: steven_wu

Differential Revision: https://reviews.llvm.org/D106887




More information about the All-commits mailing list