Elf: Allow symbols binding to undefined section

Commit 2ddcd03900
did bind symbols (in case of omitted SECTION directive)
to .text section but break COMMON binding.
Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2010-01-02 23:00:43 +03:00
parent 3e73cfc8b7
commit 3b4c769d99
2 changed files with 4 additions and 8 deletions

View File

@ -526,17 +526,15 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
if (segment == def_seg) {
/* we have to be sure at least text section is there */
int tempint;
elf_section_names(".text", 2, &tempint);
if (segment != elf_section_names(".text", 2, &tempint))
nasm_error(ERR_PANIC, "strange segment conditions in ELF driver");
}
sym->section = nsects;
for (i = 0; i < nsects; i++) {
if (segment == sects[i]->index) {
sym->section = i + 1;
break;
}
}
if (nsects && i == nsects)
nasm_error(ERR_PANIC, "strange segment conditions in ELF driver");
}
if (is_global == 2) {

View File

@ -530,17 +530,15 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
if (segment == def_seg) {
/* we have to be sure at least text section is there */
int tempint;
elf_section_names(".text", 2, &tempint);
if (segment != elf_section_names(".text", 2, &tempint))
nasm_error(ERR_PANIC, "strange segment conditions in ELF driver");
}
sym->section = nsects;
for (i = 0; i < nsects; i++) {
if (segment == sects[i]->index) {
sym->section = i + 1;
break;
}
}
if (nsects && i == nsects)
nasm_error(ERR_PANIC, "strange segment conditions in ELF driver");
}
if (is_global == 2) {