Itay Bookstein via llvm-dev
2021-Aug-11 14:26 UTC
[llvm-dev] [llvm][Linker] llvm-link / ModuleLinker drops GlobalIFuncs
It appears that the code in llvm/lib/Linker/LinkModules.cpp doesn't take GlobalIFunc-s into account, and therefore drops them. There are three loops that iterate over GlobalVariable, Function and GlobalAlias respectively, to collect them into ValuesToLink. I'm wondering whether replacing these three loops with a single loop over all GlobalValues is sufficient to remedy this. WDYT? -- Itay Bookstein Software Engineer NEXTSILICON -- This e-mail message and any attachments thereto are intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you are not the intended addressee, please contact the sender immediately and delete the materials and information from your device and system and confirm the deletion by reply e-mail.
Fāng-ruì Sòng via llvm-dev
2021-Aug-13 01:17 UTC
[llvm-dev] [llvm][Linker] llvm-link / ModuleLinker drops GlobalIFuncs
On Wed, Aug 11, 2021 at 7:27 AM Itay Bookstein via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > It appears that the code in llvm/lib/Linker/LinkModules.cpp doesn't > take GlobalIFunc-s into account, and therefore drops them. There are > three loops that iterate over GlobalVariable, Function and GlobalAlias > respectively, to collect them into ValuesToLink. I'm wondering whether > replacing these three loops with a single loop over all GlobalValues > is sufficient to remedy this. > WDYT?Looks good. % cat a.ll @foo = dso_local ifunc i32 (...), bitcast (i8* ()* @foo_resolver to i32 (...)*) ; Function Attrs: noinline nounwind optnone uwtable define dso_local i32 @foo_impl() #0 { entry: ret i32 42 } ; Function Attrs: noinline nounwind optnone uwtable define dso_local i8* @foo_resolver() #0 { entry: ret i8* bitcast (i32 ()* @foo_impl to i8*) } attributes #0 = { "frame-pointer"="all" } % llvm-link a.ll -S -o b.ll The ifunc is incorrectly dropped.> -- > This e-mail message and any attachments thereto are intended only for the > person or entity to which it is addressed and may contain confidential > and/or privileged material. Any retransmission, dissemination, copying or > other use of, or taking of any action in reliance upon this information is > prohibited. If you are not the intended addressee, please contact the > sender immediately and delete the materials and information from your > device and system and confirm the deletion by reply e-mail. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- 宋方睿