Deleted Added
full compact
elf32-sparc.c (104834) elf32-sparc.c (107492)
1/* SPARC-specific support for 32-bit ELF
2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4
5This file is part of BFD, the Binary File Descriptor library.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by

--- 1284 unchanged lines hidden (view full) ---

1293
1294 /* The offset must always be a multiple of 4. We use
1295 the least significant bit to record whether we have
1296 already processed this entry. */
1297 if ((off & 1) != 0)
1298 off &= ~1;
1299 else
1300 {
1/* SPARC-specific support for 32-bit ELF
2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4
5This file is part of BFD, the Binary File Descriptor library.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by

--- 1284 unchanged lines hidden (view full) ---

1293
1294 /* The offset must always be a multiple of 4. We use
1295 the least significant bit to record whether we have
1296 already processed this entry. */
1297 if ((off & 1) != 0)
1298 off &= ~1;
1299 else
1300 {
1301 bfd_put_32 (output_bfd, relocation, sgot->contents + off);
1302
1303 if (info->shared)
1304 {
1305 asection *srelgot;
1306 Elf_Internal_Rela outrel;
1307
1308 /* We need to generate a R_SPARC_RELATIVE reloc
1309 for the dynamic linker. */
1310 srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
1311 BFD_ASSERT (srelgot != NULL);
1312
1313 outrel.r_offset = (sgot->output_section->vma
1314 + sgot->output_offset
1315 + off);
1316 outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
1301
1302 if (info->shared)
1303 {
1304 asection *srelgot;
1305 Elf_Internal_Rela outrel;
1306
1307 /* We need to generate a R_SPARC_RELATIVE reloc
1308 for the dynamic linker. */
1309 srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
1310 BFD_ASSERT (srelgot != NULL);
1311
1312 outrel.r_offset = (sgot->output_section->vma
1313 + sgot->output_offset
1314 + off);
1315 outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
1317 outrel.r_addend = 0;
1316 outrel.r_addend = relocation;
1317 relocation = 0;
1318 bfd_elf32_swap_reloca_out (output_bfd, &outrel,
1319 (((Elf32_External_Rela *)
1320 srelgot->contents)
1321 + srelgot->reloc_count));
1322 ++srelgot->reloc_count;
1323 }
1324
1318 bfd_elf32_swap_reloca_out (output_bfd, &outrel,
1319 (((Elf32_External_Rela *)
1320 srelgot->contents)
1321 + srelgot->reloc_count));
1322 ++srelgot->reloc_count;
1323 }
1324
1325 bfd_put_32 (output_bfd, relocation, sgot->contents + off);
1325 local_got_offsets[r_symndx] |= 1;
1326 }
1327 }
1328 relocation = sgot->output_offset + off - got_base;
1329 break;
1330
1331 case R_SPARC_PLT32:
1332 if (h == NULL || h->plt.offset == (bfd_vma) -1)

--- 489 unchanged lines hidden (view full) ---

1822 /* If this is a -Bsymbolic link, and the symbol is defined
1823 locally, we just want to emit a RELATIVE reloc. Likewise if
1824 the symbol was forced to be local because of a version file.
1825 The entry in the global offset table will already have been
1826 initialized in the relocate_section function. */
1827 if (info->shared
1828 && (info->symbolic || h->dynindx == -1)
1829 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
1326 local_got_offsets[r_symndx] |= 1;
1327 }
1328 }
1329 relocation = sgot->output_offset + off - got_base;
1330 break;
1331
1332 case R_SPARC_PLT32:
1333 if (h == NULL || h->plt.offset == (bfd_vma) -1)

--- 489 unchanged lines hidden (view full) ---

1823 /* If this is a -Bsymbolic link, and the symbol is defined
1824 locally, we just want to emit a RELATIVE reloc. Likewise if
1825 the symbol was forced to be local because of a version file.
1826 The entry in the global offset table will already have been
1827 initialized in the relocate_section function. */
1828 if (info->shared
1829 && (info->symbolic || h->dynindx == -1)
1830 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
1830 rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
1831 {
1832 asection *sec = h->root.u.def.section;
1833 rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
1834 rela.r_addend = (h->root.u.def.value
1835 + sec->output_section->vma
1836 + sec->output_offset);
1837 }
1831 else
1832 {
1838 else
1839 {
1833 bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
1834 rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
1840 rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
1841 rela.r_addend = 0;
1835 }
1836
1842 }
1843
1837 rela.r_addend = 0;
1844 bfd_put_32 (output_bfd, (bfd_vma) 0,
1845 sgot->contents + (h->got.offset &~ (bfd_vma) 1));
1838 bfd_elf32_swap_reloca_out (output_bfd, &rela,
1839 ((Elf32_External_Rela *) srela->contents
1840 + srela->reloc_count));
1841 ++srela->reloc_count;
1842 }
1843
1844 if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
1845 {

--- 306 unchanged lines hidden ---
1846 bfd_elf32_swap_reloca_out (output_bfd, &rela,
1847 ((Elf32_External_Rela *) srela->contents
1848 + srela->reloc_count));
1849 ++srela->reloc_count;
1850 }
1851
1852 if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
1853 {

--- 306 unchanged lines hidden ---