[llvm-dev] [libLTO] accessing llvm.global_ctors
Wael Yehia via llvm-dev
llvm-dev at lists.llvm.org
Mon Jul 26 10:59:19 PDT 2021
-----"Steven Wu" <stevenwu at apple.com> wrote: -----
To: "Wael Yehia" <wyehia at ca.ibm.com>
From: "Steven Wu" <stevenwu at apple.com>
Date: 07/26/2021 12:22PM
Cc: "Fangrui Song" <maskray at google.com>, llvm-dev at lists.llvm.org
Subject: [EXTERNAL] Re: [llvm-dev] [libLTO] accessing llvm.global_ctors
> It also sounds like that you just need to know if the object file has constructor or not, but don't really care anything more than that?
yes
> Can you read the section name from the IRSymtab to figure out if that is a constructor/destructor or not?
Is this a suggestion of how to implement the query I'm after?
My initial thought was to simply check for the presence of the symbols `llvm.global_ctors` and `llvm.global_dtors` in the ModuleSymbolTable in the LTOModule.
>> Certain linker flag forces it to include all archive members that have a constructor or destructor. I agree it's strange.
>
> Is it possible to disclose what linker and what platform that is? You don't have to but it would be easier to maintain if you can document this behavior that is unique to the platform you are looking at.
The linker is the system linker on AIX, and the option is -bcdtors:all (documented here: https://www.ibm.com/docs/en/aix/7.2?topic=l-ld-command)
More information about the llvm-dev
mailing list