untangle a TargetAsmInfo hack where ELFTargetAsmInfo would create a
'unnamed' bss section, but some impls would want a named one. Since
they don't have consistent behavior, just make each target do their
own thing, instead of doing something "sortof common" then having
targets change immutable objects later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77165 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 0052075..28d6324 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -389,12 +389,12 @@
}
-const Section *TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags,
- bool Override) const {
+const Section *TargetAsmInfo::getNamedSection(const char *Name,
+ unsigned Flags) const {
Section &S = Sections[Name];
// This is newly-created section, set it up properly.
- if (S.Flags == SectionFlags::Invalid || Override) {
+ if (S.Name.empty()) {
S.Flags = Flags | SectionFlags::Named;
S.Name = Name;
}
@@ -403,12 +403,11 @@
}
const Section*
-TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags,
- bool Override) const {
+TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags) const {
Section& S = Sections[Directive];
// This is newly-created section, set it up properly.
- if (S.Flags == SectionFlags::Invalid || Override) {
+ if (S.Name.empty()) {
S.Flags = Flags & ~SectionFlags::Named;
S.Name = Directive;
}