cmELF: correct error message from GetDynamicSectionString

Fixes: #25929
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index d9a4408..a71e5f1 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -621,7 +621,19 @@
 
       // Make sure the whole value was read.
       if (!(*this->Stream)) {
-        this->SetErrorMessage("Dynamic section specifies unreadable RPATH.");
+        if (tag == cmELF::TagRPath) {
+          this->SetErrorMessage(
+            "Dynamic section specifies unreadable DT_RPATH");
+        } else if (tag == cmELF::TagRunPath) {
+          this->SetErrorMessage(
+            "Dynamic section specifies unreadable DT_RUNPATH");
+        } else if (tag == cmELF::TagMipsRldMapRel) {
+          this->SetErrorMessage(
+            "Dynamic section specifies unreadable DT_MIPS_RLD_MAP_REL");
+        } else {
+          this->SetErrorMessage("Dynamic section specifies unreadable value"
+                                " for unexpected attribute");
+        }
         se.Value = "";
         return nullptr;
       }