0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-09-22 10:43:39 -04:00

out: Elf32, Elfx32, Elf64 -- more unifications

Some elf_ section numbers may be unused.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov
2016-03-13 13:43:14 +03:00
parent 784d10cb9a
commit d3ec4be590
3 changed files with 11 additions and 14 deletions

View File

@@ -177,12 +177,11 @@ static void dwarf_findsect(const int);
/* /*
* Special NASM section numbers which are used to define ELF special * Special NASM section numbers which are used to define ELF special
* symbols, which can be used with WRT to provide PIC and TLS * symbols.
* relocation types.
*/ */
static int32_t elf_gotpc_sect, elf_gotoff_sect; static int32_t elf_gotpc_sect, elf_gotoff_sect;
static int32_t elf_got_sect, elf_plt_sect; static int32_t elf_got_sect, elf_plt_sect;
static int32_t elf_sym_sect, elf_tlsie_sect; static int32_t elf_sym_sect, elf_gottpoff_sect, elf_tlsie_sect;
static void elf_init(void) static void elf_init(void)
{ {
@@ -297,7 +296,7 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
flags_and = flags_or = type = align = 0; flags_and = flags_or = type = align = 0;
elf_section_attrib(name, p, pass, &flags_and, elf_section_attrib(name, p, pass, &flags_and,
&flags_or, &align, &type); &flags_or, &align, &type);
if (!strcmp(name, ".shstrtab") || if (!strcmp(name, ".shstrtab") ||
!strcmp(name, ".symtab") || !strcmp(name, ".symtab") ||

View File

@@ -177,14 +177,12 @@ static void dwarf_findfile(const char *);
static void dwarf_findsect(const int); static void dwarf_findsect(const int);
/* /*
* Special section numbers which are used to define ELF special * Special NASM section numbers which are used to define ELF special
* symbols, which can be used with WRT to provide PIC relocation * symbols.
* types.
*/ */
static int32_t elf_gotpc_sect, elf_gotoff_sect; static int32_t elf_gotpc_sect, elf_gotoff_sect;
static int32_t elf_got_sect, elf_plt_sect; static int32_t elf_got_sect, elf_plt_sect;
static int32_t elf_sym_sect; static int32_t elf_sym_sect, elf_gottpoff_sect, elf_tlsie_sect;
static int32_t elf_gottpoff_sect;
static void elf_init(void) static void elf_init(void)
{ {
@@ -328,8 +326,8 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
i = elf_make_section(name, type, flags, align); i = elf_make_section(name, type, flags, align);
} else if (pass == 1) { } else if (pass == 1) {
if ((type && sects[i]->type != type) if ((type && sects[i]->type != type)
|| (align && sects[i]->align != align) || (align && sects[i]->align != align)
|| (flags_and && ((sects[i]->flags & flags_and) != flags_or))) || (flags_and && ((sects[i]->flags & flags_and) != flags_or)))
nasm_error(ERR_WARNING, "incompatible section attributes ignored on" nasm_error(ERR_WARNING, "incompatible section attributes ignored on"
" redeclaration of section `%s'", name); " redeclaration of section `%s'", name);
} }

View File

@@ -299,7 +299,7 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
flags_and = flags_or = type = align = 0; flags_and = flags_or = type = align = 0;
elf_section_attrib(name, p, pass, &flags_and, elf_section_attrib(name, p, pass, &flags_and,
&flags_or, &align, &type); &flags_or, &align, &type);
if (!strcmp(name, ".shstrtab") || if (!strcmp(name, ".shstrtab") ||
!strcmp(name, ".symtab") || !strcmp(name, ".symtab") ||
@@ -328,8 +328,8 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
i = elf_make_section(name, type, flags, align); i = elf_make_section(name, type, flags, align);
} else if (pass == 1) { } else if (pass == 1) {
if ((type && sects[i]->type != type) if ((type && sects[i]->type != type)
|| (align && sects[i]->align != align) || (align && sects[i]->align != align)
|| (flags_and && ((sects[i]->flags & flags_and) != flags_or))) || (flags_and && ((sects[i]->flags & flags_and) != flags_or)))
nasm_error(ERR_WARNING, "incompatible section attributes ignored on" nasm_error(ERR_WARNING, "incompatible section attributes ignored on"
" redeclaration of section `%s'", name); " redeclaration of section `%s'", name);
} }