@@ -39,6 +39,9 @@ class MCSectionGOFF final : public MCSection {
39
39
// The type of this section.
40
40
GOFF::ESDSymbolType SymbolType;
41
41
42
+ // This section is a BSS section.
43
+ unsigned IsBSS : 1 ;
44
+
42
45
// Indicates that the PR symbol needs to set the length of the section to a
43
46
// non-zero value. This is only a problem with the ADA PR - the binder will
44
47
// generate an error in this case.
@@ -50,26 +53,26 @@ class MCSectionGOFF final : public MCSection {
50
53
friend class MCContext ;
51
54
friend class MCSymbolGOFF ;
52
55
53
- MCSectionGOFF (StringRef Name, SectionKind K, GOFF::SDAttr SDAttributes ,
54
- MCSectionGOFF *Parent)
55
- : MCSection(SV_GOFF, Name, K.isText(), /* IsVirtual= */ false , nullptr ),
56
+ MCSectionGOFF (StringRef Name, SectionKind K, bool IsVirtual ,
57
+ GOFF::SDAttr SDAttributes, MCSectionGOFF *Parent)
58
+ : MCSection(SV_GOFF, Name, K.isText(), IsVirtual, nullptr ),
56
59
Parent (Parent), SDAttributes(SDAttributes),
57
- SymbolType(GOFF::ESD_ST_SectionDefinition), RequiresNonZeroLength( 0 ),
58
- Emitted(0 ) {}
60
+ SymbolType(GOFF::ESD_ST_SectionDefinition), IsBSS(K.isBSS() ),
61
+ RequiresNonZeroLength( 0 ), Emitted(0 ) {}
59
62
60
- MCSectionGOFF (StringRef Name, SectionKind K, GOFF::EDAttr EDAttributes ,
61
- MCSectionGOFF *Parent)
62
- : MCSection(SV_GOFF, Name, K.isText(), /* IsVirtual= */ false , nullptr),
63
+ MCSectionGOFF (StringRef Name, SectionKind K, bool IsVirtual ,
64
+ GOFF::EDAttr EDAttributes, MCSectionGOFF *Parent)
65
+ : MCSection(SV_GOFF, Name, K.isText(), IsVirtual, nullptr),
63
66
Parent(Parent), EDAttributes(EDAttributes),
64
- SymbolType(GOFF::ESD_ST_ElementDefinition), RequiresNonZeroLength( 0 ),
65
- Emitted(0 ) {}
67
+ SymbolType(GOFF::ESD_ST_ElementDefinition), IsBSS(K.isBSS() ),
68
+ RequiresNonZeroLength( 0 ), Emitted(0 ) {}
66
69
67
- MCSectionGOFF (StringRef Name, SectionKind K, GOFF::PRAttr PRAttributes ,
68
- MCSectionGOFF *Parent)
69
- : MCSection(SV_GOFF, Name, K.isText(), /* IsVirtual= */ false , nullptr),
70
+ MCSectionGOFF (StringRef Name, SectionKind K, bool IsVirtual ,
71
+ GOFF::PRAttr PRAttributes, MCSectionGOFF *Parent)
72
+ : MCSection(SV_GOFF, Name, K.isText(), IsVirtual, nullptr),
70
73
Parent(Parent), PRAttributes(PRAttributes),
71
- SymbolType(GOFF::ESD_ST_PartReference), RequiresNonZeroLength( 0 ),
72
- Emitted(0 ) {}
74
+ SymbolType(GOFF::ESD_ST_PartReference), IsBSS(K.isBSS() ),
75
+ RequiresNonZeroLength( 0 ), Emitted(0 ) {}
73
76
74
77
public:
75
78
void printSwitchToSection (const MCAsmInfo &MAI, const Triple &T,
@@ -81,6 +84,9 @@ class MCSectionGOFF final : public MCSection {
81
84
// Return the parent section.
82
85
MCSectionGOFF *getParent () const { return Parent; }
83
86
87
+ // Returns true if this is a BSS section.
88
+ bool isBSS () const { return IsBSS; }
89
+
84
90
// Returns the type of this section.
85
91
GOFF::ESDSymbolType getSymbolType () const { return SymbolType; }
86
92
@@ -102,6 +108,17 @@ class MCSectionGOFF final : public MCSection {
102
108
return PRAttributes;
103
109
}
104
110
111
+ // Returns the text style for a section. Only defined for ED and PR sections.
112
+ GOFF::ESDTextStyle getTextStyle () const {
113
+ assert (isED () || isPR () || isVirtualSection () && " Expect ED or PR section" );
114
+ if (isED ())
115
+ return EDAttributes.TextStyle ;
116
+ if (isPR ())
117
+ return getParent ()->getEDAttributes ().TextStyle ;
118
+ // Virtual sections have no data, so byte orientation is fine.
119
+ return GOFF::ESD_TS_ByteOriented;
120
+ }
121
+
105
122
bool requiresNonZeroLength () const { return RequiresNonZeroLength; }
106
123
107
124
void setName (StringRef SectionName) { Name = SectionName; }
0 commit comments