[llvm-branch-commits] [llvm] [GOFF] Add writing of section symbols (PR #133799)
Ulrich Weigand via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Apr 10 11:27:40 PDT 2025
================
@@ -0,0 +1,145 @@
+//===- MCSectionGOFF.cpp - GOFF Code Section Representation ---------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCSectionGOFF.h"
+#include "llvm/BinaryFormat/GOFF.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+namespace {
+void emitRMode(raw_ostream &OS, GOFF::ESDRmode Rmode, bool UseParenthesis) {
+ if (Rmode != GOFF::ESD_RMODE_None) {
+ OS << "RMODE" << (UseParenthesis ? '(' : ' ');
+ switch (Rmode) {
+ case GOFF::ESD_RMODE_24:
+ OS << "24";
+ break;
+ case GOFF::ESD_RMODE_31:
+ OS << "31";
+ break;
+ case GOFF::ESD_RMODE_64:
+ OS << "64";
+ break;
+ case GOFF::ESD_RMODE_None:
+ break;
+ }
+ if (UseParenthesis)
+ OS << ')';
+ }
+}
+
+void emitCATTR(raw_ostream &OS, StringRef Name, StringRef ParentName,
+ bool EmitAmodeAndRmode, GOFF::ESDAmode Amode,
+ GOFF::ESDRmode Rmode, GOFF::ESDAlignment Alignment,
+ GOFF::ESDLoadingBehavior LoadBehavior,
+ GOFF::ESDExecutable Executable, bool IsReadOnly,
+ StringRef PartName) {
+ if (EmitAmodeAndRmode && Amode != GOFF::ESD_AMODE_None) {
+ OS << ParentName << " AMODE ";
----------------
uweigand wrote:
As above, reading the HLASM docs, the "AMODE" command in GOFF mode should refer to a *symbol* name, not a section name. This may be a bit confusing due the section start symbol with the same name as the section - I think we should actually emit the AMODE for *that* instead.
(There is some HLASM backward compat mode for AMODE on a section name, but that also actually uses some implicitly generated section start symbol instead.)
https://github.com/llvm/llvm-project/pull/133799
More information about the llvm-branch-commits
mailing list