Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109036167
D23203.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D23203.diff
View Options
Index: head/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp
===================================================================
--- head/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp
+++ head/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -303,9 +303,14 @@
case Triple::mipsel:
case Triple::mips64:
case Triple::mips64el:
- FDECFIEncoding = Ctx->getAsmInfo()->getCodePointerSize() == 4
- ? dwarf::DW_EH_PE_sdata4
- : dwarf::DW_EH_PE_sdata8;
+ // We cannot use DW_EH_PE_sdata8 for the large PositionIndependent case
+ // since there is no R_MIPS_PC64 relocation (only a 32-bit version).
+ if (PositionIndependent && !Large)
+ FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
+ else
+ FDECFIEncoding = Ctx->getAsmInfo()->getCodePointerSize() == 4
+ ? dwarf::DW_EH_PE_sdata4
+ : dwarf::DW_EH_PE_sdata8;
break;
case Triple::ppc64:
case Triple::ppc64le:
Index: head/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp
===================================================================
--- head/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp
+++ head/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp
@@ -103,6 +103,7 @@
case ELF::R_MIPS_32:
case ELF::R_MIPS_64:
case ELF::R_MIPS_TLS_DTPREL64:
+ case ELF::R_MIPS_PC32:
return true;
default:
return false;
@@ -117,6 +118,8 @@
return S + getELFAddend(R);
case ELF::R_MIPS_TLS_DTPREL64:
return S + getELFAddend(R) - 0x8000;
+ case ELF::R_MIPS_PC32:
+ return S + getELFAddend(R) - R.getOffset();
default:
llvm_unreachable("Invalid relocation type");
}
Index: head/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp
===================================================================
--- head/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp
+++ head/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp
@@ -2995,6 +2995,14 @@
StringRef Sym;
if (const GlobalAddressSDNode *G =
dyn_cast_or_null<const GlobalAddressSDNode>(TargetAddr)) {
+ // We must not emit the R_MIPS_JALR relocation against data symbols
+ // since this will cause run-time crashes if the linker replaces the
+ // call instruction with a relative branch to the data symbol.
+ if (!isa<Function>(G->getGlobal())) {
+ LLVM_DEBUG(dbgs() << "Not adding R_MIPS_JALR against data symbol "
+ << G->getGlobal()->getName() << "\n");
+ return;
+ }
Sym = G->getGlobal()->getName();
}
else if (const ExternalSymbolSDNode *ES =
@@ -3007,6 +3015,7 @@
MachineFunction *MF = MI.getParent()->getParent();
MCSymbol *S = MF->getContext().getOrCreateSymbol(Sym);
+ LLVM_DEBUG(dbgs() << "Adding R_MIPS_JALR against " << Sym << "\n");
MI.addOperand(MachineOperand::CreateMCSymbol(S, MipsII::MO_JALR));
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 31, 11:06 PM (1 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16371383
Default Alt Text
D23203.diff (2 KB)
Attached To
Mode
D23203: Merge commit 894f742acb from llvm git (by me):
Attached
Detach File
Event Timeline
Log In to Comment