Пример #1
0
void ObjRelocsFini( void ) {
//**************************
// If the parse was successful, we need to check whether there're any unmatched
// relocs still hanging around. If there're unmatched h^relocs, we issue an
// error. If there're unmatched l^relocs, we should be able to emit them.

    sym_reloc   reloc;
    sym_handle  sym;
    int_32      numlabel_ref;

    reloc = SymGetReloc( TRUE, &sym );
    while( reloc != NULL ) {
        if( reloc->named ) {
            Error( UNMATCHED_HIGH_RELOC, SymName( sym ) );
        } else {
            // TODO: actually show the numref (eg. 2f)
            Error( UNMATCHED_HIGH_RELOC, "<numeric reference>" );
        }
        SymDestroyReloc( sym, reloc );
        reloc = SymGetReloc( TRUE, &sym );
    }
    reloc = SymGetReloc( FALSE, &sym );
    while( reloc != NULL ) {
        if( reloc->named ) {
            doEmitReloc( reloc->location.section, reloc->location.offset,
                SymName( sym ), OWL_RELOC_HALF_LO, TRUE );
        } else {
            numlabel_ref = AsNumLabelGetNum( SymName( sym ) );
            doEmitReloc( reloc->location.section, reloc->location.offset,
                &numlabel_ref, OWL_RELOC_HALF_LO, FALSE );
        }
        SymDestroyReloc( sym, reloc );
        reloc = SymGetReloc( FALSE, &sym );
    }
#ifdef AS_DEBUG_DUMP
    (void)SymRelocIsClean( TRUE );
#endif
    ObjFlushLabels();       // In case there're still pending labels
    AsNumLabelFini();       // resolve all numeric label relocs
}
Пример #2
0
extern void ObjRelocsFini( void ) {
//*********************************
// After all lines have been parsed, we need to check whether there're any
// unmatched relocs still hanging around. If there're unmatched h^relocs,
// we issue an error. If there're unmatched l^relocs, we should be able
// to emit them.

    sym_reloc   reloc;
    sym_handle  sym;
    int_32      numlabel_ref;

    reloc = SymGetReloc( TRUE, &sym );
    while( reloc != NULL ) {
        if( reloc->named ) {
            Error( UNMATCHED_HIGH_RELOC, SymName( sym ) );
        } else {
            Error( UNMATCHED_HIGH_RELOC, "<numeric reference>" );
        }
        SymDestroyReloc( sym, reloc );
        reloc = SymGetReloc( TRUE, &sym );
    }
    reloc = SymGetReloc( FALSE, &sym );
    while( reloc != NULL ) {
        if( reloc->named ) {
            doEmitReloc( reloc->location.offset,
                SymName( sym ), OWL_RELOC_HALF_LO, TRUE );
        } else {
            numlabel_ref = AsNumLabelGetNum( SymName( sym ) );
            doEmitReloc( reloc->location.offset,
                &numlabel_ref, OWL_RELOC_HALF_LO, FALSE );
        }
        SymDestroyReloc( sym, reloc );
        reloc = SymGetReloc( FALSE, &sym );
    }
#ifdef AS_DEBUG_DUMP
    (void)SymRelocIsClean( TRUE );
#endif
    AsNumLabelFini();       // resolve all numeric label relocs
    resolveRelativeRelocs();
}