[llvm] [SystemZ][z/OS] yaml2obj GOFF symbols (PR #75971)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 00:59:24 PST 2024


================
@@ -245,6 +248,57 @@ void GOFFState::writeHeader(GOFFYAML::FileHeader &FileHdr) {
   }
 }
 
+void GOFFState::writeSymbol(GOFFYAML::Symbol Sym) {
+  if (Sym.ID != SymbolID + 1)
+    reportError("symbol IDs not monotonic " + Sym.Name);
+  else
+    ++SymbolID;
+  if (Sym.OwnerID >= SymbolID)
+    reportError("owner ID not defined " + Sym.Name);
+  SmallString<80> SymName;
+  if (std::error_code EC = ConverterEBCDIC::convertToEBCDIC(Sym.Name, SymName))
+    reportError("conversion error on " + Sym.Name);
----------------
jh7370 wrote:

In this case, I think the error case makes sense, but you should include the error code (or more likely the message it represents) in the error message.

As a later addition you could make (in a future PR, probably), you could have the option to specify the field in its converted form, as this would allow you to craft an encoded name that you need to test edge cases. It's probably only worth doing this though if it would prove useful for a future test case.

https://github.com/llvm/llvm-project/pull/75971


More information about the llvm-commits mailing list