Explicit symbols for gnu mimicing relocations. Patch by Jack Carter
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Tue, 6 Dec 2011 03:34:42 +0000 (03:34 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Tue, 6 Dec 2011 03:34:42 +0000 (03:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145911 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/ELFObjectWriter.cpp
lib/MC/ELFObjectWriter.h

index 02e1b3ab9859e2978101cc3eabc611a3029ed66c..132e81788d8b16e88a8e3e559d923552ee4f0248 100644 (file)
@@ -1831,6 +1831,20 @@ void MipsELFObjectWriter::WriteEFlags() {
           ELF::EF_MIPS_ARCH_32R2);
 }
 
+const MCSymbol *MipsELFObjectWriter::ExplicitRelSym(const MCAssembler &Asm,
+                                                    const MCValue &Target,
+                                                    const MCFragment &F,
+                                                    const MCFixup &Fixup,
+                                                    bool IsPCRel) const {
+  assert(Target.getSymA() && "SymA cannot be 0.");
+  const MCSymbol &Sym = Target.getSymA()->getSymbol();
+  
+  if (Sym.getSection().getKind().isMergeable1ByteCString())
+    return &Sym;
+
+  return NULL;
+}
+
 unsigned MipsELFObjectWriter::GetRelocType(const MCValue &Target,
                                            const MCFixup &Fixup,
                                            bool IsPCRel,
index 78382065dbcbb3d9f5ea1062c7a73dcb80aa562c..9adf0b1bd0f8a8cf8cab963a6665f151c752d30b 100644 (file)
@@ -445,6 +445,12 @@ class ELFObjectWriter : public MCObjectWriter {
     virtual void WriteEFlags();
 
   protected:
+    virtual const MCSymbol *ExplicitRelSym(const MCAssembler &Asm,
+                                           const MCValue &Target,
+                                           const MCFragment &F,
+                                           const MCFixup &Fixup,
+                                           bool IsPCRel) const;
+
     virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
                                   bool IsPCRel, bool IsRelocWithSymbol,
                                   int64_t Addend);