Avoid unnecessary warning on redefinition of section (bug 801180)
authorroot <root@thor.crayne.org>
Fri, 19 Oct 2007 00:04:10 +0000 (17:04 -0700)
committerroot <root@thor.crayne.org>
Fri, 19 Oct 2007 00:04:10 +0000 (17:04 -0700)
output/outelf32.c
output/outelf64.c

index e021ba7..ffd59db 100644 (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);
     }
index 3ef19a2..6ee5634 100644 (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);
     }