summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-10 07:20:42 +0000
committerChris Lattner <sabre@nondot.org>2010-03-10 07:20:42 +0000
commit09d53fecfcc93377627b6ee7b4d92f8a6ff152e9 (patch)
tree1b132acb0ac6dd2afab411e0ecb8eae337e3a3ef /lib
parent3a624227c0a2ca7194f19b430c531572491c21de (diff)
downloadllvm-09d53fecfcc93377627b6ee7b4d92f8a6ff152e9.tar.gz
llvm-09d53fecfcc93377627b6ee7b4d92f8a6ff152e9.tar.bz2
llvm-09d53fecfcc93377627b6ee7b4d92f8a6ff152e9.tar.xz
move three lowering hooks from MAI to TLOF and make one of them
semantic instead of syntactic. This completes MCization of darwin/x86[-64]! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98145 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfException.cpp12
-rw-r--r--lib/CodeGen/TargetLoweringObjectFileImpl.cpp8
-rw-r--r--lib/MC/MCAsmInfo.cpp3
-rw-r--r--lib/MC/MCAsmInfoDarwin.cpp11
-rw-r--r--lib/Target/TargetLoweringObjectFile.cpp4
5 files changed, 18 insertions, 20 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp
index 099c112089..11a01fe51e 100644
--- a/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -85,7 +85,7 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
MCSymbol *EHFrameSym;
- if (MAI->is_EHSymbolPrivate())
+ if (TLOF.isFunctionEHFrameSymbolPrivate())
EHFrameSym = getDWLabel("EH_frame", Index);
else
EHFrameSym = Asm->OutContext.GetOrCreateSymbol(Twine("EH_frame") +
@@ -193,9 +193,8 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
// Externally visible entry into the functions eh frame info. If the
// corresponding function is static, this should not be externally visible.
- if (!TheFunc->hasLocalLinkage())
- if (const char *GlobalEHDirective = MAI->getGlobalEHDirective())
- O << GlobalEHDirective << *EHFrameInfo.FunctionEHSym << '\n';
+ if (!TheFunc->hasLocalLinkage() && TLOF.isFunctionEHSymbolGlobal())
+ Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,MCSA_Global);
// If corresponding function is weak definition, this should be too.
if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective())
@@ -215,7 +214,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
if (!EHFrameInfo.hasCalls && !UnwindTablesMandatory &&
(!TheFunc->isWeakForLinker() ||
!MAI->getWeakDefDirective() ||
- MAI->getSupportsWeakOmittedEHFrame())) {
+ TLOF.getSupportsWeakOmittedEHFrame())) {
Asm->OutStreamer.EmitAssignment(EHFrameInfo.FunctionEHSym,
MCConstantExpr::Create(0, Asm->OutContext));
// This name has no connection to the function, so it might get
@@ -981,9 +980,10 @@ void DwarfException::EndFunction() {
Asm->OutStreamer.EmitLabel(getDWLabel("eh_func_end", SubprogramCount));
EmitExceptionTable();
+ const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
MCSymbol *FunctionEHSym =
Asm->GetSymbolWithGlobalValueBase(MF->getFunction(), ".eh",
- Asm->MAI->is_EHSymbolPrivate());
+ TLOF.isFunctionEHFrameSymbolPrivate());
// Save EH frame information
EHFrames.push_back(FunctionEHFrameInfo(FunctionEHSym, SubprogramCount,
diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 6916831754..2014b429bd 100644
--- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -466,6 +466,14 @@ getMachOSection(StringRef Segment, StringRef Section,
void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
const TargetMachine &TM) {
+ // _foo.eh symbols are currently always exported so that the linker knows
+ // about them. This is not necessary on 10.6 and later, but it
+ // doesn't hurt anything.
+ // FIXME: I need to get this from Triple.
+ IsFunctionEHSymbolGlobal = true;
+ IsFunctionEHFrameSymbolPrivate = false;
+ SupportsWeakOmittedEHFrame = false;
+
if (UniquingMap != 0)
((MachOUniqueMapTy*)UniquingMap)->clear();
TargetLoweringObjectFile::Initialize(Ctx, TM);
diff --git a/lib/MC/MCAsmInfo.cpp b/lib/MC/MCAsmInfo.cpp
index f3f063f4e9..bda700b6aa 100644
--- a/lib/MC/MCAsmInfo.cpp
+++ b/lib/MC/MCAsmInfo.cpp
@@ -68,9 +68,6 @@ MCAsmInfo::MCAsmInfo() {
ExceptionsType = ExceptionHandling::None;
DwarfRequiresFrameSection = true;
DwarfUsesInlineInfoSection = false;
- Is_EHSymbolPrivate = true;
- GlobalEHDirective = 0;
- SupportsWeakOmittedEHFrame = true;
DwarfSectionOffsetDirective = 0;
AsmTransCBE = 0;
diff --git a/lib/MC/MCAsmInfoDarwin.cpp b/lib/MC/MCAsmInfoDarwin.cpp
index da865ad9dc..3c31caa5ac 100644
--- a/lib/MC/MCAsmInfoDarwin.cpp
+++ b/lib/MC/MCAsmInfoDarwin.cpp
@@ -40,19 +40,8 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
HiddenVisibilityAttr = MCSA_PrivateExtern;
// Doesn't support protected visibility.
ProtectedVisibilityAttr = MCSA_Global;
-
HasDotTypeDotSizeDirective = false;
HasNoDeadStrip = true;
- // Note: Even though darwin has the .lcomm directive, it is just a synonym for
- // zerofill, so we prefer to use .zerofill.
-
- // _foo.eh symbols are currently always exported so that the linker knows
- // about them. This is not necessary on 10.6 and later, but it
- // doesn't hurt anything.
- // FIXME: I need to get this from Triple.
- Is_EHSymbolPrivate = false;
- GlobalEHDirective = "\t.globl\t";
- SupportsWeakOmittedEHFrame = false;
}
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 421f1e8fa8..8c12039516 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -56,6 +56,10 @@ TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
DwarfARangesSection = 0;
DwarfRangesSection = 0;
DwarfMacroInfoSection = 0;
+
+ IsFunctionEHSymbolGlobal = false;
+ IsFunctionEHFrameSymbolPrivate = true;
+ SupportsWeakOmittedEHFrame = true;
}
TargetLoweringObjectFile::~TargetLoweringObjectFile() {