コード例 #1
0
ファイル: execfile.c プロジェクト: wodz/open21xx
void add_one_object( const char *name )
{
    OBJECT_FILE *file;
    OBJECT_FILE **save;
    int available;

    file = object_open( name );
    if (file)
    {
        save = array_alloc( &link_array, &available );
        *save = file;
        array_update( &link_array, 1 );
    }
}
コード例 #2
0
ファイル: array_int.c プロジェクト: MagicalTux/cloudconnector
bool array_update_int(array_t *array, uint64_t key, void *value) {
	return array_update(array, 8, (uint8_t*)&key, value, true);
}
コード例 #3
0
ファイル: array_int.c プロジェクト: MagicalTux/cloudconnector
bool array_update_int(array_t *array, uint64_t key, void *value) {
	MAKE_KEY_BIGENDIAN();
	return array_update(array, 8, (uint8_t*)&real_key, value, true);
}
コード例 #4
0
ファイル: execfile.c プロジェクト: wodz/open21xx
int add_object_sections(NAME_LIST *section_name_list)
{
    OBJECT_FILE **current;
    Elf_Scn *elf_section;
    Elf32_Shdr *shdr;
    NAME_LIST *section_name;
    Elf_Scn **array;
    int scns_available;
    int scns_added;
    array_index_t link_index;
    int page_links;
    const char *input_name;

    scns_added = scns_available = 0;
    array = NULL;
    array_index_init( &link_index, &link_array );
    current = (OBJECT_FILE **)array_index_next_page(
        &link_index, &page_links );
    while (current)
    {
        elf_section = NULL;
        while ((elf_section = elf_nextscn((*current)->elf, elf_section)) != 0)
        {
            shdr = elf32_getshdr(elf_section);
            elfcheck( shdr != NULL );
            if ( shdr->sh_type == SHT_PROGBITS ||
                 shdr->sh_type == SHT_NOBITS )
            {
                input_name = (*current)->strings+shdr->sh_name;
                for ( section_name = section_name_list ; section_name ;
                      section_name = section_name->next )
                {
                    if (strcmp( input_name, section_name->name) == 0)
                    {
                        if ((shdr->sh_flags & SHF_REFERENCED) == 0)
                        {
                            if ( scns_added >= scns_available )
                            {
                                array_update( &scn_array, scns_added );
                                scns_added = 0;
                                array = array_alloc( &scn_array,
                                                     &scns_available );
                            }
                            *array++ = elf_section;
                            ++scns_added;
//                            elf_flagshdr( elf_section, ELF_C_SET, SHF_REFERENCED );
                            shdr->sh_flags |= SHF_REFERENCED;
                        }
                        else
                        {
                            yyerror( "Input section is referenced twice" );
                        }
                        break;
                    }
                }
            }
        }
        ++current;
        if ( --page_links == 0 )
        {
            current = (OBJECT_FILE **)array_index_next_page(
                &link_index, &page_links );
        }
    }
    array_update( &scn_array, scns_added );
    return 1;
}