The section name might the user a hint of what is going on. I tried to include the flags as well, but there didn't seem to be consensus about including the internal section flags in the diagnostics:
[RFC PATCH] More detailed diagnostics for section type conflicts <https://inbox.sourceware.org/gcc-patches/87y13awl2k....@oldenburg.str.redhat.com/> gcc/ * varasm.cc (get_section): Include name of section in diagnostic messages. --- gcc/varasm.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/varasm.cc b/gcc/varasm.cc index 92b105a4089..0bb63e9236b 100644 --- a/gcc/varasm.cc +++ b/gcc/varasm.cc @@ -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; } base-commit: 1a4c5643a5911d130dfab9a064222baeeb7f9be7