summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-01-02 23:00:43 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2010-01-02 23:00:43 +0300
commit3b4c769d998445727a6b8e77c949ae469c43281e (patch)
tree29b4390651e1a7450f8946636339172a8747aef7
parent3e73cfc8b77c39a61f3a393aa4e65d1da83d6d4d (diff)
downloadnasm-3b4c769d998445727a6b8e77c949ae469c43281e.tar.gz
Elf: Allow symbols binding to undefined section
Commit 2ddcd03900d134772e98acf8cab17a12cc0c3f2a 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>
-rw-r--r--output/outelf32.c6
-rw-r--r--output/outelf64.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/output/outelf32.c b/output/outelf32.c
index 1625fb7d..6e2ae827 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -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) {
diff --git a/output/outelf64.c b/output/outelf64.c
index 18508fb3..1fcd0b36 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -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) {