llvm::appendToGlobalCtors

Append F to the global constructors of module M.

Synopsis

Declared in <llvm/Transforms/Utils/ModuleUtils.h>

void
appendToGlobalCtors(
    Module& M,
    Function* F,
    int Priority,
    Constant* Data = nullptr);

Description

This wraps the function in the appropriate structure and stores it along side other global constructors. For details see https://llvm.org/docs/LangRef.html#the-llvm-global-ctors-global-variable

Parameters

NameDescription
MModule whose global constructors are updated.
FFunction to append as a global constructor.
PriorityPriority of the constructor entry.
DataOptional associated data constant, or nullptr.