Get/set custom section information of function by using LLVM Pass.














Hello folks,








How can I get the section information that is set by attribute((section(“something”)) in C?








For example, I define the function like below.








------------------------------------------------------



int callB(int i) attribute((section(“newSec”))){







}



-----------------------------------------------------








Then, the LLVM IR is like below.



-----------------------------------------------------



define i32 @callB(i32 %i) #0 section “newSec” {







}



-----------------------------------------------------


















I’ve explored member functions of LLVM Function Class, but couldn’t find a proper function that can be used to set/get the custom section information.








Could you anybody help me to find useful class or functions for setting (getting) the function’s new section information?








What I want to do is copying function and placing it in a specific section.








Thank you!


Hi,