-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
BOLTquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
When writing a BOLT Pass, I have to add some data in data section and create a Symbol which references the data. Then I will use the Symbol to generate some MCInst. I code it as bellow:
uint8_t *array = new uint8_t [1024];
auto &Section = BC.registerOrUpdateSection("MyData", ELF::SHT_PROGBITS, BinarySection::getFlags(false,false,true),array,1024);
array[0] = 1;//generate some data in the Section
Section.setOutputAddress(/*I don't know*/);
Section.setOutputFileOffset(/*"I don't know"*/);
int SymbolAddress;/*I don't know*/
BC.getOrCreateGlobalSymbol(SymbolAddress, "DATAAt",8);
However, the Symbol must be given a specific Address which is corresponding to the Section OutputAddress. However, the OutputAddress and OutputFileOffset is defined after all the BOLT PASSes, so I can't get the information inside my BOLT PASS, and I failed to define them by myself.
Is there any way to handle it?
Metadata
Metadata
Assignees
Labels
BOLTquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!