[llvm-commits] [llvm] r76231 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/Target/TargetAsmInfo.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/DarwinTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp
Chris Lattner
sabre at nondot.org
Fri Jul 17 13:46:57 PDT 2009
Author: lattner
Date: Fri Jul 17 15:46:40 2009
New Revision: 76231
URL: http://llvm.org/viewvc/llvm-project?rev=76231&view=rev
Log:
Untangle a snarl that I discovered when updating the mangler,
starting in getCurrentFunctionEHName. Among other problems,
we would try to privative a "foo.eh" label, but end up emitting
the label as _Lfoo.eh instead of L_foo.eh on darwin. This is really
bad, and the linker has always tolerated these labels existing.
For now, just emit them as _foo.eh.
This patch also fixes problems with ".eh" labels on unnamed
functions and eliminates two strangely defined TargetAsmInfo
hooks.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
llvm/trunk/lib/Target/TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=76231&r1=76230&r2=76231&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Fri Jul 17 15:46:40 2009
@@ -170,11 +170,9 @@
/// Should be overridden if an indirect reference should be used.
virtual void EmitExternalGlobal(const GlobalVariable *GV);
- /// getCurrentFunctionEHName - Called to return (and cache) the
- /// CurrentFnEHName.
+ /// getCurrentFunctionEHName - Called to return the CurrentFnEHName.
///
- const std::string &getCurrentFunctionEHName(const MachineFunction *MF,
- std::string &FuncEHName) const;
+ std::string getCurrentFunctionEHName(const MachineFunction *MF) const;
protected:
/// getAnalysisUsage - Record analysis usage.
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=76231&r1=76230&r2=76231&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Fri Jul 17 15:46:40 2009
@@ -480,9 +480,9 @@
/// encode inline subroutine information.
bool DwarfUsesInlineInfoSection; // Defaults to false.
- /// NonLocalEHFrameLabel - If set, the EH_frame label needs to be non-local.
- ///
- bool NonLocalEHFrameLabel; // Defaults to false.
+ /// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it
+ /// doesn't show up in the symbol table of the object file.
+ bool Is_EHSymbolPrivate; // Defaults to true.
/// GlobalEHDirective - This is the directive used to make exception frame
/// tables globally visible.
@@ -714,12 +714,6 @@
const char *getPrivateGlobalPrefix() const {
return PrivateGlobalPrefix;
}
- /// EHGlobalPrefix - Prefix for EH_frame and the .eh symbols.
- /// This is normally PrivateGlobalPrefix, but some targets want
- /// these symbols to be visible.
- virtual const char *getEHGlobalPrefix() const {
- return PrivateGlobalPrefix;
- }
const char *getLessPrivateGlobalPrefix() const {
return LessPrivateGlobalPrefix;
}
@@ -876,8 +870,8 @@
bool doesDwarfUsesInlineInfoSection() const {
return DwarfUsesInlineInfoSection;
}
- bool doesRequireNonLocalEHFrameLabel() const {
- return NonLocalEHFrameLabel;
+ bool is_EHSymbolPrivate() const {
+ return Is_EHSymbolPrivate;
}
const char *getGlobalEHDirective() const {
return GlobalEHDirective;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=76231&r1=76230&r2=76231&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Jul 17 15:46:40 2009
@@ -264,17 +264,11 @@
return false;
}
-const std::string &
-AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF,
- std::string &Name) const {
+std::string
+AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) const {
assert(MF && "No machine function?");
- Name = MF->getFunction()->getName();
- if (Name.empty())
- Name = Mang->getMangledName(MF->getFunction());
-
- // FIXME: THIS SEEMS REALLY WRONG, it will get two prefixes.
- Name = Mang->makeNameProper(TAI->getEHGlobalPrefix() + Name + ".eh");
- return Name;
+ return Mang->getMangledName(MF->getFunction(), ".eh",
+ TAI->is_EHSymbolPrivate());
}
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=76231&r1=76230&r2=76231&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Fri Jul 17 15:46:40 2009
@@ -57,8 +57,8 @@
// Begin eh frame section.
Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection());
- if (!TAI->doesRequireNonLocalEHFrameLabel())
- O << TAI->getEHGlobalPrefix();
+ if (TAI->is_EHSymbolPrivate())
+ O << TAI->getPrivateGlobalPrefix();
O << "EH_frame" << Index << ":\n";
EmitLabel("section_eh_frame", Index);
@@ -194,7 +194,8 @@
EmitLabel("eh_frame_begin", EHFrameInfo.Number);
- if (TAI->doesRequireNonLocalEHFrameLabel()) {
+ if (!TAI->is_EHSymbolPrivate()) {
+// FIXME: HOW ARE THESE TWO ARMS DIFFERENT?? EH_frame vs eh_frame_common?
PrintRelDirective(true, true);
PrintLabelName("eh_frame_begin", EHFrameInfo.Number);
@@ -690,9 +691,8 @@
EmitExceptionTable();
// Save EH frame information
- std::string Name;
EHFrames.push_back(
- FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF, Name),
+ FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF),
SubprogramCount,
MMI->getPersonalityIndex(),
MF->getFrameInfo()->hasCalls(),
Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=76231&r1=76230&r2=76231&view=diff
==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Fri Jul 17 15:46:40 2009
@@ -86,6 +86,11 @@
StaticDtorsSection = ".mod_term_func";
}
+ // _foo.eh symbols are currently always exported so that the linker knows
+ // about them. This may not strictly be necessary on 10.6 and later, but it
+ // doesn't hurt anything.
+ Is_EHSymbolPrivate = false;
+
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=76231&r1=76230&r2=76231&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Fri Jul 17 15:46:40 2009
@@ -106,7 +106,7 @@
SupportsExceptionHandling = false;
DwarfRequiresFrameSection = true;
DwarfUsesInlineInfoSection = false;
- NonLocalEHFrameLabel = false;
+ Is_EHSymbolPrivate = true;
GlobalEHDirective = 0;
SupportsWeakOmittedEHFrame = true;
DwarfSectionOffsetDirective = 0;
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=76231&r1=76230&r2=76231&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Fri Jul 17 15:46:40 2009
@@ -64,8 +64,7 @@
// Leopard and above support aligned common symbols.
COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
HasDotTypeDotSizeDirective = false;
- NonLocalEHFrameLabel = true;
-
+
if (is64Bit) {
PersonalityPrefix = "";
PersonalitySuffix = "+4 at GOTPCREL";
More information about the llvm-commits
mailing list