• Home
  • Raw
  • Download

Lines Matching full:relocations

1 //===- Relocations.cpp ----------------------------------------------------===//
9 // This file contains platform-independent functions to process relocations.
12 // Simple relocations are easy to handle for the linker. For example,
17 // But not all relocations are that easy to handle. For example, for
23 // ELF defines a large number of complex relocations.
25 // The functions in this file analyze relocations and do whatever needs
29 // - create new relocations in .dynsym to let the dynamic linker resolve
31 // relocations can be resolved at link-time)
36 // Note that the functions in this file don't actually apply relocations
38 // It instead stores Relocation objects to InputSection's Relocations
43 #include "Relocations.h"
160 // support any relaxations for TLS relocations so by factoring out MIPS
164 // without dynamic relocations.
170 c.relocations.push_back({expr, type, offset, addend, &sym}); in handleMipsTlsRelocation()
175 c.relocations.push_back({expr, type, offset, addend, &sym}); in handleMipsTlsRelocation()
183 // relocations. The pair of GOT entries created are of the form GOT[e0] Module
187 // Returns the number of relocations processed.
207 c.relocations.push_back({expr, type, offset, addend, &sym}); in handleTlsRelocation()
218 // ARM and RISC-V do not support any relaxations for TLS relocations, however, in handleTlsRelocation()
219 // we can omit the DTPMOD dynamic relocations and resolve them at link time in handleTlsRelocation()
232 c.relocations.push_back( in handleTlsRelocation()
241 in.got->relocations.push_back( in handleTlsRelocation()
247 c.relocations.push_back({expr, type, offset, addend, &sym}); in handleTlsRelocation()
253 c.relocations.push_back({target->adjustTlsExpr(type, R_RELAX_TLS_LD_TO_LE), in handleTlsRelocation()
264 in.got->relocations.push_back( in handleTlsRelocation()
267 c.relocations.push_back({expr, type, offset, addend, &sym}); in handleTlsRelocation()
279 in.got->relocations.push_back( in handleTlsRelocation()
291 in.got->relocations.push_back( in handleTlsRelocation()
294 c.relocations.push_back({expr, type, offset, addend, &sym}); in handleTlsRelocation()
301 c.relocations.push_back( in handleTlsRelocation()
310 c.relocations.push_back( in handleTlsRelocation()
322 c.relocations.push_back({R_RELAX_TLS_IE_TO_LE, type, offset, addend, &sym}); in handleTlsRelocation()
342 // relocations handle low 16 bits of the address. That allows in getMipsPairType()
579 // the semantics of copy relocations, assume that you have an exported
619 // MIPS has an odd notion of "paired" relocations to calculate addends.
622 // the two relocations.
643 // To make things worse, paired relocations might not be contiguous in in computeMipsAddend()
983 // MIPS N32 ABI treats series of successive relocations with the same offset
985 // packs all relocations into the single relocation record. Here we emulate
1005 // relocations, we access offsets in the monotonically increasing
1056 isec->relocations.push_back({expr, type, offsetInSec, addend, sym}); in addRelativeReloc()
1083 // add a static relocation to a Relocations vector so that in addGotEntry()
1089 in.got->relocations.push_back({expr, target->symbolicRel, off, 0, &sym}); in addGotEntry()
1129 // * Apply relocations, recording which ones require a dynamic reloc.
1130 // * Write the dynamic relocations.
1133 // is needed after applying relocations. If it is, it will go after rw and rx
1150 sec.relocations.push_back({expr, type, offset, addend, &sym}); in processRelocAux()
1166 // MIPS ABI turns using of GOT and dynamic relocations inside out. in processRelocAux()
1167 // While regular ABI uses dynamic relocations to fill up GOT entries in processRelocAux()
1170 // relocations against symbols which do not require GOT entries in processRelocAux()
1171 // creation explicitly, i.e. do not have any GOT-relocations. So if in processRelocAux()
1187 // When producing an executable, we can perform copy relocations (for in processRelocAux()
1206 sec.relocations.push_back({expr, type, offset, addend, &sym}); in processRelocAux()
1256 sec.relocations.push_back({expr, type, offset, addend, &sym}); in processRelocAux()
1268 "or pass '-Wl,-z,notext' to allow text relocations in the output" + in processRelocAux()
1304 // marker relocations, e.g. R_*_NONE and R_ARM_V4BX. Don't error on them. in scanReloc()
1311 // Ignore R_*_NONE and other marker relocations. in scanReloc()
1316 warn("using ifunc symbols when text relocations are allowed may produce " in scanReloc()
1329 // We can separate the small code model relocations into 2 categories: in scanReloc()
1336 // so sections addressed with small code model relocations come first. in scanReloc()
1362 // Relax relocations. in scanReloc()
1399 // Process some TLS relocations, including relaxing TLS relocations. in scanReloc()
1400 // Note that this function does not handle all TLS relocations. in scanReloc()
1427 // relocations. In that case dynamic loader applies dynamic in scanReloc()
1428 // relocations to initialize TLS GOT entries. in scanReloc()
1448 // which is usually at the end of .rela.plt. Unlike most relocations in in scanReloc()
1451 // IRELATIVE relocs only, GOT-generating relocations can point directly to in scanReloc()
1456 // direct (non-GOT-generating, non-PLT-generating) relocations to the in scanReloc()
1470 // GOT-generating relocations. in scanReloc()
1474 // not require any form of dynamic relocation. To handle these relocations in scanReloc()
1475 // correctly, the IRELATIVE relocations are stored in an array which a in scanReloc()
1534 // Not all relocations end up in Sec.Relocations, but a lot do. in scanRelocs()
1535 sec.relocations.reserve(rels.size()); in scanRelocs()
1540 // Sort relocations by offset for more efficient searching for in scanRelocs()
1544 llvm::stable_sort(sec.relocations, in scanRelocs()
1614 // Relocations.cpp : Framework for creating and placing thunks
1898 // sections. There may be multiple relocations sharing the same (section, in getThunk()
1940 // Process all relocations from the InputSections that have been assigned
1956 // OutputSections. All relocations that needed a Thunk based on the information
1979 for (Relocation &rel : isec->relocations) { in createThunks()
2032 // hexagonNeedsTLSSymbol scans for relocations would require a call to
2040 for (Relocation &rel : isec->relocations) in hexagonNeedsTLSSymbol()
2057 for (Relocation &rel : isec->relocations) in hexagonTLSSymbolUpdate()