| OLD | NEW |
| 1 /* 32-bit ELF support for TI C6X | 1 /* 32-bit ELF support for TI C6X |
| 2 Copyright 2010, 2011 | 2 Copyright 2010, 2011, 2012 |
| 3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
| 4 Contributed by Joseph Myers <joseph@codesourcery.com> | 4 Contributed by Joseph Myers <joseph@codesourcery.com> |
| 5 Bernd Schmidt <bernds@codesourcery.com> | 5 Bernd Schmidt <bernds@codesourcery.com> |
| 6 | 6 |
| 7 This file is part of BFD, the Binary File Descriptor library. | 7 This file is part of BFD, the Binary File Descriptor library. |
| 8 | 8 |
| 9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
| 10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
| 11 the Free Software Foundation; either version 3 of the License, or | 11 the Free Software Foundation; either version 3 of the License, or |
| 12 (at your option) any later version. | 12 (at your option) any later version. |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1663 /* Create .dsbt */ | 1663 /* Create .dsbt */ |
| 1664 flags = (SEC_ALLOC | SEC_LOAD | 1664 flags = (SEC_ALLOC | SEC_LOAD |
| 1665 | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); | 1665 | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); |
| 1666 htab->dsbt = bfd_make_section_anyway_with_flags (dynobj, ".dsbt", | 1666 htab->dsbt = bfd_make_section_anyway_with_flags (dynobj, ".dsbt", |
| 1667 flags); | 1667 flags); |
| 1668 if (htab->dsbt == NULL | 1668 if (htab->dsbt == NULL |
| 1669 || ! bfd_set_section_alignment (dynobj, htab->dsbt, 2) | 1669 || ! bfd_set_section_alignment (dynobj, htab->dsbt, 2) |
| 1670 || ! bfd_set_section_alignment (dynobj, htab->elf.splt, 5)) | 1670 || ! bfd_set_section_alignment (dynobj, htab->elf.splt, 5)) |
| 1671 return FALSE; | 1671 return FALSE; |
| 1672 | 1672 |
| 1673 htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); | 1673 htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss"); |
| 1674 if (!info->shared) | 1674 if (!info->shared) |
| 1675 htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss"); | 1675 htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss"); |
| 1676 | 1676 |
| 1677 if (!htab->sdynbss | 1677 if (!htab->sdynbss |
| 1678 || (!info->shared && !htab->srelbss)) | 1678 || (!info->shared && !htab->srelbss)) |
| 1679 abort (); | 1679 abort (); |
| 1680 | 1680 |
| 1681 return TRUE; | 1681 return TRUE; |
| 1682 } | 1682 } |
| 1683 | 1683 |
| 1684 static bfd_boolean | 1684 static bfd_boolean |
| 1685 elf32_tic6x_mkobject (bfd *abfd) | 1685 elf32_tic6x_mkobject (bfd *abfd) |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1842 } | 1842 } |
| 1843 | 1843 |
| 1844 if (h->got.offset != (bfd_vma) -1) | 1844 if (h->got.offset != (bfd_vma) -1) |
| 1845 { | 1845 { |
| 1846 asection *sgot; | 1846 asection *sgot; |
| 1847 asection *srela; | 1847 asection *srela; |
| 1848 | 1848 |
| 1849 /* This symbol has an entry in the global offset table. | 1849 /* This symbol has an entry in the global offset table. |
| 1850 Set it up. */ | 1850 Set it up. */ |
| 1851 | 1851 |
| 1852 sgot = bfd_get_section_by_name (dynobj, ".got"); | 1852 sgot = bfd_get_linker_section (dynobj, ".got"); |
| 1853 srela = bfd_get_section_by_name (dynobj, ".rela.got"); | 1853 srela = bfd_get_linker_section (dynobj, ".rela.got"); |
| 1854 BFD_ASSERT (sgot != NULL && srela != NULL); | 1854 BFD_ASSERT (sgot != NULL && srela != NULL); |
| 1855 | 1855 |
| 1856 /* If this is a -Bsymbolic link, and the symbol is defined | 1856 /* If this is a -Bsymbolic link, and the symbol is defined |
| 1857 locally, we just want to emit a RELATIVE reloc. Likewise if | 1857 locally, we just want to emit a RELATIVE reloc. Likewise if |
| 1858 the symbol was forced to be local because of a version file. | 1858 the symbol was forced to be local because of a version file. |
| 1859 The entry in the global offset table will already have been | 1859 The entry in the global offset table will already have been |
| 1860 initialized in the relocate_section function. */ | 1860 initialized in the relocate_section function. */ |
| 1861 if (info->shared | 1861 if (info->shared |
| 1862 && (info->symbolic | 1862 && (info->symbolic |
| 1863 || h->dynindx == -1 || h->forced_local) && h->def_regular) | 1863 || h->dynindx == -1 || h->forced_local) && h->def_regular) |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 if (info->nocopyreloc) | 2150 if (info->nocopyreloc) |
| 2151 { | 2151 { |
| 2152 h->non_got_ref = 0; | 2152 h->non_got_ref = 0; |
| 2153 return TRUE; | 2153 return TRUE; |
| 2154 } | 2154 } |
| 2155 | 2155 |
| 2156 htab = elf32_tic6x_hash_table (info); | 2156 htab = elf32_tic6x_hash_table (info); |
| 2157 if (htab == NULL) | 2157 if (htab == NULL) |
| 2158 return FALSE; | 2158 return FALSE; |
| 2159 | 2159 |
| 2160 if (h->size == 0) | |
| 2161 { | |
| 2162 (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), | |
| 2163 h->root.root.string); | |
| 2164 return TRUE; | |
| 2165 } | |
| 2166 | |
| 2167 /* We must allocate the symbol in our .dynbss section, which will | 2160 /* We must allocate the symbol in our .dynbss section, which will |
| 2168 become part of the .bss section of the executable. There will be | 2161 become part of the .bss section of the executable. There will be |
| 2169 an entry for this symbol in the .dynsym section. The dynamic | 2162 an entry for this symbol in the .dynsym section. The dynamic |
| 2170 object will contain position independent code, so all references | 2163 object will contain position independent code, so all references |
| 2171 from the dynamic object to this symbol will go through the global | 2164 from the dynamic object to this symbol will go through the global |
| 2172 offset table. The dynamic linker will use the .dynsym entry to | 2165 offset table. The dynamic linker will use the .dynsym entry to |
| 2173 determine the address it must put in the global offset table, so | 2166 determine the address it must put in the global offset table, so |
| 2174 both the dynamic object and the regular object will refer to the | 2167 both the dynamic object and the regular object will refer to the |
| 2175 same memory location for the variable. */ | 2168 same memory location for the variable. */ |
| 2176 | 2169 |
| 2177 /* We must generate a R_C6000_COPY reloc to tell the dynamic linker to | 2170 /* We must generate a R_C6000_COPY reloc to tell the dynamic linker to |
| 2178 copy the initial value out of the dynamic object and into the | 2171 copy the initial value out of the dynamic object and into the |
| 2179 runtime process image. */ | 2172 runtime process image. */ |
| 2180 if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) | 2173 if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) |
| 2181 { | 2174 { |
| 2182 htab->srelbss->size += sizeof (Elf32_External_Rela); | 2175 htab->srelbss->size += sizeof (Elf32_External_Rela); |
| 2183 h->needs_copy = 1; | 2176 h->needs_copy = 1; |
| 2184 } | 2177 } |
| 2185 | 2178 |
| 2186 s = htab->sdynbss; | 2179 s = htab->sdynbss; |
| 2187 | 2180 |
| 2188 return _bfd_elf_adjust_dynamic_copy (h, s); | 2181 return _bfd_elf_adjust_dynamic_copy (h, s); |
| 2189 } | 2182 } |
| 2190 | 2183 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2327 else | 2320 else |
| 2328 { | 2321 { |
| 2329 bfd_boolean warned; | 2322 bfd_boolean warned; |
| 2330 | 2323 |
| 2331 RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, | 2324 RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, |
| 2332 r_symndx, symtab_hdr, sym_hashes, | 2325 r_symndx, symtab_hdr, sym_hashes, |
| 2333 h, sec, relocation, | 2326 h, sec, relocation, |
| 2334 unresolved_reloc, warned); | 2327 unresolved_reloc, warned); |
| 2335 } | 2328 } |
| 2336 | 2329 |
| 2337 if (sec != NULL && elf_discarded_section (sec)) | 2330 if (sec != NULL && discarded_section (sec)) |
| 2338 RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | 2331 RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, |
| 2339 » » » » » rel, relend, howto, contents); | 2332 » » » » » rel, 1, relend, howto, 0, contents); |
| 2340 | 2333 |
| 2341 if (info->relocatable) | 2334 if (info->relocatable) |
| 2342 { | 2335 { |
| 2343 if (is_rel | 2336 if (is_rel |
| 2344 && sym != NULL | 2337 && sym != NULL |
| 2345 && ELF_ST_TYPE (sym->st_info) == STT_SECTION) | 2338 && ELF_ST_TYPE (sym->st_info) == STT_SECTION) |
| 2346 { | 2339 { |
| 2347 rel->r_addend = 0; | 2340 rel->r_addend = 0; |
| 2348 relocation = sec->output_offset + sym->st_value; | 2341 relocation = sec->output_offset + sym->st_value; |
| 2349 r = _bfd_relocate_contents (howto, input_bfd, relocation, | 2342 r = _bfd_relocate_contents (howto, input_bfd, relocation, |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3302 asection *s; | 3295 asection *s; |
| 3303 bfd_boolean relocs; | 3296 bfd_boolean relocs; |
| 3304 bfd *ibfd; | 3297 bfd *ibfd; |
| 3305 | 3298 |
| 3306 htab = elf32_tic6x_hash_table (info); | 3299 htab = elf32_tic6x_hash_table (info); |
| 3307 dynobj = htab->elf.dynobj; | 3300 dynobj = htab->elf.dynobj; |
| 3308 if (dynobj == NULL) | 3301 if (dynobj == NULL) |
| 3309 abort (); | 3302 abort (); |
| 3310 | 3303 |
| 3311 if (htab->elf.dynamic_sections_created) | 3304 if (htab->elf.dynamic_sections_created) |
error: old chunk mismatch |
None
| OLD | NEW |