[LLVMdev] PIC16TargetAsmInfo::getBSSSectionForGlobal

Chris Lattner clattner at apple.com
Mon Jul 20 15:20:56 PDT 2009

Hi Sanjiv,

The PIC16TargetAsmInfo::getBSSSectionForGlobal apparently does magic  
that reinterprets the "section" field of a global in a strange way:

   // If GV has a sectin name or section address create that section  
   if (GV->hasSection()) {
     std::string SectName = GV->getSection();
     // If address for a variable is specified, get the address and  
     // section.
     std::string AddrStr = "Address=";
     if (SectName.compare(0, AddrStr.length(), AddrStr) == 0) {
       std::string SectAddr = SectName.substr(AddrStr.length());
       S = CreateSectionForGlobal(GV, SectAddr);

Why isn't the front-end handling this, replacing all uses of the  
global with the address?  Does PIC allow initializing random sections  
of globals like this?  I need to heavily refactor all this code, and  
since there are no testcases at all for PIC16, I'm afraid of breaking  


More information about the llvm-dev mailing list