bool AssociationTagDescriptor::verify() const {
	if (getDescriptorTag() != TAG)
		return false;
	
	unsigned use = getUse();
	
	if (use == 0x00) {
		if (getSelectorLength() != 8) {
			return false;
		}
	}
	else if (use == 0x01) {
		if (getSelectorLength() != 0) {
			return false;
		}
	}
	
	return Descriptor::verify();
}
Esempio n. 2
0
static void printMasmHeader( section_ptr sec )
{
    orl_sec_alignment   alignment;
    orl_sec_flags       flags;
    orl_sec_type        type;
    orl_sec_frame       frame;
    orl_sec_combine     combine;
    orl_sec_size        size;
    char                *name;
    char                *class;
    char                *gname;
    char                *astr;
    orl_sec_handle      sh;
    orl_group_handle    grp = NULL;
    char                comname[ MAX_LINE_LEN ];

    size = ORLSecGetSize( sec->shnd );

    // Load all necessary information
    name = sec->name;
    if( !name ) {
        name = "";
    }
    type = ORLSecGetType( sec->shnd );
    flags = ORLSecGetFlags( sec->shnd );
    frame = ORLSecGetAbsFrame( sec->shnd );

    if( DFormat & DFF_ASM ) {
        class = ORLSecGetClassName( sec->shnd );
        if( !class ) {
            class = "";
        }
        if( flags & ORL_SEC_FLAG_COMDAT ) {
            BufferConcat( "; ERROR: Comdat symbols cannot be assembled." );
        } else if( frame == ORL_SEC_NO_ABS_FRAME ) {
            alignment = ORLSecGetAlignment( sec->shnd );
            combine = ORLSecGetCombine( sec->shnd );
            BufferQuoteName( name );
            BufferStore( "\t\tSEGMENT\t%s %s %s '%s'",
                         getAlignment( alignment ), getCombine( combine ),
                         getUse( flags ), class );
        } else {
Esempio n. 3
0
		size_t TemplateBuilder::addUse(const TemplateInst& templateInst) {
			assert(!templateInst.arguments().empty());
			
			const auto existingId = getUse(templateInst);
			if (existingId) {
				return existingId.value();
			}
			
			const size_t nextId = templateUseMap_.size();
			templateUseMap_.insert(std::make_pair(templateInst.copy(), nextId));
			
			const auto arguments = templateInst.arguments();
			
			const auto objectTemplateVars = object_.templateVariables();
			if (arguments.size() == objectTemplateVars.size() &&
			    templateInst.allArgumentsAreTemplateVars(objectTemplateVars)) {
				// If we're passing our own template arguments to
				// something else unchanged, then we could apply
				// the 'pass-through optimisation', which effectively
				// means we don't need to allocate any space on
				// the path and just call directly down to the
				// next template generator.
				// 
				// Note that this only works if there's exaclty
				// one template call, hence it's just considered
				// a 'candidate' at this point.
				isPassThroughOptimisationCandidate_ = true;
			}
			
			for (const auto& arg: arguments) {
				if (arg.isTypeRef()) {
					const auto typeArg = arg.typeRefType();
					if (typeArg->isObject() && !typeArg->templateArguments().empty()) {
						(void) addUse(TemplateInst::Type(typeArg));
					}
				}
			}
			
			return nextId;
		}
Esempio n. 4
0
     if( !class ) {
         class = "";
     }
     if( flags & ORL_SEC_FLAG_COMDAT ) {
         BufferConcat( "; ERROR: Comdat symbols cannot be assembled." );
     } else if( frame == ORL_SEC_NO_ABS_FRAME ) {
         alignment = ORLSecGetAlignment( sec->shnd );
         combine = ORLSecGetCombine( sec->shnd );
         BufferQuoteName( name );
         BufferStore( "\t\tSEGMENT\t%s %s %s '%s'",
                      getAlignment( alignment ), getCombine( combine ),
                      getUse( flags ), class );
     } else {
         BufferQuoteName( name );
         BufferStore( "\t\tSEGMENT\t at %08X %s '%s'", (unsigned)frame << 4,
                      getUse( flags ), class );
     }
 } else {
     if( flags & ORL_SEC_FLAG_COMDAT ) {
         if( Options & NODEMANGLE_NAMES ) {
             strncpy( comname, name, MAX_LINE_LEN );
         } else {
             __demangle_l( name, 0, comname, MAX_LINE_LEN );
         }
         combine = ORLSecGetCombine( sec->shnd );
         if( ( combine & ORL_SEC_COMBINE_COMDAT_ALLOC_MASK ) ==
                                      ORL_SEC_COMBINE_COMDAT_ALLOC_EXPLIC ) {
             sh = ORLSecGetAssociated( sec->shnd );
             grp = ORLSecGetGroup( sec->shnd );
             astr = "SEGMENT";
         } else {
bool AssociationTagDescriptor::hasTransactionId() const {
	return getUse() == 0x00;
}