Exemplo n.º 1
0
Arquivo: asm.c Projeto: machinaut/go
void
shsym(Elf64_Shdr *sh, Sym *s)
{
	sh->addr = symaddr(s);
	sh->off = datoff(sh->addr);
	sh->size = s->size;
}
Exemplo n.º 2
0
Arquivo: pe.c Projeto: rosrad/go-rep
static void
addsymtable(void)
{
	IMAGE_SECTION_HEADER *h;
	int i, size;
	LSym *s;
	
	fh.NumberOfSymbols = sizeof(symlabels)/sizeof(symlabels[0]);
	size = nextsymoff + 4 + 18*fh.NumberOfSymbols;
	h = addpesection(".symtab", size, size);
	h->Characteristics = IMAGE_SCN_MEM_READ|
		IMAGE_SCN_MEM_DISCARDABLE;
	chksectoff(h, cpos());
	fh.PointerToSymbolTable = cpos();
	
	// put COFF symbol table
	for (i=0; i<fh.NumberOfSymbols; i++) {
		s = linkrlookup(ctxt, symlabels[i], 0);
		strnput(s->name, 8);
		lputl(datoff(s->value));
		wputl(textsect);
		wputl(0x0308);  // "array of structs"
		cput(2);        // storage class: external
		cput(0);        // no aux entries
	}

	// put COFF string table
	lputl(nextsymoff + 4);
	for (i=0; i<nextsymoff; i++)
		cput(symnames[i]);
	strnput("", h->SizeOfRawData - size);
}
Exemplo n.º 3
0
void
shsym(ElfShdr *sh, Sym *s)
{
	vlong addr;
	addr = symaddr(s);
	if(sh->flags&SHF_ALLOC)
		sh->addr = addr;
	sh->off = datoff(addr);
	sh->size = s->size;
}