[llvm-commits] [llvm] r48848 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp

Dale Johannesen dalej at apple.com
Wed Mar 26 16:31:39 PDT 2008


Author: johannes
Date: Wed Mar 26 18:31:39 2008
New Revision: 48848

URL: http://llvm.org/viewvc/llvm-project?rev=48848&view=rev
Log:
Fix a bug in Darwin EH:  FDE->CIE pointer must
be relocatable.  Describe why .set is needed better.


Modified:
    llvm/trunk/include/llvm/Target/TargetAsmInfo.h
    llvm/trunk/lib/CodeGen/DwarfWriter.cpp

Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=48848&r1=48847&r2=48848&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Wed Mar 26 18:31:39 2008
@@ -65,8 +65,15 @@
     /// section on this target.  Null if this target doesn't support zerofill.
     const char *ZeroFillDirective;        // Default is null.
     
-    /// NeedsSet - True if target asm can't compute addresses on data
-    /// directives.
+    /// NeedsSet - True if target asm treats expressions in data directives
+    /// as linktime-relocatable.  For assembly-time computation, we need to
+    /// use a .set.  Thus:
+    /// .set w, x-y
+    /// .long w
+    /// is computed at assembly time, while
+    /// .long x-y
+    /// is relocated if the relative locations of x and y change at linktime.
+    /// We want both these things in different places.
     bool NeedsSet;                        // Defaults to false.
     
     /// MaxInstLength - This is the maximum possible length of an instruction,

Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=48848&r1=48847&r2=48848&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Wed Mar 26 18:31:39 2008
@@ -925,19 +925,20 @@
 
   void EmitSectionOffset(const char* Label, const char* Section,
                          unsigned LabelNumber, unsigned SectionNumber,
-                         bool IsSmall = false, bool isEH = false) {
+                         bool IsSmall = false, bool isEH = false,
+                         bool useSet = true) {
     bool printAbsolute = false;
-    if (TAI->needsSet()) {
+    if (isEH)
+      printAbsolute = TAI->isAbsoluteEHSectionOffsets();
+    else
+      printAbsolute = TAI->isAbsoluteDebugSectionOffsets();
+
+    if (TAI->needsSet() && useSet) {
       O << "\t.set\t";
       PrintLabelName("set", SetCounter, Flavor);
       O << ",";
       PrintLabelName(Label, LabelNumber);
 
-      if (isEH)
-        printAbsolute = TAI->isAbsoluteEHSectionOffsets();
-      else
-        printAbsolute = TAI->isAbsoluteDebugSectionOffsets();
-      
       if (!printAbsolute) {
         O << "-";
         PrintLabelName(Section, SectionNumber);
@@ -953,11 +954,6 @@
         
       PrintLabelName(Label, LabelNumber);
 
-      if (isEH)
-        printAbsolute = TAI->isAbsoluteEHSectionOffsets();
-      else
-        printAbsolute = TAI->isAbsoluteDebugSectionOffsets();
-
       if (!printAbsolute) {
         O << "-";
         PrintLabelName(Section, SectionNumber);
@@ -2919,7 +2915,7 @@
 
       EmitSectionOffset("eh_frame_begin", "eh_frame_common",
                         EHFrameInfo.Number, EHFrameInfo.PersonalityIndex,
-                        true, true);
+                        true, true, false);
       Asm->EOL("FDE CIE offset");
 
       EmitReference("eh_func_begin", EHFrameInfo.Number, true);





More information about the llvm-commits mailing list