Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Unified Diff: lib/CodeGen/ELFWriter.cpp

Issue 4295001: arm-mc-elf-s07-tew (Closed)
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/CodeGen/ELFWriter.h ('k') | lib/Target/ARM/ARMELFWriterInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/CodeGen/ELFWriter.cpp
===================================================================
--- a/lib/CodeGen/ELFWriter.cpp
+++ b/lib/CodeGen/ELFWriter.cpp
@@ -76,6 +76,9 @@
// Create the object code emitter object for this target.
ElfCE = new ELFCodeEmitter(*this);
+ // Create the arch-specific relocation helper
+ TERH = TEW->getRelocHelper();
+
// Inital number of sections
NumSections = 0;
}
@@ -721,13 +724,15 @@
// RelocateField - Patch relocatable field with 'Offset' in 'BO'
// using a 'Value' of known 'Size'
void ELFWriter::RelocateField(BinaryObject &BO, uint32_t Offset,
- int64_t Value, unsigned Size) {
+ int64_t Value, unsigned Size,
+ const MachineRelocation &MR) {
if (Size == 32)
BO.fixWord32(Value, Offset);
else if (Size == 64)
BO.fixWord64(Value, Offset);
- else
- llvm_unreachable("don't know howto patch relocatable field");
+ else {
+ TERH->RelocateField(BO, Offset, Value, Size, MR);
+ }
}
/// EmitRelocations - Emit relocations
@@ -801,7 +806,7 @@
// the relocatable field with the symbol offset directly.
if (S.SectionIdx == SectionIdx && TEW->isPCRelativeRel(RelType)) {
int64_t Value = TEW->computeRelocation(SymOffset, RelOffset, RelType);
- RelocateField(S, RelOffset, Value, RelTySize);
+ RelocateField(S, RelOffset, Value, RelTySize, MR);
continue;
}
@@ -811,7 +816,7 @@
// The target without addend on the relocation symbol must be
// patched in the relocation place itself to contain the addend
// otherwise write zeros to make sure there is no garbage there
- RelocateField(S, RelOffset, HasRelA ? 0 : Addend, RelTySize);
+ RelocateField(S, RelOffset, HasRelA ? 0 : Addend, RelTySize, MR);
// Get the relocation entry and emit to the relocation section
ELFRelocation Rel(RelOffset, SymIdx, RelType, HasRelA, Addend);
« no previous file with comments | « lib/CodeGen/ELFWriter.h ('k') | lib/Target/ARM/ARMELFWriterInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698