亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tccelf.c

?? 小而快的c編譯器
?? C
?? 第 1 頁 / 共 5 頁
字號(hào):
/* *  ELF file handling for TCC *  *  Copyright (c) 2001, 2002 Fabrice Bellard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */static int put_elf_str(Section *s, const char *sym){    int offset, len;    char *ptr;    len = strlen(sym) + 1;    offset = s->data_offset;    ptr = section_ptr_add(s, len);    memcpy(ptr, sym, len);    return offset;}/* elf symbol hashing function */static unsigned long elf_hash(const unsigned char *name){    unsigned long h = 0, g;        while (*name) {        h = (h << 4) + *name++;        g = h & 0xf0000000;        if (g)            h ^= g >> 24;        h &= ~g;    }    return h;}/* rebuild hash table of section s *//* NOTE: we do factorize the hash table code to go faster */static void rebuild_hash(Section *s, unsigned int nb_buckets){    Elf32_Sym *sym;    int *ptr, *hash, nb_syms, sym_index, h;    char *strtab;    strtab = s->link->data;    nb_syms = s->data_offset / sizeof(Elf32_Sym);    s->hash->data_offset = 0;    ptr = section_ptr_add(s->hash, (2 + nb_buckets + nb_syms) * sizeof(int));    ptr[0] = nb_buckets;    ptr[1] = nb_syms;    ptr += 2;    hash = ptr;    memset(hash, 0, (nb_buckets + 1) * sizeof(int));    ptr += nb_buckets + 1;    sym = (Elf32_Sym *)s->data + 1;    for(sym_index = 1; sym_index < nb_syms; sym_index++) {        if (ELF32_ST_BIND(sym->st_info) != STB_LOCAL) {            h = elf_hash(strtab + sym->st_name) % nb_buckets;            *ptr = hash[h];            hash[h] = sym_index;        } else {            *ptr = 0;        }        ptr++;        sym++;    }}/* return the symbol number */static int put_elf_sym(Section *s,                        unsigned long value, unsigned long size,                       int info, int other, int shndx, const char *name){    int name_offset, sym_index;    int nbuckets, h;    Elf32_Sym *sym;    Section *hs;        sym = section_ptr_add(s, sizeof(Elf32_Sym));    if (name)        name_offset = put_elf_str(s->link, name);    else        name_offset = 0;    /* XXX: endianness */    sym->st_name = name_offset;    sym->st_value = value;    sym->st_size = size;    sym->st_info = info;    sym->st_other = other;    sym->st_shndx = shndx;    sym_index = sym - (Elf32_Sym *)s->data;    hs = s->hash;    if (hs) {        int *ptr, *base;        ptr = section_ptr_add(hs, sizeof(int));        base = (int *)hs->data;        /* only add global or weak symbols */        if (ELF32_ST_BIND(info) != STB_LOCAL) {            /* add another hashing entry */            nbuckets = base[0];            h = elf_hash(name) % nbuckets;            *ptr = base[2 + h];            base[2 + h] = sym_index;            base[1]++;            /* we resize the hash table */            hs->nb_hashed_syms++;            if (hs->nb_hashed_syms > 2 * nbuckets) {                rebuild_hash(s, 2 * nbuckets);            }        } else {            *ptr = 0;            base[1]++;        }    }    return sym_index;}/* find global ELF symbol 'name' and return its index. Return 0 if not   found. */static int find_elf_sym(Section *s, const char *name){    Elf32_Sym *sym;    Section *hs;    int nbuckets, sym_index, h;    const char *name1;        hs = s->hash;    if (!hs)        return 0;    nbuckets = ((int *)hs->data)[0];    h = elf_hash(name) % nbuckets;    sym_index = ((int *)hs->data)[2 + h];    while (sym_index != 0) {        sym = &((Elf32_Sym *)s->data)[sym_index];        name1 = s->link->data + sym->st_name;        if (!strcmp(name, name1))            return sym_index;        sym_index = ((int *)hs->data)[2 + nbuckets + sym_index];    }    return 0;}/* return elf symbol value or error */int tcc_get_symbol(TCCState *s, unsigned long *pval, const char *name){    int sym_index;    Elf32_Sym *sym;        sym_index = find_elf_sym(symtab_section, name);    if (!sym_index)        return -1;    sym = &((Elf32_Sym *)symtab_section->data)[sym_index];    *pval = sym->st_value;    return 0;}void *tcc_get_symbol_err(TCCState *s, const char *name){    unsigned long val;    if (tcc_get_symbol(s, &val, name) < 0)        error("%s not defined", name);    return (void *)val;}/* add an elf symbol : check if it is already defined and patch   it. Return symbol index. NOTE that sh_num can be SHN_UNDEF. */static int add_elf_sym(Section *s, unsigned long value, unsigned long size,                       int info, int sh_num, const char *name){    Elf32_Sym *esym;    int sym_bind, sym_index, sym_type, esym_bind;    sym_bind = ELF32_ST_BIND(info);    sym_type = ELF32_ST_TYPE(info);            if (sym_bind != STB_LOCAL) {        /* we search global or weak symbols */        sym_index = find_elf_sym(s, name);        if (!sym_index)            goto do_def;        esym = &((Elf32_Sym *)s->data)[sym_index];        if (esym->st_shndx != SHN_UNDEF) {            esym_bind = ELF32_ST_BIND(esym->st_info);            if (sh_num == SHN_UNDEF) {                /* ignore adding of undefined symbol if the                   corresponding symbol is already defined */            } else if (sym_bind == STB_GLOBAL && esym_bind == STB_WEAK) {                /* global overrides weak, so patch */                goto do_patch;            } else if (sym_bind == STB_WEAK && esym_bind == STB_GLOBAL) {                /* weak is ignored if already global */            } else {#if 0                printf("new_bind=%d new_shndx=%d last_bind=%d old_shndx=%d\n",                       sym_bind, sh_num, esym_bind, esym->st_shndx);#endif                /* NOTE: we accept that two DLL define the same symbol */                if (s != tcc_state->dynsymtab_section)                    error_noabort("'%s' defined twice", name);            }        } else {        do_patch:            esym->st_info = ELF32_ST_INFO(sym_bind, sym_type);            esym->st_shndx = sh_num;            esym->st_value = value;            esym->st_size = size;        }    } else {    do_def:        sym_index = put_elf_sym(s, value, size,                                 ELF32_ST_INFO(sym_bind, sym_type), 0,                                 sh_num, name);    }    return sym_index;}/* put relocation */static void put_elf_reloc(Section *symtab, Section *s, unsigned long offset,                          int type, int symbol){    char buf[256];    Section *sr;    Elf32_Rel *rel;    sr = s->reloc;    if (!sr) {        /* if no relocation section, create it */        snprintf(buf, sizeof(buf), ".rel%s", s->name);        /* if the symtab is allocated, then we consider the relocation           are also */        sr = new_section(tcc_state, buf, SHT_REL, symtab->sh_flags);        sr->sh_entsize = sizeof(Elf32_Rel);        sr->link = symtab;        sr->sh_info = s->sh_num;        s->reloc = sr;    }    rel = section_ptr_add(sr, sizeof(Elf32_Rel));    rel->r_offset = offset;    rel->r_info = ELF32_R_INFO(symbol, type);}/* put stab debug information */typedef struct {    unsigned long n_strx;         /* index into string table of name */    unsigned char n_type;         /* type of symbol */    unsigned char n_other;        /* misc info (usually empty) */    unsigned short n_desc;        /* description field */    unsigned long n_value;        /* value of symbol */} Stab_Sym;static void put_stabs(const char *str, int type, int other, int desc,                       unsigned long value){    Stab_Sym *sym;    sym = section_ptr_add(stab_section, sizeof(Stab_Sym));    if (str) {        sym->n_strx = put_elf_str(stabstr_section, str);    } else {        sym->n_strx = 0;    }    sym->n_type = type;    sym->n_other = other;    sym->n_desc = desc;    sym->n_value = value;}static void put_stabs_r(const char *str, int type, int other, int desc,                         unsigned long value, Section *sec, int sym_index){    put_stabs(str, type, other, desc, value);    put_elf_reloc(symtab_section, stab_section,                   stab_section->data_offset - sizeof(unsigned long),                  R_DATA_32, sym_index);}static void put_stabn(int type, int other, int desc, int value){    put_stabs(NULL, type, other, desc, value);}static void put_stabd(int type, int other, int desc){    put_stabs(NULL, type, other, desc, 0);}/* In an ELF file symbol table, the local symbols must appear below   the global and weak ones. Since TCC cannot sort it while generating   the code, we must do it after. All the relocation tables are also   modified to take into account the symbol table sorting */static void sort_syms(TCCState *s1, Section *s){    int *old_to_new_syms;    Elf32_Sym *new_syms;    int nb_syms, i;    Elf32_Sym *p, *q;    Elf32_Rel *rel, *rel_end;    Section *sr;    int type, sym_index;    nb_syms = s->data_offset / sizeof(Elf32_Sym);    new_syms = tcc_malloc(nb_syms * sizeof(Elf32_Sym));    old_to_new_syms = tcc_malloc(nb_syms * sizeof(int));    /* first pass for local symbols */    p = (Elf32_Sym *)s->data;    q = new_syms;    for(i = 0; i < nb_syms; i++) {        if (ELF32_ST_BIND(p->st_info) == STB_LOCAL) {            old_to_new_syms[i] = q - new_syms;            *q++ = *p;        }        p++;    }    /* save the number of local symbols in section header */    s->sh_info = q - new_syms;    /* then second pass for non local symbols */    p = (Elf32_Sym *)s->data;    for(i = 0; i < nb_syms; i++) {        if (ELF32_ST_BIND(p->st_info) != STB_LOCAL) {            old_to_new_syms[i] = q - new_syms;            *q++ = *p;        }        p++;    }        /* we copy the new symbols to the old */    memcpy(s->data, new_syms, nb_syms * sizeof(Elf32_Sym));    tcc_free(new_syms);    /* now we modify all the relocations */    for(i = 1; i < s1->nb_sections; i++) {        sr = s1->sections[i];        if (sr->sh_type == SHT_REL && sr->link == s) {            rel_end = (Elf32_Rel *)(sr->data + sr->data_offset);            for(rel = (Elf32_Rel *)sr->data;                rel < rel_end;                rel++) {                sym_index = ELF32_R_SYM(rel->r_info);                type = ELF32_R_TYPE(rel->r_info);                sym_index = old_to_new_syms[sym_index];                rel->r_info = ELF32_R_INFO(sym_index, type);            }        }    }        tcc_free(old_to_new_syms);}/* relocate common symbols in the .bss section */static void relocate_common_syms(void){    Elf32_Sym *sym, *sym_end;    unsigned long offset, align;        sym_end = (Elf32_Sym *)(symtab_section->data + symtab_section->data_offset);    for(sym = (Elf32_Sym *)symtab_section->data + 1;         sym < sym_end;        sym++) {        if (sym->st_shndx == SHN_COMMON) {            /* align symbol */            align = sym->st_value;            offset = bss_section->data_offset;            offset = (offset + align - 1) & -align;            sym->st_value = offset;            sym->st_shndx = bss_section->sh_num;            offset += sym->st_size;            bss_section->data_offset = offset;        }    }}static void *resolve_sym(const char *sym){    return dlsym(RTLD_DEFAULT, sym);}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美天堂一区二区三区| 久久婷婷一区二区三区| 26uuu国产一区二区三区 | 国内精品久久久久影院色| 欧美日韩国产高清一区二区| 亚洲尤物在线视频观看| 97久久超碰精品国产| 国产精品水嫩水嫩| 国产成a人亚洲| 国产午夜亚洲精品理论片色戒| 国产高清精品在线| 亚洲欧洲日产国码二区| 91免费小视频| 日日夜夜精品视频免费| 欧美一区二区不卡视频| 久久精品国产在热久久| 国产日韩影视精品| 91免费小视频| 成人综合婷婷国产精品久久| 亚洲男人的天堂av| 欧美又粗又大又爽| 视频一区二区欧美| 亚洲国产精品麻豆| 精品国产麻豆免费人成网站| 国产成人精品免费在线| 蜜乳av一区二区| 欧美激情一区二区三区蜜桃视频| 99re66热这里只有精品3直播| 国产成人免费9x9x人网站视频| 久久99精品国产| 亚洲自拍偷拍麻豆| 亚洲精品国产品国语在线app| 日韩欧美国产一区二区在线播放| 国产99久久久久| 国产美女娇喘av呻吟久久| 一区二区三区精品视频在线| 精品久久久久久久人人人人传媒 | 精品一区二区三区日韩| 日本在线不卡视频| 中文字幕欧美一| 国产精品国产三级国产有无不卡| 欧美精品国产精品| 91丨九色丨国产丨porny| 成av人片一区二区| 男人的j进女人的j一区| 亚洲精品少妇30p| 亚洲一区视频在线观看视频| 亚洲国产精品久久一线不卡| 亚洲成人在线免费| 一区视频在线播放| 亚洲男人的天堂网| 亚洲18女电影在线观看| 青青草国产精品亚洲专区无| 美女性感视频久久| 国产资源在线一区| 懂色一区二区三区免费观看| 91麻豆国产福利在线观看| 色天使久久综合网天天| 国产麻豆日韩欧美久久| 9人人澡人人爽人人精品| 麻豆91在线播放免费| 高清不卡在线观看| 色妞www精品视频| 国产精一品亚洲二区在线视频| 亚洲一区二区欧美激情| 青娱乐精品在线视频| 国产精品主播直播| 色老头久久综合| 欧美一级精品在线| 欧美精品三级日韩久久| 26uuu色噜噜精品一区| 国产精品久久免费看| 亚洲国产精品久久艾草纯爱| 久久狠狠亚洲综合| 色妞www精品视频| 欧美zozo另类异族| 尤物在线观看一区| 激情综合色播激情啊| 在线免费亚洲电影| 精品国精品国产| 亚洲福利一区二区三区| 国产精品99久久久| 欧美日韩亚洲另类| 5566中文字幕一区二区电影| 91精品一区二区三区在线观看| 久久久亚洲精品石原莉奈| 精品国产91洋老外米糕| 亚洲黄色在线视频| 黄色日韩网站视频| 欧美性受极品xxxx喷水| 久久精品人人爽人人爽| 亚洲成人激情社区| 成人精品小蝌蚪| 精品噜噜噜噜久久久久久久久试看| 亚洲天堂福利av| 亚洲综合激情另类小说区| 国产成人免费xxxxxxxx| 欧美一区二区视频免费观看| 亚洲精品乱码久久久久久黑人 | 久久一夜天堂av一区二区三区| 亚洲啪啪综合av一区二区三区| 久久超碰97人人做人人爱| 欧洲亚洲精品在线| 国产精品白丝在线| 国产精品一卡二卡| 日韩欧美久久久| 亚洲电影你懂得| 在线免费一区三区| 亚洲人成网站影音先锋播放| 国产不卡在线播放| 精品日韩一区二区| 日韩不卡一二三区| 欧美日韩精品免费观看视频| 中文字幕在线不卡| 国产成人高清视频| 久久综合99re88久久爱| 青青青伊人色综合久久| 欧美一区二区三区在线| 亚洲国产精品久久艾草纯爱| 色94色欧美sute亚洲线路二| 国产精品拍天天在线| 国产成人日日夜夜| 日本一区二区三区在线观看| 精品一区二区三区日韩| 精品久久人人做人人爽| 久久99国产精品久久99果冻传媒| 欧美日韩国产欧美日美国产精品| 夜夜精品浪潮av一区二区三区| 99国产欧美久久久精品| 亚洲欧洲日产国产综合网| www.成人在线| 亚洲三级在线免费观看| 97精品久久久久中文字幕 | 亚洲不卡一区二区三区| 欧美在线免费观看视频| 亚洲影视在线播放| 欧美三级午夜理伦三级中视频| 亚洲综合色婷婷| 欧美日韩中文精品| 午夜国产精品影院在线观看| 成人午夜av电影| 中文字幕一区二区三区不卡 | 视频精品一区二区| 欧美一区二区三区色| 卡一卡二国产精品| 久久久精品国产99久久精品芒果| 九一久久久久久| 国产蜜臀av在线一区二区三区| 国产成人精品亚洲777人妖| 国产精品嫩草久久久久| 91影院在线免费观看| 亚洲一区免费在线观看| 欧美精品v国产精品v日韩精品 | 26uuu精品一区二区三区四区在线| 紧缚奴在线一区二区三区| 久久久亚洲精品石原莉奈| 欧美久久久久久久久久| 美女国产一区二区| 国产午夜精品福利| 色综合久久久久网| 偷拍一区二区三区四区| 精品久久久久久久久久久院品网| 丁香网亚洲国际| 亚洲自拍偷拍网站| 精品播放一区二区| 99久久国产综合色|国产精品| 亚洲国产精品麻豆| 久久亚洲私人国产精品va媚药| 成人av免费观看| 日本在线不卡视频一二三区| 日本一区二区在线不卡| 欧美日韩国产在线播放网站| 国产老妇另类xxxxx| 夜夜亚洲天天久久| 久久久久久久久免费| 欧美午夜片在线看| 国产成人综合精品三级| 亚洲国产一区二区在线播放| 精品国产乱码久久| 色婷婷久久久综合中文字幕 | 最新成人av在线| 69av一区二区三区| 成人美女在线视频| 日韩国产精品久久久| 国产精品理论在线观看| 91精品国产免费久久综合| 99久久精品国产导航| 激情综合色综合久久综合| 亚洲久草在线视频| 久久久久久久久久久99999| 欧美日韩综合在线免费观看| 成人一区在线看| 免费成人美女在线观看| 一卡二卡三卡日韩欧美| 国产三级欧美三级日产三级99 | 久久精品亚洲麻豆av一区二区| 欧美三级三级三级爽爽爽| 大胆亚洲人体视频| 日本三级韩国三级欧美三级| 综合久久一区二区三区|