OLD | NEW |
1 //===-- ELFWriter.cpp - Target-independent ELF Writer code ----------------===// | 1 //===-- ELFWriter.cpp - Target-independent ELF Writer code ----------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the target-independent ELF writer. This file writes out | 10 // This file implements the target-independent ELF writer. This file writes out |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 MRE = Relos.end(); MRI != MRE; ++MRI) { | 758 MRE = Relos.end(); MRI != MRE; ++MRI) { |
759 MachineRelocation &MR = *MRI; | 759 MachineRelocation &MR = *MRI; |
760 | 760 |
761 // Relocatable field offset from the section start | 761 // Relocatable field offset from the section start |
762 unsigned RelOffset = MR.getMachineCodeOffset(); | 762 unsigned RelOffset = MR.getMachineCodeOffset(); |
763 | 763 |
764 // Symbol index in the symbol table | 764 // Symbol index in the symbol table |
765 unsigned SymIdx = 0; | 765 unsigned SymIdx = 0; |
766 | 766 |
767 // Target specific relocation field type and size | 767 // Target specific relocation field type and size |
768 unsigned RelType = TEW->getRelocationType(MR.getRelocationType()); | 768 unsigned RelType = TEW->getRelocationType(S, MR); |
769 unsigned RelTySize = TEW->getRelocationTySize(RelType); | 769 unsigned RelTySize = TEW->getRelocationTySize(RelType); |
770 int64_t Addend = 0; | 770 int64_t Addend = 0; |
771 | 771 |
772 // There are several machine relocations types, and each one of | 772 // There are several machine relocations types, and each one of |
773 // them needs a different approach to retrieve the symbol table index. | 773 // them needs a different approach to retrieve the symbol table index. |
774 if (MR.isGlobalValue()) { | 774 if (MR.isGlobalValue()) { |
775 const GlobalValue *G = MR.getGlobalValue(); | 775 const GlobalValue *G = MR.getGlobalValue(); |
776 int64_t GlobalOffset = MR.getConstantVal(); | 776 int64_t GlobalOffset = MR.getConstantVal(); |
777 SymIdx = GblSymLookup[G]; | 777 SymIdx = GblSymLookup[G]; |
778 if (G->hasPrivateLinkage()) { | 778 if (G->hasPrivateLinkage()) { |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 } | 1081 } |
1082 | 1082 |
1083 // Align output for the section table. | 1083 // Align output for the section table. |
1084 for (size_t NewFileOff = (FileOff+TableAlign-1) & ~(TableAlign-1); | 1084 for (size_t NewFileOff = (FileOff+TableAlign-1) & ~(TableAlign-1); |
1085 FileOff != NewFileOff; ++FileOff) | 1085 FileOff != NewFileOff; ++FileOff) |
1086 O << (char)0xAB; | 1086 O << (char)0xAB; |
1087 | 1087 |
1088 // Emit the section table itself. | 1088 // Emit the section table itself. |
1089 O.write((char *)&SHdrTable.getData()[0], SHdrTable.size()); | 1089 O.write((char *)&SHdrTable.getData()[0], SHdrTable.size()); |
1090 } | 1090 } |
OLD | NEW |