[clang] [SystemZ][z/OS] This change adds support for the PPA2 section in zOS (PR #68926)

Yusra Syeda via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 17 14:05:55 PDT 2023


================
@@ -1026,6 +1036,68 @@ void SystemZAsmPrinter::emitADASection() {
   OutStreamer->popSection();
 }
 
+static uint32_t getProductVersion(Module &M) {
+  if (auto *VersionVal = cast_or_null<ConstantAsMetadata>(
+          M.getModuleFlag("Product Major Version")))
+    return cast<ConstantInt>(VersionVal->getValue())->getZExtValue();
+  return LLVM_VERSION_MAJOR;
+}
+
+static uint32_t getProductRelease(Module &M) {
+  if (auto *ReleaseVal = cast_or_null<ConstantAsMetadata>(
+          M.getModuleFlag("Product Minor Version")))
+    return cast<ConstantInt>(ReleaseVal->getValue())->getZExtValue();
+  return LLVM_VERSION_MINOR;
+}
+
+static uint32_t getProductPatch(Module &M) {
+  if (auto *PatchVal = cast_or_null<ConstantAsMetadata>(
+          M.getModuleFlag("Product Patchlevel")))
+    return cast<ConstantInt>(PatchVal->getValue())->getZExtValue();
+  return LLVM_VERSION_PATCH;
+}
+
+void SystemZAsmPrinter::emitIDRLSection(Module &M) {
+  OutStreamer->pushSection();
+  OutStreamer->switchSection(getObjFileLowering().getIDRLSection());
+  constexpr unsigned IDRLDataLength = 30;
+  std::time_t Time = TranslationTime;
+
+  uint32_t ProductVersion = getProductVersion(M);
+  uint32_t ProductRelease = getProductRelease(M);
+
+  std::string ProductID;
+  if (auto *MD = M.getModuleFlag("Product Id"))
----------------
ysyeda wrote:

This is now set in clang.

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


More information about the cfe-commits mailing list