]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Report the section name in case of section type conflicts
authorFlorian Weimer <fweimer@redhat.com>
Fri, 15 Nov 2024 11:00:47 +0000 (12:00 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 15 Nov 2024 11:00:47 +0000 (12:00 +0100)
The section name might the user a hint of what is going on.

gcc/

* varasm.cc (get_section): Include name of section in
diagnostic messages.

gcc/varasm.cc

index 0712b4860294362f54b7c4cb8b6dc5f4175ef356..acc4b4a0419420353326889bdc5c39bc478fda66 100644 (file)
@@ -355,17 +355,20 @@ get_section (const char *name, unsigned int flags, tree decl,
              && decl != sect->named.decl)
            {
              if (decl != NULL && DECL_P (decl))
-               error ("%+qD causes a section type conflict with %qD",
-                      decl, sect->named.decl);
+               error ("%+qD causes a section type conflict with %qD"
+                      " in section %qs",
+                      decl, sect->named.decl, name);
              else
-               error ("section type conflict with %qD", sect->named.decl);
+               error ("section type conflict with %qD in section %qs",
+                      sect->named.decl, name);
              inform (DECL_SOURCE_LOCATION (sect->named.decl),
                      "%qD was declared here", sect->named.decl);
            }
          else if (decl != NULL && DECL_P (decl))
-           error ("%+qD causes a section type conflict", decl);
+           error ("%+qD causes a section type conflict for section %qs",
+                  decl, name);
          else
-           error ("section type conflict");
+           error ("section type conflict for section %qs", name);
          /* Make sure we don't error about one section multiple times.  */
          sect->common.flags |= SECTION_OVERRIDE;
        }