[PATCH] MC: For variable symbols, maintain MCSymbol::Section as a cache.

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Tue Mar 24 13:17:40 PDT 2015


This is a step in the right direction to fix https://llvm.org/bugs/show_bug.cgi?id=19582

Thanks for working on this!


================
Comment at: include/llvm/MC/MCSymbol.h:73
@@ -70,1 +72,3 @@
     void operator=(const MCSymbol&) = delete;
+    const MCSection *getSectionPtr() const {
+      if (Section || !Value)
----------------
Why not just getSection?

================
Comment at: lib/MC/MCExpr.cpp:787
@@ -786,1 +786,3 @@
 
+    if (BE->getOpcode() == MCBinaryExpr::Sub)
+      return MCSymbol::AbsolutePseudoSection;
----------------
This is not always correct, but I guess it is less wrong than the case that follows.

================
Comment at: lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp:520
@@ -500,5 +519,3 @@
   if (!IsLittleEndian && Fixup.getKind() == FK_Data_4) {
-    const MCSection *Sec = Fixup.getValue()->FindAssociatedSection();
-    const MCSectionELF *SecELF = dyn_cast_or_null<const MCSectionELF>(Sec);
-    if (SecELF && SecELF->getSectionName() == ".eh_frame")
+    if (isByteSwappedFixup(Fixup.getValue()))
       Value = ByteSwap_32(unsigned(Value));
----------------
This can just use EvaluateAsRelocatable and can be an independent fix.

================
Comment at: test/MC/ELF/alias.s:111
@@ -101,2 +110,3 @@
 // CHECK-NEXT:     Name: .text (0)
+// CHECK-NOT: Symbol {
 // CHECK:        }
----------------
Can these CHECK-NOT go in first as an independent cleanup?

http://reviews.llvm.org/D8586

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list