Skip to content

Commit

Permalink
Explicit symbols for gnu mimicing relocations. Patch by Jack Carter
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145911 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
bcardosolopes committed Dec 6, 2011
1 parent 2bcc789 commit a00a62a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/MC/ELFObjectWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions lib/MC/ELFObjectWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a00a62a

Please sign in to comment.