mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
Elf: Some unification snippets for 32/64 bit versions
Nothing serious, comments and style movements. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
e3c4791300
commit
f134cc63da
@ -341,7 +341,6 @@ static int elf_make_section(char *name, int type, int flags, int align)
|
||||
return nsects - 1;
|
||||
}
|
||||
|
||||
|
||||
static int32_t elf_section_names(char *name, int pass, int *bits)
|
||||
{
|
||||
char *p;
|
||||
@ -394,7 +393,7 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
|
||||
if ((type && sects[i]->type != type)
|
||||
|| (align && sects[i]->align != align)
|
||||
|| (flags_and && ((sects[i]->flags & flags_and) != flags_or)))
|
||||
nasm_error(ERR_WARNING, "section attributes ignored on"
|
||||
nasm_error(ERR_WARNING, "incompatible section attributes ignored on"
|
||||
" redeclaration of section `%s'", name);
|
||||
}
|
||||
|
||||
@ -1008,12 +1007,12 @@ static void elf_write(void)
|
||||
|
||||
/* .symtab */
|
||||
elf_section_header(p - shstrtab, SHT_SYMTAB, 0, symtab, true,
|
||||
symtablen, sec_strtab, symtablocal, 4, 16);
|
||||
symtablen, sec_strtab, symtablocal, 4, 16);
|
||||
p += strlen(p) + 1;
|
||||
|
||||
/* .strtab */
|
||||
elf_section_header(p - shstrtab, SHT_STRTAB, 0, strs, true,
|
||||
strslen, 0, 0, 1, 0);
|
||||
strslen, 0, 0, 1, 0);
|
||||
p += strlen(p) + 1;
|
||||
|
||||
/* The relocation sections */
|
||||
@ -1042,7 +1041,7 @@ static void elf_write(void)
|
||||
|
||||
/* link -> symtable info -> section to refer to */
|
||||
elf_section_header(p - shstrtab, SHT_REL, 0, stabrelbuf, false,
|
||||
stabrellen, sec_symtab, sec_stab, 4, 8);
|
||||
stabrellen, sec_symtab, sec_stab, 4, 8);
|
||||
p += strlen(p) + 1;
|
||||
}
|
||||
} else if (of_elf32.current_dfmt == &df_dwarf) {
|
||||
@ -1551,7 +1550,7 @@ static void stabs32_output(int type, void *param)
|
||||
if (debug_immcall) {
|
||||
s = (struct symlininfo *)param;
|
||||
if (!(sects[s->section]->flags & SHF_EXECINSTR))
|
||||
return; /* we are only interested in the text stuff */
|
||||
return; /* line info is only collected for executable sections */
|
||||
numlinestabs++;
|
||||
el = (struct linelist *)nasm_malloc(sizeof(struct linelist));
|
||||
el->info.offset = s->offset;
|
||||
|
@ -60,6 +60,9 @@
|
||||
|
||||
#ifdef OF_ELF64
|
||||
|
||||
/*
|
||||
* Relocation types.
|
||||
*/
|
||||
struct Reloc {
|
||||
struct Reloc *next;
|
||||
int64_t address; /* relative to _start_ of section */
|
||||
@ -104,7 +107,7 @@ static char *shstrtab;
|
||||
static int shstrtablen, shstrtabsize;
|
||||
|
||||
static struct SAA *syms;
|
||||
static uint32_t nlocals, nglobs, ndebugs;
|
||||
static uint32_t nlocals, nglobs, ndebugs; /* Symbol counts */
|
||||
|
||||
static int32_t def_seg;
|
||||
|
||||
@ -245,7 +248,7 @@ static void elf_init(void)
|
||||
bsym = raa_init();
|
||||
strs = saa_init(1L);
|
||||
saa_wbytes(strs, "\0", 1L);
|
||||
saa_wbytes(strs, elf_module, (int32_t)(strlen(elf_module) + 1));
|
||||
saa_wbytes(strs, elf_module, strlen(elf_module)+1);
|
||||
strslen = 2 + strlen(elf_module);
|
||||
shstrtab = NULL;
|
||||
shstrtablen = shstrtabsize = 0;;
|
||||
@ -762,7 +765,8 @@ static void elf_out(int32_t segto, const void *data,
|
||||
i = nsects - 1;
|
||||
}
|
||||
}
|
||||
/* invoke current debug_output routine */
|
||||
|
||||
/* again some stabs debugging stuff */
|
||||
if (of_elf64.current_dfmt) {
|
||||
sinfo.offset = s->len;
|
||||
sinfo.section = i;
|
||||
@ -1132,8 +1136,7 @@ static void elf_write(void)
|
||||
stabrellen, symtabsection, sec_stab, 4, 16);
|
||||
p += strlen(p) + 1;
|
||||
}
|
||||
}
|
||||
else if (of_elf64.current_dfmt == &df_dwarf) {
|
||||
} else if (of_elf64.current_dfmt == &df_dwarf) {
|
||||
/* for dwarf debugging information, create the ten dwarf sections */
|
||||
|
||||
/* this function call creates the dwarf sections in memory */
|
||||
|
Loading…
Reference in New Issue
Block a user