Support adding relocations for data sections, handling the cases where
global declared symbols are initialized with references from other global
symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76540 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/ELFCodeEmitter.cpp b/lib/CodeGen/ELFCodeEmitter.cpp
index 23210fc..c77334a 100644
--- a/lib/CodeGen/ELFCodeEmitter.cpp
+++ b/lib/CodeGen/ELFCodeEmitter.cpp
@@ -68,6 +68,10 @@
FnSym->SectionIdx = ES->SectionIdx;
FnSym->Size = ES->getCurrentPCOffset()-FnStartOff;
+ // keep track of the emitted function leaving its symbol index as zero
+ // to be patched up later when emitting the symbol table
+ EW.setGlobalSymLookup(F, 0);
+
// Offset from start of Section
FnSym->Value = FnStartOff;