summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@thor.crayne.org>2007-10-18 17:04:10 -0700
committerroot <root@thor.crayne.org>2007-10-18 17:04:10 -0700
commit2674b04d8879fdcbcf81937a1da7375d351e7ef8 (patch)
treef5987ace57c2003ab8eb5896545e94c757e403ff
parentf23a5b042c9d0d762a9e9bc72df44b6a74affc02 (diff)
downloadnasm-2674b04d8879fdcbcf81937a1da7375d351e7ef8.tar.gz
Avoid unnecessary warning on redefinition of section (bug 801180)
-rw-r--r--output/outelf32.c7
-rw-r--r--output/outelf64.c9
2 files changed, 11 insertions, 5 deletions
diff --git a/output/outelf32.c b/output/outelf32.c
index e021ba74..ffd59dbf 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -333,7 +333,8 @@ static int elf_make_section(char *name, int type, int flags, int align)
static int32_t elf_section_names(char *name, int pass, int *bits)
{
char *p;
- int flags_and, flags_or, type, align, i;
+ unsigned flags_and, flags_or;
+ int type, align, i;
/*
* Default is 32 bits.
@@ -427,7 +428,9 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
sects[i]->flags &= ~flags_and;
sects[i]->flags |= flags_or;
} else if (pass == 1) {
- if (type || align || flags_and)
+ if ((type && sects[i]->type != type)
+ || (align && sects[i]->align != align)
+ || (flags_and && ((sects[i]->flags & flags_and) != flags_or)))
error(ERR_WARNING, "section attributes ignored on"
" redeclaration of section `%s'", name);
}
diff --git a/output/outelf64.c b/output/outelf64.c
index 3ef19a24..6ee56343 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -346,7 +346,8 @@ static int elf_make_section(char *name, int type, int flags, int align)
static int32_t elf_section_names(char *name, int pass, int *bits)
{
char *p;
- int flags_and, flags_or, type, align, i;
+ unsigned flags_and, flags_or;
+ int type, align, i;
/*
* Default is 64 bits.
@@ -440,8 +441,10 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
sects[i]->flags &= ~flags_and;
sects[i]->flags |= flags_or;
} else if (pass == 1) {
- if (type || align || flags_and)
- error(ERR_WARNING, "section attributes ignored on"
+ if ((type && sects[i]->type != type)
+ || (align && sects[i]->align != align)
+ || (flags_and && ((sects[i]->flags & flags_and) != flags_or)))
+ error(ERR_WARNING, "incompatible section attributes ignored on"
" redeclaration of section `%s'", name);
}