Avoid unnecessary warning on redefinition of section (bug 801180)

This commit is contained in:
root 2007-10-18 17:04:10 -07:00
parent f23a5b042c
commit 2674b04d88
2 changed files with 11 additions and 5 deletions

View File

@ -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);
}

View File

@ -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);
}