[llvm-dev] [libLTO] accessing llvm.global_ctors
Steven Wu via llvm-dev
llvm-dev at lists.llvm.org
Mon Jul 26 09:21:29 PDT 2021
I am fine with adding a new C API to read the constructor and destructor if needed. I don't think it makes sense to encode llvm.global_ctors and llvm.global_dtors into the symbol table since they are not symbols. 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? Can you read the section name from the IRSymtab to figure out if that is a constructor/destructor or not?
> On Jul 25, 2021, at 4:39 PM, Wael Yehia via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
>
>
>
>>> Hi,
>>> Our linker uses the libLTO interface. Given an lto_module_t, we are trying to
>>> check if it contains the @llvm.global_ctors or the @llvm.global_dtors global
>>> variables. We need to know this information in order to decide whether to
>>> include a bitcode archive member in the LTO step or not.
>>
>> This is strange. Constructors should be orthogonal to archive member extraction.
>> If an archive member is unused, it is not extracted and its constructors
>> are suppressed.
>
> 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.
Thanks
Steven
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list