void ConvertLazyRefs( void ) /*********************************/ /* go through all symbols, & turn lazy refs to aliases to default sym. */ { symbol * defsym; symbol * sym; for( sym = HeadSym; sym != NULL; sym = sym->link ) { if( IS_SYM_A_REF(sym) ) { if( IS_SYM_VF_REF(sym) ) { defsym = *(sym->e.vfdata); _LnkFree( sym->e.vfdata ); } else { defsym = sym->e.def; if( sym->info & SYM_VF_MARKED ) { DefStripSym( sym, AllocSegData() ); // see note 1 below. } } WeldSyms( sym, defsym ); sym->info |= SYM_WAS_LAZY; if( LinkFlags & SHOW_DEAD ) { LnkMsg( MAP+MSG_SYMBOL_DEAD, "S", sym ); } } } }
static orl_return DeclareSegment( orl_sec_handle sec ) /****************************************************/ // declare the "segment" { segdata *sdata; segnode *snode; char *name; unsigned_32 _WCUNALIGNED *contents; size_t len; orl_sec_flags flags; orl_sec_type type; unsigned numlines; unsigned segidx; type = ORLSecGetType( sec ); if( type != ORL_SEC_TYPE_NO_BITS && type != ORL_SEC_TYPE_PROG_BITS ) { return( ORL_OKAY ); } flags = ORLSecGetFlags( sec ); name = ORLSecGetName( sec ); sdata = AllocSegData(); segidx = ORLCvtSecHdlToIdx( sec ); snode = AllocNodeIdx( SegNodes, segidx ); snode->entry = sdata; snode->handle = sec; sdata->iscdat = (flags & ORL_SEC_FLAG_COMDAT) != 0; len = sizeof( CoffIDataSegName ) - 1; if( strnicmp( CoffIDataSegName, name, len ) == 0 ) { SeenDLLRecord(); CurrMod->modinfo |= MOD_IMPORT_LIB; if( name[len + 1] == '6' ) { // it is the segment containg the name ORLSecGetContents( sec, (unsigned_8 **)&ImpExternalName ); ImpExternalName += 2; } else if( name[len + 1] == '4' ) { // it is an import by ordinal ORLSecGetContents( sec, (void *) &contents ); ImpOrdinal = *contents; } sdata->isdead = true; sdata->isidata = true; } sdata->combine = COMBINE_ADD; if( flags & ORL_SEC_FLAG_NO_PADDING ) { sdata->align = 0; } else { sdata->align = ORLSecGetAlignment( sec ); } sdata->is32bit = true; sdata->length = ORLSecGetSize( sec ); sdata->u.name = name; if( flags & ORL_SEC_FLAG_EXEC ) { sdata->iscode = true; } else if( flags & ORL_SEC_FLAG_UNINITIALIZED_DATA ) { sdata->isuninit = true; #ifdef _DEVELOPMENT } else { unsigned namelen; namelen = strlen(name); if( namelen >= 3 && memicmp(name + namelen - 3, "bss", 3) == 0 ) { LnkMsg( ERR+MSG_INTERNAL, "s", "Initialized BSS found" ); } #endif } numlines = ORLSecGetNumLines( sec ); if( numlines > 0 ) { numlines *= sizeof(orl_linnum); DBIAddLines( sdata, ORLSecGetLines( sec ), numlines, true ); } return( ORL_OKAY ); }