Beispiel #1
0
static void doEmitReloc( owl_offset offset, void *target, owl_reloc_type type, bool named_sym ) {
//***********************************************************************************************

    asmreloc    *reloc;
    int_32      label_num;

    if( named_sym ) {
        assert( SymLookup( target ) != NULL );
        reloc = newReloc( offset, target, type );
        if( AsmRelocs == NULL ) {
            AsmRelocs = reloc;
            lastReloc = reloc;
        } else {
            lastReloc->next = reloc;
            lastReloc = reloc;
        }
    } else {
        label_num = *(int_32 *)target;
        AsNumLabelReloc( NULL, offset, label_num, type );
    }
}
Beispiel #2
0
static void doEmitReloc( owl_section_handle section, owl_offset offset,
                         void *target, owl_reloc_type type,
                         bool named_sym ) {
//***************************************************************************************************************************

    obj_section_handle  ref_section;
    sym_handle          sym;
    int_32              label_num;

    if( named_sym ) {
        if( ( ref_section = SectionLookup( target ) ) != NULL ) {
            // We only handle backward reference to a section
            // So we have to define a section before we can refer to it.
            OWLEmitMetaReloc( section, offset, SectionOwlHandle( ref_section ), type );
        } else {
            sym = SymLookup( target );
            assert( sym != NULL );
            OWLEmitReloc( section, offset, SymObjHandle( sym ), type );
        }
    } else {
        label_num = *(int_32 *)target;
        AsNumLabelReloc( section, offset, label_num, type );
    }
}