예제 #1
0
static bool SearchAndProcLibFile( file_list *lib, char *name )
/************************************************************/
{
    mod_entry       *lp;
    mod_entry       **prev;

    if( !CacheOpen( lib ) )
        return( FALSE );
    lp = SearchLib( lib, name );
    if( lp == NULL ) {
        CacheClose( lib, 1 );
        return( FALSE );
    }
    lib->status |= STAT_LIB_USED;
    if( (FmtData.type & MK_OVERLAYS) && FmtData.u.dos.distribute ) {
        if( lib->status & STAT_LIB_FIXED ) {
            lp->modinfo |= MOD_FIXED;
        }
        AddModTable( lp, lib->ovlref );
    } else {
        for( prev = &LibModules; *prev != NULL; ) { /*  find end of list */
            prev = &(*prev)->n.next_mod;
        }
        *prev = lp;
    }
    CurrMod = lp;
    ObjPass1();
    CacheClose( lib, 1 );
    if( (FmtData.type & MK_OVERLAYS) && FmtData.u.dos.distribute ) {
        FinishArcs( lp );
    }
    if( FindLibTrace( lp ) ) {
        TraceSymList( lp->publist );
    }
    return( TRUE );
}
예제 #2
0
static void DoPass1( mod_entry *next, file_list *list )
/*****************************************************/
/* do pass 1 on the object file */
{
    member_list         *member;
    char                *membname;
    unsigned long       loc;
    unsigned long       size;
    unsigned            reclength;
    bool                lastmod;
    bool                ignoreobj;

    loc = 0;
    lastmod = FALSE;
    if( CacheOpen( list ) ) {
        reclength = CheckLibraryType( list, &loc, FALSE );
        for( ;; ) { /*  there may be more than 1 object module in a file */
            member = NULL;
            ignoreobj = FALSE;
            if( EndOfLib( list, loc ) )
                break;
            membname = IdentifyObject( list, &loc, &size );
            if( list->status & STAT_IS_LIB ) {
                if( (list->status & STAT_HAS_MEMBER) && list->u.member != NULL ) {
                    member = FindMember( list, membname );
                    if( member == NULL ) {
                        ignoreobj = TRUE;
                    } else if( list->u.member == NULL ) {
                        lastmod = TRUE;
                    }
                }
            }
            if( ignoreobj ) {
                _LnkFree( membname );
                if( size != 0 ) {
                    loc += size;
                } else {
                    SkipFile( list, &loc );
                }
            } else {
                if( next == NULL ) {
                    next = NewModEntry();
                }
                next->n.next_mod = NULL;
                next->f.source = list;
                next->modtime = next->f.source->file->modtime;
                next->modinfo |= ObjFormat & FMT_OBJ_FMT_MASK;
                if( member != NULL ) {
                    next->modinfo |= member->flags;
                    _LnkFree( member );
                }
                if( !(list->status & STAT_HAS_MEMBER) ) {
                    next->modinfo |= list->status & DBI_MASK;
                    if( list->status & STAT_LAST_SEG ) {
                        next->modinfo |= MOD_LAST_SEG;
                    }
                }
                AddToModList( next );
                next->location = loc;
                if( membname == NULL ) {
                    membname = ChkStrDup( list->file->name );
                }
                next->name = membname;
                loc = ObjPass1();
                if( list->status & STAT_TRACE_SYMS ) {
                    TraceSymList( CurrMod->publist );
                }
                next = NULL;
            }
            ObjFormat = 0;
            if( list->status & STAT_IS_LIB ) {             // skip padding.
                loc += CalcAlign( loc, reclength );
            } else if( !IS_FMT_OMF( CurrMod->modinfo ) ) {
                break;          // can only concat omf.
            }
            if( lastmod || CacheEnd( list, loc ) ) {
                break;
            }
        }
        if( list->u.member != NULL ) {
            LnkMsg( ERR+MSG_CANT_FIND_MEMBER, "12", list->file->name,
                                                    list->u.member->name );
        }
        CacheClose( list, 1 );
    }
    CheckStop();
}