summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/ELFWriter.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-07-18 23:24:01 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-07-18 23:24:01 +0000
commit50bf9a60e5dee870c574d5c515034803c5a155f7 (patch)
treeb5b3cb4b5e77f1896259e26a28785648e6f14f91 /llvm/lib/CodeGen/ELFWriter.cpp
parentf03e78f024b7b21b07a4f2b834aa3ecdf1838a1e (diff)
downloadbcm5719-llvm-50bf9a60e5dee870c574d5c515034803c5a155f7.tar.gz
bcm5719-llvm-50bf9a60e5dee870c574d5c515034803c5a155f7.zip
Use R_X86_64_32S to handle Jump Table Index relocation entries. Hide TAI usage inside getSection* functions
llvm-svn: 76347
Diffstat (limited to 'llvm/lib/CodeGen/ELFWriter.cpp')
-rw-r--r--llvm/lib/CodeGen/ELFWriter.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/ELFWriter.cpp b/llvm/lib/CodeGen/ELFWriter.cpp
index 69220f9aeaa..527adb821e7 100644
--- a/llvm/lib/CodeGen/ELFWriter.cpp
+++ b/llvm/lib/CodeGen/ELFWriter.cpp
@@ -145,6 +145,24 @@ bool ELFWriter::doInitialization(Module &M) {
return false;
}
+/// Get jump table section on the section name returned by TAI
+ELFSection &ELFWriter::getJumpTableSection() {
+ unsigned Align = TM.getTargetData()->getPointerABIAlignment();
+ return getSection(TAI->getJumpTableDataSection(),
+ ELFSection::SHT_PROGBITS,
+ ELFSection::SHF_ALLOC, Align);
+}
+
+/// Get a constant pool section based on the section name returned by TAI
+ELFSection &ELFWriter::getConstantPoolSection(MachineConstantPoolEntry &CPE) {
+ std::string CstPoolName =
+ TAI->SelectSectionForMachineConst(CPE.getType())->getName();
+ return getSection(CstPoolName,
+ ELFSection::SHT_PROGBITS,
+ ELFSection::SHF_MERGE | ELFSection::SHF_ALLOC,
+ CPE.getAlignment());
+}
+
// getGlobalELFVisibility - Returns the ELF specific visibility type
unsigned ELFWriter::getGlobalELFVisibility(const GlobalValue *GV) {
switch (GV->getVisibility()) {
@@ -513,9 +531,14 @@ void ELFWriter::EmitRelocations() {
Addend = TEW->getDefaultAddendForRelTy(RelType);
}
} else {
- // Get the symbol index for the section symbol referenced
- // by the relocation
+ // Get the symbol index for the section symbol
unsigned SectionIdx = MR.getConstantVal();
+
+ // Handle Jump Table Index relocation
+ if ((SectionIdx == getJumpTableSection().SectionIdx) &&
+ TEW->hasCustomJumpTableIndexRelTy())
+ RelType = TEW->getJumpTableIndexRelTy();
+
SymIdx = SectionList[SectionIdx]->getSymbolTableIndex();
Addend = (uint64_t)MR.getResultPointer();
}
OpenPOWER on IntegriCloud