Skip to content

Commit b6b261a

Browse files
committed
Reuse NameSpace from ED in PR/LD
1 parent 83440e1 commit b6b261a

File tree

4 files changed

+25
-28
lines changed

4 files changed

+25
-28
lines changed

llvm/include/llvm/MC/MCGOFFAttributes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ struct EDAttr {
6666
struct LDAttr {
6767
bool IsRenamable = false;
6868
GOFF::ESDExecutable Executable = GOFF::ESD_EXE_Unspecified;
69-
GOFF::ESDNameSpaceId NameSpace = GOFF::ESD_NS_NormalName;
7069
GOFF::ESDBindingStrength BindingStrength = GOFF::ESD_BST_Strong;
7170
GOFF::ESDLinkageType Linkage = GOFF::ESD_LT_XPLink;
7271
GOFF::ESDAmode Amode;
@@ -78,7 +77,6 @@ struct PRAttr {
7877
bool IsRenamable = false;
7978
bool IsReadOnly = false; // ???? Not documented.
8079
GOFF::ESDExecutable Executable = GOFF::ESD_EXE_Unspecified;
81-
GOFF::ESDNameSpaceId NameSpace = GOFF::ESD_NS_NormalName;
8280
GOFF::ESDLinkageType Linkage = GOFF::ESD_LT_XPLink;
8381
GOFF::ESDAmode Amode;
8482
GOFF::ESDBindingScope BindingScope = GOFF::ESD_BSC_Unspecified;

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,9 +2778,9 @@ void TargetLoweringObjectFileGOFF::getModuleMetadata(Module &M) {
27782778
// Initialize the label for the text section.
27792779
MCSymbolGOFF *TextLD = static_cast<MCSymbolGOFF *>(
27802780
getContext().getOrCreateSymbol(RootSD->getName()));
2781-
TextLD->setLDAttributes(GOFF::LDAttr{
2782-
false, GOFF::ESD_EXE_CODE, GOFF::ESD_NS_NormalName, GOFF::ESD_BST_Strong,
2783-
GOFF::LINKAGE, GOFF::AMODE, GOFF::ESD_BSC_Section});
2781+
TextLD->setLDAttributes(GOFF::LDAttr{false, GOFF::ESD_EXE_CODE,
2782+
GOFF::ESD_BST_Strong, GOFF::LINKAGE,
2783+
GOFF::AMODE, GOFF::ESD_BSC_Section});
27842784
TextLD->setADA(ADAPR);
27852785
TextSection->setBeginSymbol(TextLD);
27862786
}
@@ -2803,9 +2803,9 @@ MCSection *TargetLoweringObjectFileGOFF::getSectionForLSDA(
28032803
static_cast<MCSectionGOFF *>(TextSection)->getParent());
28042804
return getContext().getGOFFSection(
28052805
SectionKind::getData(), Name,
2806-
GOFF::PRAttr{true, false, GOFF::ESD_EXE_Unspecified, GOFF::ESD_NS_Parts,
2807-
GOFF::LINKAGE, GOFF::AMODE, GOFF::ESD_BSC_Section,
2808-
GOFF::ESD_DSS_NoWarning, GOFF::ESD_ALIGN_Fullword, 0},
2806+
GOFF::PRAttr{true, false, GOFF::ESD_EXE_Unspecified, GOFF::LINKAGE,
2807+
GOFF::AMODE, GOFF::ESD_BSC_Section, GOFF::ESD_DSS_NoWarning,
2808+
GOFF::ESD_ALIGN_Fullword, 0},
28092809
WSA);
28102810
}
28112811

@@ -2834,9 +2834,8 @@ MCSection *TargetLoweringObjectFileGOFF::SelectSectionForGlobal(
28342834
SD);
28352835
return getContext().getGOFFSection(
28362836
Kind, Symbol->getName(),
2837-
GOFF::PRAttr{false, false, GOFF::ESD_EXE_DATA, GOFF::ESD_NS_Parts,
2838-
GOFF::LINKAGE, GOFF::AMODE, PRBindingScope,
2839-
GOFF::ESD_DSS_NoWarning,
2837+
GOFF::PRAttr{false, false, GOFF::ESD_EXE_DATA, GOFF::LINKAGE,
2838+
GOFF::AMODE, PRBindingScope, GOFF::ESD_DSS_NoWarning,
28402839
static_cast<GOFF::ESDAlignment>(GO->getAlignment()), 0},
28412840
ED);
28422841
}

llvm/lib/MC/GOFFObjectWriter.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,9 @@ class GOFFSymbol {
246246
}
247247

248248
GOFFSymbol(StringRef Name, uint32_t EsdID, uint32_t ParentEsdID,
249-
const GOFF::LDAttr &Attr)
249+
GOFF::ESDNameSpaceId NameSpace, const GOFF::LDAttr &Attr)
250250
: Name(Name.data(), Name.size()), EsdId(EsdID), ParentEsdId(ParentEsdID),
251-
SymbolType(GOFF::ESD_ST_LabelDefinition) {
252-
this->NameSpace = Attr.NameSpace;
251+
SymbolType(GOFF::ESD_ST_LabelDefinition), NameSpace(NameSpace) {
253252
SymbolFlags.setRenameable(Attr.IsRenamable);
254253
BehavAttrs.setExecutable(Attr.Executable);
255254
BehavAttrs.setBindingStrength(Attr.BindingStrength);
@@ -259,10 +258,9 @@ class GOFFSymbol {
259258
}
260259

261260
GOFFSymbol(StringRef Name, uint32_t EsdID, uint32_t ParentEsdID,
262-
const GOFF::PRAttr &Attr)
261+
GOFF::ESDNameSpaceId NameSpace, const GOFF::PRAttr &Attr)
263262
: Name(Name.data(), Name.size()), EsdId(EsdID), ParentEsdId(ParentEsdID),
264-
SymbolType(GOFF::ESD_ST_PartReference) {
265-
this->NameSpace = Attr.NameSpace;
263+
SymbolType(GOFF::ESD_ST_PartReference), NameSpace(NameSpace) {
266264
SymbolFlags.setRenameable(Attr.IsRenamable);
267265
BehavAttrs.setExecutable(Attr.Executable);
268266
BehavAttrs.setAlignment(Attr.Alignment);
@@ -310,8 +308,10 @@ void GOFFWriter::defineSectionSymbols(const MCSectionGOFF &Section) {
310308
}
311309

312310
if (Section.isPR()) {
313-
GOFFSymbol PR(Section.getName(), Section.getOrdinal(),
314-
Section.getParent()->getOrdinal(), Section.getPRAttributes());
311+
MCSectionGOFF *Parent = Section.getParent();
312+
GOFFSymbol PR(Section.getName(), Section.getOrdinal(), Parent->getOrdinal(),
313+
Parent->getEDAttributes().NameSpace,
314+
Section.getPRAttributes());
315315
PR.SectionLength = Asm.getSectionAddressSize(Section);
316316
if (Section.requiresNonZeroLength()) {
317317
// We cannot have a zero-length section for data. If we do,
@@ -327,9 +327,9 @@ void GOFFWriter::defineSectionSymbols(const MCSectionGOFF &Section) {
327327
}
328328

329329
void GOFFWriter::defineLabel(const MCSymbolGOFF &Symbol) {
330-
GOFFSymbol LD(Symbol.getName(), Symbol.getIndex(),
331-
static_cast<MCSectionGOFF &>(Symbol.getSection()).getOrdinal(),
332-
Symbol.getLDAttributes());
330+
MCSectionGOFF &Section = static_cast<MCSectionGOFF &>(Symbol.getSection());
331+
GOFFSymbol LD(Symbol.getName(), Symbol.getIndex(), Section.getOrdinal(),
332+
Section.getEDAttributes().NameSpace, Symbol.getLDAttributes());
333333
if (Symbol.getADA())
334334
LD.ADAEsdId = Symbol.getADA()->getOrdinal();
335335
writeSymbol(LD);

llvm/lib/MC/MCObjectFileInfo.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,9 @@ void MCObjectFileInfo::initGOFFMCObjectFileInfo(const Triple &T) {
560560
RootSDSection);
561561
ADASection = Ctx->getGOFFSection(
562562
SectionKind::getData(), "#S",
563-
GOFF::PRAttr{false, false, GOFF::ESD_EXE_DATA, GOFF::ESD_NS_Parts,
564-
GOFF::ESD_LT_XPLink, GOFF::AMODE, GOFF::ESD_BSC_Section,
565-
GOFF::ESD_DSS_NoWarning, GOFF::ESD_ALIGN_Quadword, 0},
563+
GOFF::PRAttr{false, false, GOFF::ESD_EXE_DATA, GOFF::ESD_LT_XPLink,
564+
GOFF::AMODE, GOFF::ESD_BSC_Section, GOFF::ESD_DSS_NoWarning,
565+
GOFF::ESD_ALIGN_Quadword, 0},
566566
ADAEDSection);
567567

568568
TextSection = Ctx->getGOFFSection(
@@ -582,9 +582,9 @@ void MCObjectFileInfo::initGOFFMCObjectFileInfo(const Triple &T) {
582582
RootSDSection);
583583
PPA2ListSection = Ctx->getGOFFSection(
584584
SectionKind::getData(), ".&ppa2",
585-
GOFF::PRAttr{true, false, GOFF::ESD_EXE_Unspecified, GOFF::ESD_NS_Parts,
586-
GOFF::ESD_LT_OS, GOFF::AMODE, GOFF::ESD_BSC_Section,
587-
GOFF::ESD_DSS_NoWarning, GOFF::ESD_ALIGN_Doubleword, 0},
585+
GOFF::PRAttr{true, false, GOFF::ESD_EXE_Unspecified, GOFF::ESD_LT_OS,
586+
GOFF::AMODE, GOFF::ESD_BSC_Section, GOFF::ESD_DSS_NoWarning,
587+
GOFF::ESD_ALIGN_Doubleword, 0},
588588
PPA2ListEDSection);
589589

590590
IDRLSection = Ctx->getGOFFSection(

0 commit comments

Comments
 (0)