@@ -39,6 +39,9 @@ class MCSectionGOFF final : public MCSection {
3939 // The type of this section.
4040 GOFF::ESDSymbolType SymbolType;
4141
42+ // This section is a BSS section.
43+ unsigned IsBSS : 1 ;
44+
4245 // Indicates that the PR symbol needs to set the length of the section to a
4346 // non-zero value. This is only a problem with the ADA PR - the binder will
4447 // generate an error in this case.
@@ -50,26 +53,26 @@ class MCSectionGOFF final : public MCSection {
5053 friend class MCContext ;
5154 friend class MCSymbolGOFF ;
5255
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 ),
5659 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 ) {}
5962
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),
6366 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 ) {}
6669
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),
7073 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 ) {}
7376
7477public:
7578 void printSwitchToSection (const MCAsmInfo &MAI, const Triple &T,
@@ -81,6 +84,9 @@ class MCSectionGOFF final : public MCSection {
8184 // Return the parent section.
8285 MCSectionGOFF *getParent () const { return Parent; }
8386
87+ // Returns true if this is a BSS section.
88+ bool isBSS () const { return IsBSS; }
89+
8490 // Returns the type of this section.
8591 GOFF::ESDSymbolType getSymbolType () const { return SymbolType; }
8692
@@ -102,6 +108,17 @@ class MCSectionGOFF final : public MCSection {
102108 return PRAttributes;
103109 }
104110
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+
105122 bool requiresNonZeroLength () const { return RequiresNonZeroLength; }
106123
107124 void setName (StringRef SectionName) { Name = SectionName; }
0 commit comments