[llvm] [SystemZ][z/OS] This change adds support for the PPA2 section in zOS (PR #68926)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 16 10:57:54 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"))
----------------
uweigand wrote:
This is never set in clang by your patch. Should it be?
https://github.com/llvm/llvm-project/pull/68926
More information about the llvm-commits
mailing list