Alien-TinyCCx
view release on metacpan or search on metacpan
src/tccpe.c view on Meta::CPAN
continue;
}
}
not_found:
tcc_error_noabort("undefined symbol '%s'", name);
ret = -1;
} else if (pe->s1->rdynamic
&& ELFW(ST_BIND)(sym->st_info) != STB_LOCAL) {
/* if -rdynamic option, then export all non local symbols */
sym->st_other |= ST_PE_EXPORT;
}
}
return ret;
}
/*----------------------------------------------------------------------------*/
#ifdef PE_PRINT_SECTIONS
static void pe_print_section(FILE * f, Section * s)
{
/* just if you'r curious */
BYTE *p, *e, b;
int i, n, l, m;
p = s->data;
e = s->data + s->data_offset;
l = e - p;
fprintf(f, "section \"%s\"", s->name);
if (s->link)
fprintf(f, "\nlink \"%s\"", s->link->name);
if (s->reloc)
fprintf(f, "\nreloc \"%s\"", s->reloc->name);
fprintf(f, "\nv_addr %08X", (unsigned)s->sh_addr);
fprintf(f, "\ncontents %08X", (unsigned)l);
fprintf(f, "\n\n");
if (s->sh_type == SHT_NOBITS)
return;
if (0 == l)
return;
if (s->sh_type == SHT_SYMTAB)
m = sizeof(ElfW(Sym));
else if (s->sh_type == SHT_RELX)
m = sizeof(ElfW_Rel);
else
m = 16;
fprintf(f, "%-8s", "offset");
for (i = 0; i < m; ++i)
fprintf(f, " %02x", i);
n = 56;
if (s->sh_type == SHT_SYMTAB || s->sh_type == SHT_RELX) {
const char *fields1[] = {
"name",
"value",
"size",
"bind",
"type",
"other",
"shndx",
NULL
};
const char *fields2[] = {
"offs",
"type",
"symb",
NULL
};
const char **p;
if (s->sh_type == SHT_SYMTAB)
p = fields1, n = 106;
else
p = fields2, n = 58;
for (i = 0; p[i]; ++i)
fprintf(f, "%6s", p[i]);
fprintf(f, " symbol");
}
fprintf(f, "\n");
for (i = 0; i < n; ++i)
fprintf(f, "-");
fprintf(f, "\n");
for (i = 0; i < l;)
{
fprintf(f, "%08X", i);
for (n = 0; n < m; ++n) {
if (n + i < l)
fprintf(f, " %02X", p[i + n]);
else
fprintf(f, " ");
}
if (s->sh_type == SHT_SYMTAB) {
ElfW(Sym) *sym = (ElfW(Sym) *) (p + i);
const char *name = s->link->data + sym->st_name;
fprintf(f, " %04X %04X %04X %02X %02X %02X %04X \"%s\"",
(unsigned)sym->st_name,
(unsigned)sym->st_value,
(unsigned)sym->st_size,
(unsigned)ELFW(ST_BIND)(sym->st_info),
(unsigned)ELFW(ST_TYPE)(sym->st_info),
(unsigned)sym->st_other,
(unsigned)sym->st_shndx,
name);
} else if (s->sh_type == SHT_RELX) {
ElfW_Rel *rel = (ElfW_Rel *) (p + i);
ElfW(Sym) *sym =
(ElfW(Sym) *) s->link->data + ELFW(R_SYM)(rel->r_info);
const char *name = s->link->link->data + sym->st_name;
fprintf(f, " %04X %02X %04X \"%s\"",
(unsigned)rel->r_offset,
( run in 0.840 second using v1.01-cache-2.11-cpan-2398b32b56e )