Changeset 628

Show
Ignore:
Timestamp:
08/26/10 02:12:38 (1 year ago)
Author:
walter
Message:

bugzilla 4721: compilation slow when compiling unittests on dcollections

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/backend/elfobj.c

    r589 r628  
    3838 
    3939#include        "dwarf.h" 
     40 
     41#include        "aa.h" 
     42#include        "tinfo.h" 
    4043 
    4144//#define DEBSYM 0x7E 
     
    124127#define SEC_NAMES_INC   400 
    125128 
     129// Hash table for section_names 
     130AArray *section_names_hashtable; 
     131 
     132/* ====================== Cached Strings in section_names ================= */ 
     133 
     134struct TypeInfo_Idxstr : TypeInfo 
     135{ 
     136    const char* toString(); 
     137    hash_t getHash(void *p); 
     138    int equals(void *p1, void *p2); 
     139    int compare(void *p1, void *p2); 
     140    size_t tsize(); 
     141    void swap(void *p1, void *p2); 
     142}; 
     143 
     144TypeInfo_Idxstr ti_idxstr; 
     145 
     146const char* TypeInfo_Idxstr::toString() 
     147{ 
     148    return "IDXSTR"; 
     149} 
     150 
     151hash_t TypeInfo_Idxstr::getHash(void *p) 
     152{ 
     153    IDXSTR a = *(IDXSTR *)p; 
     154    hash_t hash = 0; 
     155    for (const char *s = (char *)(section_names->buf + a); 
     156         *s; 
     157         s++) 
     158    { 
     159        hash = hash * 11 + *s; 
     160    } 
     161    return hash; 
     162} 
     163 
     164int TypeInfo_Idxstr::equals(void *p1, void *p2) 
     165{ 
     166    IDXSTR a1 = *(IDXSTR*)p1; 
     167    IDXSTR a2 = *(IDXSTR*)p2; 
     168    const char *s1 = (char *)(section_names->buf + a1); 
     169    const char *s2 = (char *)(section_names->buf + a2); 
     170 
     171    return strcmp(s1, s2) == 0; 
     172} 
     173 
     174int TypeInfo_Idxstr::compare(void *p1, void *p2) 
     175{ 
     176    IDXSTR a1 = *(IDXSTR*)p1; 
     177    IDXSTR a2 = *(IDXSTR*)p2; 
     178    const char *s1 = (char *)(section_names->buf + a1); 
     179    const char *s2 = (char *)(section_names->buf + a2); 
     180 
     181    return strcmp(s1, s2); 
     182} 
     183 
     184size_t TypeInfo_Idxstr::tsize() 
     185{ 
     186    return sizeof(IDXSTR); 
     187} 
     188 
     189void TypeInfo_Idxstr::swap(void *p1, void *p2) 
     190{ 
     191    assert(0); 
     192} 
     193 
     194 
     195/* ======================================================================== */ 
     196 
    126197// String Table  - String table for all other names 
    127198static Outbuffer *symtab_strings; 
     
    254325static IDXSTR elf_findstr(Outbuffer *strtab, const char *str, const char *suffix) 
    255326{ 
     327    //printf("elf_findstr(strtab = %p, str = %s, suffix = %s\n", strtab, str ? str : "", suffix ? suffix : ""); 
     328 
     329    size_t len = strlen(str); 
     330 
     331    // Combine str~suffix and have buf point to the combination 
     332#ifdef DEBUG 
     333    char tmpbuf[25];    // to exercise the alloca() code path 
     334#else 
     335    char tmpbuf[1024];  // the alloca() code path is slow 
     336#endif 
     337    const char *buf; 
     338    if (suffix) 
     339    { 
     340        size_t suffixlen = strlen(suffix); 
     341        if (len + suffixlen >= sizeof(tmpbuf)) 
     342        { 
     343             buf = (char *)alloca(len + suffixlen + 1); 
     344             assert(buf); 
     345        } 
     346        else 
     347        { 
     348             buf = tmpbuf; 
     349        } 
     350        memcpy((char *)buf, str, len); 
     351        memcpy((char *)buf + len, suffix, suffixlen + 1); 
     352        len += suffixlen; 
     353    } 
     354    else 
     355        buf = str; 
     356 
     357    // Linear search, slow 
    256358    const char *ent = (char *)strtab->buf+1; 
    257359    const char *pend = ent+strtab->size() - 1; 
    258     const char *s = str; 
    259     const char *sx = suffix; 
    260     int len = strlen(str); 
    261  
    262     if (suffix) 
    263         len += strlen(suffix); 
    264  
    265     while(ent < pend) 
    266     { 
    267         if(*ent == 0)                   // end of table entry 
    268         { 
    269             if(*s == 0 && !sx)          // end of string - found a match 
    270             { 
    271                 return ent - (const char *)strtab->buf - len; 
    272             } 
    273             else                        // table entry too short 
    274             { 
    275                 s = str;                // back to beginning of string 
    276                 sx = suffix; 
    277                 ent++;                  // start of next table entry 
    278             } 
    279         } 
    280         else if (*s == 0 && sx && *sx == *ent) 
    281         {                               // matched first string 
    282             s = sx+1;                   // switch to suffix 
    283             ent++; 
    284             sx = NULL; 
    285         } 
    286         else                            // continue comparing 
    287         { 
    288             if (*ent == *s) 
    289             {                           // Have a match going 
    290                 ent++; 
    291                 s++; 
    292             } 
    293             else                        // no match 
    294             { 
    295                 while(*ent != 0)        // skip to end of entry 
    296                     ent++; 
    297                 ent++;                  // start of next table entry 
    298                 s = str;                // back to beginning of string 
    299                 sx = suffix; 
    300             } 
    301         } 
     360    while (ent + len < pend) 
     361    { 
     362        if (memcmp(buf, ent, len + 1) == 0) 
     363            return ent - (const char *)strtab->buf; 
     364        ent = (const char *)memchr(ent, 0, pend - ent); 
     365        ent += 1; 
    302366    } 
    303367    return 0;                   // never found match 
     
    468532        elf_u32_f32 type, elf_u32_f32 flags) 
    469533{ 
    470     Elf32_Shdr sec; 
    471  
    472 //    dbg_printf("elf_newsection(%s,%s,type %d, flags x%x)\n", 
    473 //        name?name:"",suffix?suffix:"",type,flags); 
    474  
    475 #if 1 
    476     int namidx = elf_addstr(section_names,name); 
    477 #else 
    478     int namidx = section_names->size(); 
     534    // dbg_printf("elf_newsection(%s,%s,type %d, flags x%x)\n", 
     535    //        name?name:"",suffix?suffix:"",type,flags); 
     536 
     537    IDXSTR namidx = section_names->size(); 
    479538    section_names->writeString(name); 
    480 #endif 
    481                                         // name in section names table 
    482     if (suffix)                         // suffix - back up over NUL and 
    483     {                                   //          append suffix string 
    484         section_names->setsize(section_names->size()-1); 
     539    if (suffix) 
     540    {   // Append suffix string 
     541        section_names->setsize(section_names->size() - 1);  // back up over terminating 0 
    485542        section_names->writeString(suffix); 
    486     }; 
     543    } 
     544    IDXSTR *pidx = (IDXSTR *)section_names_hashtable->get(&namidx); 
     545    assert(!*pidx);             // must not already exist 
     546    *pidx = namidx; 
     547 
    487548    return elf_newsection2(namidx,type,flags,0,0,0,0,0,0,0); 
    488549} 
     
    615676        } 
    616677 
     678        if (section_names_hashtable) 
     679            delete section_names_hashtable; 
     680        section_names_hashtable = new AArray(&ti_idxstr, sizeof(IDXSTR)); 
     681 
    617682        // name,type,flags,addr,offset,size,link,info,addralign,entsize 
    618683        elf_newsection2(0,               SHT_NULL,   0,                 0,0,0,0,0, 0,0); 
     
    628693        elf_newsection2(NAMIDX_COMMENT, SHT_PROGDEF,0,                  0,0,0,0,0, 1,0); 
    629694        elf_newsection2(NAMIDX_NOTE,SHT_NOTE,   0,                      0,0,0,0,0, 1,0); 
     695 
     696        IDXSTR namidx; 
     697        namidx = NAMIDX_TEXT;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     698        namidx = NAMIDX_RELTEXT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     699        namidx = NAMIDX_DATA;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     700        namidx = NAMIDX_RELDATA64; *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     701        namidx = NAMIDX_BSS;       *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     702        namidx = NAMIDX_RODATA;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     703        namidx = NAMIDX_STRTAB;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     704        namidx = NAMIDX_SYMTAB;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     705        namidx = NAMIDX_SHSTRTAB;  *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     706        namidx = NAMIDX_COMMENT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     707        namidx = NAMIDX_NOTE;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
    630708    } 
    631709    else 
     
    638716        else 
    639717        {   section_names = new Outbuffer(512); 
    640             section_names->reserve(1024); 
     718            section_names->reserve(100*1024); 
    641719            section_names->writen(section_names_init, sizeof(section_names_init)); 
    642720        } 
     721 
     722        if (section_names_hashtable) 
     723            delete section_names_hashtable; 
     724        section_names_hashtable = new AArray(&ti_idxstr, sizeof(IDXSTR)); 
    643725 
    644726        // name,type,flags,addr,offset,size,link,info,addralign,entsize 
     
    655737        elf_newsection2(NAMIDX_COMMENT, SHT_PROGDEF,0,                  0,0,0,0,0, 1,0); 
    656738        elf_newsection2(NAMIDX_NOTE,SHT_NOTE,   0,                      0,0,0,0,0, 1,0); 
     739 
     740        IDXSTR namidx; 
     741        namidx = NAMIDX_TEXT;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     742        namidx = NAMIDX_RELTEXT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     743        namidx = NAMIDX_DATA;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     744        namidx = NAMIDX_RELDATA;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     745        namidx = NAMIDX_BSS;       *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     746        namidx = NAMIDX_RODATA;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     747        namidx = NAMIDX_STRTAB;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     748        namidx = NAMIDX_SYMTAB;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     749        namidx = NAMIDX_SHSTRTAB;  *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     750        namidx = NAMIDX_COMMENT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     751        namidx = NAMIDX_NOTE;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
    657752    } 
    658753 
     
    15571652    //printf("elf_getsegment(%s,%s,flags %x, align %d)\n",name,suffix,flags,align); 
    15581653 
    1559     IDXSTR namidx; 
    1560     if (namidx = elf_findstr(section_names,name,suffix)) 
    1561     {                                   // this section name exists 
     1654    // Add name~suffix to the section_names table 
     1655    IDXSTR namidx = section_names->size(); 
     1656    section_names->writeString(name); 
     1657    if (suffix) 
     1658    {   // Append suffix string 
     1659        section_names->setsize(section_names->size() - 1);  // back up over terminating 0 
     1660        section_names->writeString(suffix); 
     1661    } 
     1662    IDXSTR *pidx = (IDXSTR *)section_names_hashtable->get(&namidx); 
     1663    if (*pidx) 
     1664    {   // this section name already exists 
     1665        section_names->setsize(namidx);                 // remove addition 
     1666        namidx = *pidx; 
    15621667        for (int seg = CODE; seg <= seg_count; seg++) 
    15631668        {                               // should be in segment table 
     
    15701675        // FIX - should be an error message conflict with section names 
    15711676    } 
     1677    *pidx = namidx; 
    15721678 
    15731679    //dbg_printf("\tNew segment - %d size %d\n", seg,SegData[seg]->SDbuf); 
    1574     IDXSEC shtidx = elf_newsection(name,suffix,type,flags); 
     1680    IDXSEC shtidx = elf_newsection2(namidx,type,flags,0,0,0,0,0,0,0); 
    15751681    SecHdrTab[shtidx].sh_addralign = align; 
    15761682    IDXSYM symidx = elf_addsym(0, 0, 0, STT_SECTION, STB_LOCAL, shtidx); 
  • trunk/src/backend/elfobj.c

    r589 r628  
    3838 
    3939#include        "dwarf.h" 
     40 
     41#include        "aa.h" 
     42#include        "tinfo.h" 
    4043 
    4144//#define DEBSYM 0x7E 
     
    124127#define SEC_NAMES_INC   400 
    125128 
     129// Hash table for section_names 
     130AArray *section_names_hashtable; 
     131 
     132/* ====================== Cached Strings in section_names ================= */ 
     133 
     134struct TypeInfo_Idxstr : TypeInfo 
     135{ 
     136    const char* toString(); 
     137    hash_t getHash(void *p); 
     138    int equals(void *p1, void *p2); 
     139    int compare(void *p1, void *p2); 
     140    size_t tsize(); 
     141    void swap(void *p1, void *p2); 
     142}; 
     143 
     144TypeInfo_Idxstr ti_idxstr; 
     145 
     146const char* TypeInfo_Idxstr::toString() 
     147{ 
     148    return "IDXSTR"; 
     149} 
     150 
     151hash_t TypeInfo_Idxstr::getHash(void *p) 
     152{ 
     153    IDXSTR a = *(IDXSTR *)p; 
     154    hash_t hash = 0; 
     155    for (const char *s = (char *)(section_names->buf + a); 
     156         *s; 
     157         s++) 
     158    { 
     159        hash = hash * 11 + *s; 
     160    } 
     161    return hash; 
     162} 
     163 
     164int TypeInfo_Idxstr::equals(void *p1, void *p2) 
     165{ 
     166    IDXSTR a1 = *(IDXSTR*)p1; 
     167    IDXSTR a2 = *(IDXSTR*)p2; 
     168    const char *s1 = (char *)(section_names->buf + a1); 
     169    const char *s2 = (char *)(section_names->buf + a2); 
     170 
     171    return strcmp(s1, s2) == 0; 
     172} 
     173 
     174int TypeInfo_Idxstr::compare(void *p1, void *p2) 
     175{ 
     176    IDXSTR a1 = *(IDXSTR*)p1; 
     177    IDXSTR a2 = *(IDXSTR*)p2; 
     178    const char *s1 = (char *)(section_names->buf + a1); 
     179    const char *s2 = (char *)(section_names->buf + a2); 
     180 
     181    return strcmp(s1, s2); 
     182} 
     183 
     184size_t TypeInfo_Idxstr::tsize() 
     185{ 
     186    return sizeof(IDXSTR); 
     187} 
     188 
     189void TypeInfo_Idxstr::swap(void *p1, void *p2) 
     190{ 
     191    assert(0); 
     192} 
     193 
     194 
     195/* ======================================================================== */ 
     196 
    126197// String Table  - String table for all other names 
    127198static Outbuffer *symtab_strings; 
     
    254325static IDXSTR elf_findstr(Outbuffer *strtab, const char *str, const char *suffix) 
    255326{ 
     327    //printf("elf_findstr(strtab = %p, str = %s, suffix = %s\n", strtab, str ? str : "", suffix ? suffix : ""); 
     328 
     329    size_t len = strlen(str); 
     330 
     331    // Combine str~suffix and have buf point to the combination 
     332#ifdef DEBUG 
     333    char tmpbuf[25];    // to exercise the alloca() code path 
     334#else 
     335    char tmpbuf[1024];  // the alloca() code path is slow 
     336#endif 
     337    const char *buf; 
     338    if (suffix) 
     339    { 
     340        size_t suffixlen = strlen(suffix); 
     341        if (len + suffixlen >= sizeof(tmpbuf)) 
     342        { 
     343             buf = (char *)alloca(len + suffixlen + 1); 
     344             assert(buf); 
     345        } 
     346        else 
     347        { 
     348             buf = tmpbuf; 
     349        } 
     350        memcpy((char *)buf, str, len); 
     351        memcpy((char *)buf + len, suffix, suffixlen + 1); 
     352        len += suffixlen; 
     353    } 
     354    else 
     355        buf = str; 
     356 
     357    // Linear search, slow 
    256358    const char *ent = (char *)strtab->buf+1; 
    257359    const char *pend = ent+strtab->size() - 1; 
    258     const char *s = str; 
    259     const char *sx = suffix; 
    260     int len = strlen(str); 
    261  
    262     if (suffix) 
    263         len += strlen(suffix); 
    264  
    265     while(ent < pend) 
    266     { 
    267         if(*ent == 0)                   // end of table entry 
    268         { 
    269             if(*s == 0 && !sx)          // end of string - found a match 
    270             { 
    271                 return ent - (const char *)strtab->buf - len; 
    272             } 
    273             else                        // table entry too short 
    274             { 
    275                 s = str;                // back to beginning of string 
    276                 sx = suffix; 
    277                 ent++;                  // start of next table entry 
    278             } 
    279         } 
    280         else if (*s == 0 && sx && *sx == *ent) 
    281         {                               // matched first string 
    282             s = sx+1;                   // switch to suffix 
    283             ent++; 
    284             sx = NULL; 
    285         } 
    286         else                            // continue comparing 
    287         { 
    288             if (*ent == *s) 
    289             {                           // Have a match going 
    290                 ent++; 
    291                 s++; 
    292             } 
    293             else                        // no match 
    294             { 
    295                 while(*ent != 0)        // skip to end of entry 
    296                     ent++; 
    297                 ent++;                  // start of next table entry 
    298                 s = str;                // back to beginning of string 
    299                 sx = suffix; 
    300             } 
    301         } 
     360    while (ent + len < pend) 
     361    { 
     362        if (memcmp(buf, ent, len + 1) == 0) 
     363            return ent - (const char *)strtab->buf; 
     364        ent = (const char *)memchr(ent, 0, pend - ent); 
     365        ent += 1; 
    302366    } 
    303367    return 0;                   // never found match 
     
    468532        elf_u32_f32 type, elf_u32_f32 flags) 
    469533{ 
    470     Elf32_Shdr sec; 
    471  
    472 //    dbg_printf("elf_newsection(%s,%s,type %d, flags x%x)\n", 
    473 //        name?name:"",suffix?suffix:"",type,flags); 
    474  
    475 #if 1 
    476     int namidx = elf_addstr(section_names,name); 
    477 #else 
    478     int namidx = section_names->size(); 
     534    // dbg_printf("elf_newsection(%s,%s,type %d, flags x%x)\n", 
     535    //        name?name:"",suffix?suffix:"",type,flags); 
     536 
     537    IDXSTR namidx = section_names->size(); 
    479538    section_names->writeString(name); 
    480 #endif 
    481                                         // name in section names table 
    482     if (suffix)                         // suffix - back up over NUL and 
    483     {                                   //          append suffix string 
    484         section_names->setsize(section_names->size()-1); 
     539    if (suffix) 
     540    {   // Append suffix string 
     541        section_names->setsize(section_names->size() - 1);  // back up over terminating 0 
    485542        section_names->writeString(suffix); 
    486     }; 
     543    } 
     544    IDXSTR *pidx = (IDXSTR *)section_names_hashtable->get(&namidx); 
     545    assert(!*pidx);             // must not already exist 
     546    *pidx = namidx; 
     547 
    487548    return elf_newsection2(namidx,type,flags,0,0,0,0,0,0,0); 
    488549} 
     
    615676        } 
    616677 
     678        if (section_names_hashtable) 
     679            delete section_names_hashtable; 
     680        section_names_hashtable = new AArray(&ti_idxstr, sizeof(IDXSTR)); 
     681 
    617682        // name,type,flags,addr,offset,size,link,info,addralign,entsize 
    618683        elf_newsection2(0,               SHT_NULL,   0,                 0,0,0,0,0, 0,0); 
     
    628693        elf_newsection2(NAMIDX_COMMENT, SHT_PROGDEF,0,                  0,0,0,0,0, 1,0); 
    629694        elf_newsection2(NAMIDX_NOTE,SHT_NOTE,   0,                      0,0,0,0,0, 1,0); 
     695 
     696        IDXSTR namidx; 
     697        namidx = NAMIDX_TEXT;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     698        namidx = NAMIDX_RELTEXT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     699        namidx = NAMIDX_DATA;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     700        namidx = NAMIDX_RELDATA64; *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     701        namidx = NAMIDX_BSS;       *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     702        namidx = NAMIDX_RODATA;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     703        namidx = NAMIDX_STRTAB;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     704        namidx = NAMIDX_SYMTAB;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     705        namidx = NAMIDX_SHSTRTAB;  *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     706        namidx = NAMIDX_COMMENT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     707        namidx = NAMIDX_NOTE;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
    630708    } 
    631709    else 
     
    638716        else 
    639717        {   section_names = new Outbuffer(512); 
    640             section_names->reserve(1024); 
     718            section_names->reserve(100*1024); 
    641719            section_names->writen(section_names_init, sizeof(section_names_init)); 
    642720        } 
     721 
     722        if (section_names_hashtable) 
     723            delete section_names_hashtable; 
     724        section_names_hashtable = new AArray(&ti_idxstr, sizeof(IDXSTR)); 
    643725 
    644726        // name,type,flags,addr,offset,size,link,info,addralign,entsize 
     
    655737        elf_newsection2(NAMIDX_COMMENT, SHT_PROGDEF,0,                  0,0,0,0,0, 1,0); 
    656738        elf_newsection2(NAMIDX_NOTE,SHT_NOTE,   0,                      0,0,0,0,0, 1,0); 
     739 
     740        IDXSTR namidx; 
     741        namidx = NAMIDX_TEXT;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     742        namidx = NAMIDX_RELTEXT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     743        namidx = NAMIDX_DATA;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     744        namidx = NAMIDX_RELDATA;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     745        namidx = NAMIDX_BSS;       *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     746        namidx = NAMIDX_RODATA;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     747        namidx = NAMIDX_STRTAB;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     748        namidx = NAMIDX_SYMTAB;    *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     749        namidx = NAMIDX_SHSTRTAB;  *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     750        namidx = NAMIDX_COMMENT;   *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
     751        namidx = NAMIDX_NOTE;      *(IDXSTR *)section_names_hashtable->get(&namidx) = namidx; 
    657752    } 
    658753 
     
    15571652    //printf("elf_getsegment(%s,%s,flags %x, align %d)\n",name,suffix,flags,align); 
    15581653 
    1559     IDXSTR namidx; 
    1560     if (namidx = elf_findstr(section_names,name,suffix)) 
    1561     {                                   // this section name exists 
     1654    // Add name~suffix to the section_names table 
     1655    IDXSTR namidx = section_names->size(); 
     1656    section_names->writeString(name); 
     1657    if (suffix) 
     1658    {   // Append suffix string 
     1659        section_names->setsize(section_names->size() - 1);  // back up over terminating 0 
     1660        section_names->writeString(suffix); 
     1661    } 
     1662    IDXSTR *pidx = (IDXSTR *)section_names_hashtable->get(&namidx); 
     1663    if (*pidx) 
     1664    {   // this section name already exists 
     1665        section_names->setsize(namidx);                 // remove addition 
     1666        namidx = *pidx; 
    15621667        for (int seg = CODE; seg <= seg_count; seg++) 
    15631668        {                               // should be in segment table 
     
    15701675        // FIX - should be an error message conflict with section names 
    15711676    } 
     1677    *pidx = namidx; 
    15721678 
    15731679    //dbg_printf("\tNew segment - %d size %d\n", seg,SegData[seg]->SDbuf); 
    1574     IDXSEC shtidx = elf_newsection(name,suffix,type,flags); 
     1680    IDXSEC shtidx = elf_newsection2(namidx,type,flags,0,0,0,0,0,0,0); 
    15751681    SecHdrTab[shtidx].sh_addralign = align; 
    15761682    IDXSYM symidx = elf_addsym(0, 0, 0, STT_SECTION, STB_LOCAL, shtidx);