Example #1
0
extern void AsNumLabelEmit( uint_32 label_num, owl_section_handle section, owl_offset offset, owl_sym_type type ) {
//*****************************************************************************************************************

    // These symbols are used for matching l^ & h^ garbage.
    sym_handle          new_fw_sym;     // forward
    char                *new_fw_name;
    sym_reloc           reloc;
    int_32              numlabel_ref;

    new_fw_name = AsNumLabelMakeName( label_num );
    new_fw_sym = SymLookup( new_fw_name );
    if( new_fw_sym ) {
        // check if it still has some unemitted relocs
        if( new_fw_sym->hi_relocs ) {
            Error( UNMATCHED_HIGH_RELOC, "<numeric reference>" );
            while( new_fw_sym->hi_relocs ) {
                SymDestroyReloc( new_fw_sym, new_fw_sym->hi_relocs );
            }
        }
        if( new_fw_sym->lo_relocs ) {
            _DBGMSG1( "emitting all the unemitted l^relocs\n" );
            while( ( reloc = new_fw_sym->lo_relocs ) != NULL ) {
                numlabel_ref = AsNumLabelGetNum( SymName( new_fw_sym ) );
                #ifdef _STANDALONE_
                ObjDirectEmitReloc( reloc->location.section,
                #else
                ObjDirectEmitReloc(
                #endif
                  reloc->location.offset, &numlabel_ref, OWL_RELOC_HALF_LO, FALSE );
                SymDestroyReloc( new_fw_sym, reloc );
                reloc = new_fw_sym->lo_relocs;
            }
        }
        assert( new_fw_sym->hi_relocs == NULL && new_fw_sym->lo_relocs == NULL );
    } else {
Example #2
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
}
Example #3
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();
}