Skip to content

Commit

Permalink
Revert "COFF: Let globals with private linkage reside in their own se…
Browse files Browse the repository at this point in the history
…ction"

This reverts commit r232539.  This was committed accidently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232543 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
majnemer committed Mar 17, 2015
1 parent e3154fb commit 76d3a99
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 42 deletions.
4 changes: 0 additions & 4 deletions include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const override;

void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
bool CannotUsePrivateLabel, Mangler &Mang,
const TargetMachine &TM) const override;

const MCSection *
getSectionForJumpTable(const Function &F, Mangler &Mang,
const TargetMachine &TM) const override;
Expand Down
5 changes: 0 additions & 5 deletions include/llvm/Target/TargetLoweringObjectFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ class TargetLoweringObjectFile : public MCObjectFileInfo {
return SectionForGlobal(GV, getKindForGlobal(GV, TM), Mang, TM);
}

virtual void getNameWithPrefix(SmallVectorImpl<char> &OutName,
const GlobalValue *GV,
bool CannotUsePrivateLabel, Mangler &Mang,
const TargetMachine &TM) const;

virtual const MCSection *
getSectionForJumpTable(const Function &F, Mangler &Mang,
const TargetMachine &TM) const;
Expand Down
24 changes: 0 additions & 24 deletions lib/CodeGen/TargetLoweringObjectFileImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,6 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
StringRef COMDATSymName = Sym->getName();
return getContext().getCOFFSection(Name, Characteristics, Kind,
COMDATSymName, Selection);
} else {
SmallString<256> TmpData;
getNameWithPrefix(TmpData, GV, true, Mang, TM);
return getContext().getCOFFSection(Name, Characteristics, Kind, TmpData,
Selection);
}
}

Expand All @@ -953,25 +948,6 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
return DataSection;
}

void TargetLoweringObjectFileCOFF::getNameWithPrefix(
SmallVectorImpl<char> &OutName, const GlobalValue *GV,
bool CannotUsePrivateLabel, Mangler &Mang, const TargetMachine &TM) const {
if (GV->hasPrivateLinkage() &&
((isa<Function>(GV) && TM.getFunctionSections()) ||
(isa<GlobalVariable>(GV) && TM.getDataSections()))) {
SmallString<256> Tmp;
Mang.getNameWithPrefix(Tmp, GV, /*CannotUsePrivateLabel=*/false);
if (Tmp.startswith(".L"))
OutName.append(Tmp.begin() + 2, Tmp.end());
else if (Tmp.startswith("L"))
OutName.append(Tmp.begin() + 1, Tmp.end());
else
OutName.append(Tmp.begin(), Tmp.end());
return;
}
Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
}

const MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
// If the function can be removed, produce a unique section so that
Expand Down
6 changes: 0 additions & 6 deletions lib/Target/TargetLoweringObjectFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,3 @@ const MCExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(const MCSymbol
// null return could mean 'no location' & we should just do that here.
return MCSymbolRefExpr::Create(Sym, *Ctx);
}

void TargetLoweringObjectFile::getNameWithPrefix(
SmallVectorImpl<char> &OutName, const GlobalValue *GV,
bool CannotUsePrivateLabel, Mangler &Mang, const TargetMachine &TM) const {
Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
}
2 changes: 1 addition & 1 deletion lib/Target/TargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
const TargetLoweringObjectFile *TLOF = getObjFileLowering();
const MCSection *TheSection = TLOF->SectionForGlobal(GV, GVKind, Mang, *this);
bool CannotUsePrivateLabel = !canUsePrivateLabel(*AsmInfo, *TheSection);
TLOF->getNameWithPrefix(Name, GV, CannotUsePrivateLabel, Mang, *this);
Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel);
}

MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const {
Expand Down
4 changes: 2 additions & 2 deletions test/CodeGen/X86/global-sections.ll
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ bb7:
; LINUX-SECTIONS: .asciz "foo"
; LINUX-SECTIONS: .size .LG14, 4

; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G14
; WIN32-SECTIONS: _G14:
; WIN32-SECTIONS: .section .rdata,"dr"
; WIN32-SECTIONS: L_G14:
; WIN32-SECTIONS: .asciz "foo"

; cannot be merged on MachO, but can on other formats.
Expand Down

0 comments on commit 76d3a99

Please sign in to comment.