mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-18 16:25:05 +08:00
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:
parent
3e73cfc8b7
commit
3b4c769d99
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user