Lines Matching defs:to

25    along with this program; if not, write to the Free Software
28 /* This file handles functionality common to the different MIPS ABI's. */
47 /* This structure is used to hold information about one GOT entry.
52 (2) SYMBOL + OFFSET addresses, where SYMBOL is local to an input bfd
61 that we need multiple GOTs, we can then use this information to
64 However, we want each of these separate GOTs to have at most one
71 mips_got_entry fields (tls_type and gotidx) to track the symbol's
75 to use the master GOT to describe it. There may therefore be several
77 We want to make sure that each symbol gets a unique GOT entry, so when
79 mips_got_entry fields, to track a symbol's GOT index. */
92 that should be added to the symbol value. */
95 corresponding to a global symbol in the got (or, local, if
107 /* The offset from the beginning of the .got section to the entry
108 corresponding to this symbol+addend. If it's a global symbol
109 whose offset is yet to be decided, it's going to be -1. */
113 /* This structure is used to hold .got information when linking. */
133 /* A hash table mapping input bfds to other mips_got_info. NULL
136 /* In multi-got links, a pointer to the next got (err, rather, most
137 of the time, it points to the previous got). */
146 /* Map an input bfd to a got in a multi-got link. */
153 /* Structure passed when traversing the bfd2got hash table, used to
158 /* A hashtable that maps bfds to gots. */
164 /* A pointer to the primary got, i.e., the one that's going to get
168 /* A non-primary got we're trying to merge with other input bfd's
185 /* Another structure used to pass arguments for got entries traversal. */
195 /* A structure used to count TLS relocations or GOT entries, for GOT
217 /* This structure is passed to mips_elf_sort_hash_table_f when sorting
225 /* The least dynamic symbol table index corresponding to a non-TLS
228 /* The greatest dynamic symbol table index corresponding to a symbol
230 with dynamic relocations pointing to it from non-primary GOTs). */
232 /* The greatest dynamic symbol table index not corresponding to a
256 related to taking the function's address, i.e. any but
261 /* If there is a stub that 32 bit functions should use to call this
262 16 bit function, this points to the section containing the stub. */
269 /* If there is a stub that 16 bit functions should use to call this
270 32 bit function, this points to the section containing the stub. */
278 the initial global GOT entry to a local GOT entry. */
297 structures all referring to the same GOT slot. It might be
298 possible to use root.got.offset instead, but that field is
318 entry is set to the address of __rld_obj_head as in IRIX5. */
326 /* Shortcuts to some dynamic sections, or NULL if they are not
357 /* Structure used to pass information to mips_elf_output_extsym. */
378 /* These structures are used to generate the .compact_rel section on
408 unsigned long vaddr; /* VADDR to be relocated. */
433 /* These are the constants used to swap the bitfields in a crinfo. */
457 CT_MIPS_JMPAD Address to jump
485 struct exception_info *exception_info;/* Pointer to exception array. */
529 /* Whether we are trying to be compatible with IRIX at all. */
629 /* The maximum size of the GOT for it to be addressable using 16-bit
682 /* The mips16 compiler uses a couple of special sections to handle
686 copy floating point arguments from the fp regs to the gp regs and
687 then jump to FNNAME. If any 32 bit function calls FNNAME, the
688 call should be redirected to the stub instead. If no 32 bit
689 function calls FNNAME, the stub should be discarded. We need to
690 consider any reference to the function, not just a call, because
692 since the address might be passed to a 32 bit function.
695 that copy floating point arguments from the gp regs to the fp
696 regs and then jump to FNNAME. If FNNAME is a 32 bit function,
698 to the stub instead. If FNNAME is not a 32 bit function, the
703 to the gp regs. These stubs store the return value in $18 while
705 must arrange to save $18 around the call. (This case is not
832 /* We use -2 as a marker to indicate that the information has
894 /* The symbolic header contains absolute file offsets and sizes to
1138 /* We don't need the fn_stub; the only references to this symbol
1139 are 16 bit calls. Clobber the size to 0 to prevent it from
1152 to 0 to prevent it from being included in the link. */
1164 to 0 to prevent it from being included in the link. */
1194 R_MIPS16_26 reloc to be against a section, so the addend is
1206 immediate value as shown above, and don't forget to store the
1250 All we need to do here is shuffle the bits appropriately. As
1254 R_MIPS16_HI16 and R_MIPS16_LO16 are used in mips16 mode to
1341 /* Set val to the offset into the section or symbol. */
1347 are producing relocatable output, we don't want to do this for
1370 /* Used to store a REL high-part relocation such as R_MIPS_HI16 or
1372 that contains the relocation field and DATA points to the start of
1393 *HI16s to be associated with a single *LO16. This significantly
1424 like any other 16-bit relocation when applied to global symbols, but is
1425 treated in the same as R_MIPS_HI16 when applied to local symbols. */
1473 want to install the addend in the same way as for a R_MIPS_HI16
1544 we just need to add VAL to that addend. Otherwise we need to add
1545 VAL to the relocation field itself. */
1555 /* Add VAL to the relocation field. */
1706 /* This function is called via qsort() to sort the dynamic relocation
1761 /* This routine is used to write out ECOFF debugging external symbol
1951 /* A comparison routine used to sort .gptab entries. */
1963 /* Functions to manage the got entry hash table. */
1979 use all fields to compute the hash, and compare the appropriate
2054 /* Return the dynamic relocation section. If it doesn't exist, try to
2364 /* Return the GOT index to use for a relocation of type R_TYPE against
2434 entry for this value, create one. If R_SYMNDX refers to a TLS symbol,
2458 hash table entry to track the index. */
2540 indices into the GOT. That makes it easy to calculate the GOT
2551 /* Find a GOT page entry that points to within 32KB of VALUE. These
2552 entries are supposed to be placed at small offsets in the GOT, i.e.,
2554 entry could be created. If OFFSETP is nonnull, use it to return the
2631 from a symbol belonging to INPUT_SECTON. Return NULL if it could not
2632 be created. If R_SYMNDX refers to a TLS symbol, create a TLS entry
2745 required. MAX_LOCAL is used to set the number of local symbols
2746 known to be in the dynamic symbol table. During
2768 referenced, we move them to the end of the GOT, so that they
2778 /* There should have been enough room in the symbol table to
2834 symbol table index lower than any we've seen to date, record it for
2860 /* Make sure we have a GOT to put this entry into. */
2872 need to do it again. */
2892 /* By setting this to a value other than -1, we are indicating that
2893 there needs to be a GOT entry for H. Avoid using zero, as the
2988 /* In a multi-got link, determine the GOT to be used for IBFD. G must
3089 /* Attempt to merge gots of different input bfds. Try to use as much
3093 attempt to merge with the current got, or finish the current got
3110 sure not to merge a GOT which requires TLS with the primary GOT in that
3129 don't have to squeeze it too hard. */
3147 /* We don't have to worry about releasing memory of the actual
3218 hash table entry to track its index. */
3231 a GOT resolve to the same index. */
3253 to tell whether a global symbol needs a got entry (in the primary
3254 got) to the given VALUE.
3256 If passed a pointer G to a mips_got_info in the argument (it must
3258 the (primary) GOT section to the entry in G corresponding to the
3316 points to the final symbol definition. P must point to a pointer
3317 to the hash table we're traversing. Since this traversal may
3318 modify the hash table, we set this pointer to NULL to indicate
3319 we've made a potentially-destructive change to the hash table, so
3349 moved, and leave it up to the parent to restart the
3354 /* We might want to decrement the global_gotno count, but it's
3422 map from bfd to got info while at that. */
3436 See the calls to mips_elf_set_global_got_offset below for more
3440 /* Try to merge the GOTs of input bfds together, as long as they
3441 don't seem to exceed the maximum GOT size, choosing one of them
3442 to be the primary GOT. */
3477 /* Map the output bfd to the primary got. That's what we're going
3478 to use for bfds that use GOT16 or GOT_PAGE relocations that we
3479 didn't mark in check_relocs, and we want a quick way to find it.
3480 We can't just use gg->next because we're going to reverse the
3501 in a dynamic relocation to be present in the primary GOT, so
3502 arrange for them to appear after those that are actually
3506 the dynamic linker, since it would have to resolve every dynamic
3512 The number 2 is used by mips_elf_sort_hash_table_f to count
3526 symbol resolution while applying relocations so as to use
3528 With this code, we assign lower dynamic indices to global
3547 [assigned_gotno, local_gotno[ will be set to the range of local
3549 adding local_gotno to global_gotno. We reverse the list and make
3550 it circular since then we'll be able to quickly compute the
3554 we arrange for the main got struct to have the right number of
3558 points back to the master GOT. */
3575 list that gg points to. g->next is guaranteed to be nonnull after
3652 /* Look up the hash table to check whether the symbol
3761 /* Create the .got section to hold the global offset table. */
3792 /* We have to use an alignment of 2**4 here because this is hardcoded
3800 linker script because we don't want to define the symbol if we
3853 /* Return true if H refers to the special VxWorks __GOTT_BASE__ or
3868 the INPUT_BFD). The ADDEND is the addend to use for this
3878 overflow occurs, and bfd_reloc_ok to indicate success. */
3896 /* The final GP value to be used for the relocatable, executable, or
3902 /* The value of GP used to create the relocatable object. */
3912 /* TRUE if the symbol referred to by this relocation is a local
3915 /* TRUE if the symbol referred to by this relocation is "_gp_disp". */
3917 /* TRUE if the symbol referred to by this relocation is
3927 /* TRUE if this relocation refers to a MIPS16 function. */
4029 linker, so it's inappropriate to check to see whether or not
4046 and check to see if they exist by looking at their
4067 /* This is an optional symbol - an Irix specific extension to the
4069 XXX - FIXME - there is more to the spec for OPTIONAL symbols
4090 /* If this is a 32- or 64-bit call to a 16-bit function with a stub, we
4091 need to redirect the call to the stub, unless we're already *in*
4100 /* This is a 32- or 64-bit call to a 16-bit function. We should
4101 have already noticed that we were going to need the
4115 /* If this is a 16-bit call to a 32- or 64-bit function with a stub, we
4116 need to redirect the call to the stub. */
4129 out which one to use by checking which one appears in the input
4157 /* Calls from 16-bit code to 32-bit code and vice versa require the
4167 and we're going to need it, get it now. */
4172 /* We need to decay to GOT_DISP/addend if the symbol doesn't
4199 /* On VxWorks, CALL relocations should refer to the .got.plt
4200 entry, which is initialized to point at the PLT stub. */
4213 GOT_PAGE relocation that decays to GOT_DISP because the
4214 symbol turns out to be global. The addend is then added
4226 symbol is defined locally, or was forced to be local.
4245 /* Convert GOT indices to actual offsets. */
4272 symbols are resolved by the loader. Add them to .rela.dyn. */
4290 we need to set DF_TEXTREL again, so that we do not delete the
4325 record in the output, and leave the job up to the dynamic
4328 In VxWorks executables, references to external symbols
4330 no need to add a dynamic relocation here. */
4361 mips_elf_perform_relocation. So, we just fall through to the
4455 shared literals, and then we will need to additional work
4463 order. We don't need to do anything special here; the
4476 to them before. */
4485 R_MIPS_GOT16; every relocation evaluates to "G". */
4529 /* We're allowed to handle these two relocations identically.
4530 The dynamic linker is allowed to handle the CALL relocations
4544 to GOT_DISP. The corresponding GOT_OFST relocation decays to
4585 it into a bal instruction. But we don't try to optimize
4586 branches to the PLT; that will wind up wasting time. */
4625 VALUE. Use HOWTO to place VALUE into the output file at the
4626 appropriate position. The SECTION is the section to which the
4629 unconditionally converted to JALX.
4666 /* Check to see if the opcode is already JAL or JALX. */
4682 (_("%B: %A+0x%lx: jump to stub routine which is not jal"),
4741 /* Add room for N relocations to the .rel(a).dyn section in ABFD. */
4768 /* Create a rel.dyn relocation for the dynamic linker to resolve. REL
4816 the field to be fully relocated, so add in the symbol's value. */
4821 /* We must now calculate the dynamic symbol table index to use
4831 /* ??? glibc's ld.so just adds the final GOT entry to the
4860 relocation. We want to avoid generating relocations to
4861 local symbols because we used to generate them
4864 order to give dynamic loaders and applications time to
4879 this symbol will not be referred to by the relocation, we must
4881 Otherwise leave the job up to the dynamic linker. */
4894 /* For strict adherence to the ABI specification, we should
4899 loaders seems to care, we don't waste space with these
4900 artificial relocations. If this turns out to not be true,
4902 as to make room for a pair of dynamic relocations per
4912 /* Adjust the output offset of the relocation to reference the
4921 /* Put the relocation back out. We have to use the special
4949 will be writing to it. */
4985 we need to set DF_TEXTREL again, so that we do not delete the
5131 either resolve these symbols to something in a shared
5133 we can consider these symbols to be in a new section. */
5189 to the base of the .text section. So substract the section
5190 base address to make it an offset. */
5205 to the base of the .data section. So substract the section
5206 base address to make it an offset. */
5227 have no special marking to distinguish them from LP64 objects.
5229 We don't want users of the official LP64 ABI to be punished for the
5231 to mistakenly interpret pre-4.0 ILP32 objects as being LP64 objects.
5234 - If ABFD contains a .gcc_compiled_longXX section, use it to
5242 The second check is enough to detect LP64 objects generated by pre-4.0
5249 reason to use R_MIPS_64 in an ILP32 object. Pre-4.0 compilers never
5282 /* There appears to be a bug in the MIPSpro linker that causes GOT_DISP
5283 relocations against two unnamed section symbols to resolve to the
5290 then the linker will resolve both relocations to .data and the program
5291 will jump there rather than to .text.
5293 We can work around this problem by giving names to local section symbols.
5305 sections that need the SHF_MIPS_GPREL flag by name; there has to be
5337 so that we don't have to read them again.
5339 through the section contents to see if there is an
5438 FIXME: We need to handle the SHF_MIPS_GPREL flag, but I'm not sure
5439 how to. */
5449 /* There ought to be a place to keep ELF backend specific flags, but
5609 section name, which is a hack, but ought to work. This routine is
5717 kind of relocations. We used to set up a second header for the
5725 /* Given a BFD section, try to locate the corresponding ELF section
5727 Actually, it's not clear to me that the 64-bit ABI supports these,
5768 a SECTION *ABS*. This causes ld to think it can resolve _gp_disp
5830 /* This code used to do *secp = bfd_und_section_ptr if
5871 /* This code used to do *secp = bfd_und_section_ptr if
5908 /* If this is a mips16 text symbol, add 1 to the value to make it
5909 odd. This will cause something like .word SYM to come up with
5971 /* We need to create .got section. */
6026 /* We need to create a .compact_rel section. */
6073 and is filled in by the rtld to contain a pointer to
6175 /* Look at the relocation information to figure out which symbol
6187 than a 16 bit function call, which refers to this symbol. */
6222 the linker maps input sections to output sections, we
6251 /* We don't need to set mips16_stubs_seen in this case.
6252 That flag is used to see whether we need to look through
6253 the global symbol table for stubs. We don't need to set
6272 to output sections, we can easily discard it by setting the
6291 /* Look at the relocation information to figure out which symbol
6303 that refers to this symbol. */
6338 the linker maps input sections to output sections, we
6367 /* We don't need to set mips16_stubs_seen in this case.
6368 That flag is used to see whether we need to look through
6369 the global symbol table for stubs. We don't need to set
6387 to output sections, we can easily discard it by setting the
6488 /* In VxWorks executables, references to external symbols
6490 no need to add a dynamic relocation here. */
6507 __GOTT_INDEX__ symbols must be left to the loader. Allocate
6532 the segment. Similar comments apply to R_MIPS_GOT16 and
6534 always evaluate to "G". We don't count R_MIPS_GOT_HI16, or
6576 decay to GOT_DISP, so we'll need a GOT entry for it. */
6649 /* In VxWorks executables, references to external symbols
6651 no need to add a .rela.dyn entry for this relocation. */
6676 /* We only need to copy this reloc if the symbol is
6681 /* We need it to tell the dynamic linker if there
6690 to VxWorks, which does not have the usual coupling
6746 related to taking the function's address. This doesn't apply to
6747 VxWorks, where CALL relocs refer to a .got.plt entry instead of
6820 with a JALR relocation, that indicate where they jump to.
6886 /* Compute branch offset, from delay slot of the jump to the
6953 dynamic object, but we're not including those sections. We have to
6954 change the definition to something the rest of the link can
6977 /* If this symbol is defined in a dynamic object, we need to copy
7002 the symbol to the stub location. This is required to make
7029 /* This will set the entry for this symbol in the GOT to 0, and
7036 processor independent code will have arranged for us to see the
7047 /* This is a reference to a symbol defined by a dynamic object which
7077 either (a) we want to branch to the symbol or (b) we're linking an
7091 /* Locally-binding symbols do not need a PLT stub; we can refer to
7104 /* If this is the first symbol to need a PLT entry, allocate room
7113 /* Assign the next .plt entry to this symbol. */
7118 symbol's value to the address of the stub. For executables,
7152 processor independent code will have arranged for us to see the
7163 /* This is a reference to a symbol defined by a dynamic object which
7172 from the dynamic object to this symbol will go through the global
7173 offset table. The dynamic linker will use the .dynsym entry to
7175 both the dynamic object and the regular object will refer to the
7190 much information is available to elf_backend_omit_section_dynsym at
7215 and the input sections have been assigned to output sections. We
7274 /* There has to be a global GOT entry for every symbol with
7276 higher. Therefore, it make sense to put those symbols
7302 one to account for the dummy entry at the end required by IRIX
7307 /* There's no need to allocate page entries for VxWorks; R_MIPS_GOT16
7308 relocations against local symbols evaluate to "G", and the EABI does
7322 /* We need to calculate tls_gotno for global symbols at this point
7323 instead of building it up earlier, to avoid doublecounting
7335 /* VxWorks does not support multiple GOTs. It initializes $gp to
7370 /* Set the contents of the .interp section to the interpreter. */
7391 /* It's OK to base decisions on the section name, because none
7405 /* If this relocation section applies to a read only
7409 there exists a relocation to a read only section or
7421 to copy relocs into the output file. */
7454 to versions that we must now resolve in the got_entries
7467 find any indirect entries to resolve? They were all
7476 /* Assign offsets to global GOT entries. */
7529 rtld to contain a pointer to the _r_debug structure. */
7582 /* Add some entries to the .dynamic section. We fill in the
7613 absolute relocations have been converted to PC-relative. */
7698 /* REL is a relocation in INPUT_BFD that is being copied to OUTPUT_BFD.
7727 /* Adjust REL's addend to account for section merging. */
7823 stored value is sign-extended to 64 bits. */
7826 /* On big-endian systems, we need to lie about the position
7886 Scan ahead to find a matching LO16 relocation.
7888 According to the MIPS ELF ABI, the R_MIPS_LO16
7975 mask because the place to which we are writing will be
7981 ABI. Here, we need to update the addend. It would be
7982 possible to get away with just using the R_MIPS_32 reloc
8025 /* Go on to the next relocation. */
8031 supposed to treat the output of each relocation as the addend
8040 /* Figure out what value we are supposed to relocate. */
8049 /* There's nothing to do. */
8055 trying to perform the relocation at this point, so we
8056 just skip ahead to the next relocation. */
8100 sign-extend the 32-bit result to 64-bits, and store it as a
8102 go to extreme lengths to support this usage on systems with
8237 /* Values up to 2^31 - 1 are allowed. Larger values would cause
8276 to reset the global offset table entry for this external
8277 to its stub address when unlinking a shared object. */
8330 /* Create an R_MIPS_REL32 relocation for this entry. Due to
8331 the various compatibility problems, it's easier to mock
8333 mips_elf_create_dynamic_relocation to calculate the
8430 /* If this is a mips16 symbol, force the value to be even. */
8483 entry. The branch jumps to the beginning of .plt. */
8602 /* If this is a mips16 symbol, force the value to be even. */
8693 /* We just need to copy the entry byte-by-byte. */
8749 /* Assume that we're going to modify it and write it out. */
8773 /* _GLOBAL_OFFSET_TABLE_ is defined to be the beginning
8837 to setting DT_MIPS_GOTSYM to the same value as
8930 /* The first entry of the global offset table points to the
8934 to the lazy resolution stub. */
9015 /* Assume that we're going to modify it and write it out. */
9021 /* Reduce DT_RELSZ to account for any relocations we
9022 decided not to make. This is for the n64 irix rld,
9023 which doesn't seem to apply any relocations if there
9031 can reasonably expect the values to the same. */
9373 /* We want to put it after the PHDR and INTERP segments. */
9386 .dynamic end up in PT_DYNAMIC. However, we do have to insert a
9459 /* We want to put it after the DYNAMIC segment. */
9497 which might move one of the other sections to a different
9562 If the prelinker needs to make room for a new PT_LOAD entry, its
9563 standard procedure is to move the first (read-only) sections into
9565 .dynamic to be in a read-only segment, and the section will often
9568 Although the prelinker could in principle move .dynamic to a
9569 writable segment, it seems better to allocate a spare program
9570 header instead, and avoid the need to move any sections.
9605 /* ??? Do mips16 stub sections need to be handled special? */
9653 so it is not possible to garbage collect them at this time. */
9665 /* Copy data from a MIPS ELF indirect symbol to its direct symbol,
9719 /* Since we're turning what used to be a global symbol into a
9841 bfd_byte *to, *from, *end;
9850 to = contents;
9858 if (to != from)
9859 memcpy (to, from, PDR_SIZE);
9860 to += PDR_SIZE;
9952 /* Note that we don't bother to ever free this information.
9957 good idea for free_cached_info to throw it away. */
10029 /* This is almost identical to bfd_generic_get_... except that some
10030 MIPS relocations need to be handled specially. Sigh. */
10041 /* Get enough memory to hold the stuff */
10074 bfd_vma gp = 0x12345678; /* initialize just to shut gcc up */
10122 /* Specific to MIPS: Deal with relocation types that require
10126 /* If we've managed to find the gp and have a special
10128 to the generic handling. */
10258 /* We need to use a special link routine to handle the .reginfo and
10259 the .mdebug sections. We need to merge all instances of these
10294 Rather than trying somehow to prevent the renumbering, just do
10306 symbols we're going to add. The generic ELF linker only
10354 /* And calculate GP relative to that. */
10359 /* If the relocate_section function needs to do a reloc
10361 callback to warn that GP is not defined. */
10521 want to deal with it. */
10543 interesting information, try to find the symbol in
10853 /* Invoke the regular ELF backend linker to do all the work. */
10918 /* An array describing how BFD machines relate to one another. The entries
10937 better to allow vr5400 and vr5500 code to be merged anyway, since
11034 /* Use the Tag_null value to indicate the attributes have been
11127 /* Merge backend specific data from an object file to the output
11193 doesn't seem to matter. */
11198 just be able to ignore this. */
11211 /* Check to see if the input BFD actually contains any sections.
11264 /* Copy the architecture info from IBFD to OBFD. Also copy
11265 the 32-bit flag (if set) so that we continue to recognise
11273 and if that was what caused us to treat IBFD as 32-bit. */
11300 /* Only error if both are set (to different values). */
11344 /* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */