Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 433669
Collapse All | Expand All

(-)binutils-2.22/bfd/elf32-arm.c (-22 / +25 lines)
Lines 61-66 Link Here
61
#define ARM_ELF_ABI_VERSION		0
61
#define ARM_ELF_ABI_VERSION		0
62
#define ARM_ELF_OS_ABI_VERSION		ELFOSABI_ARM
62
#define ARM_ELF_OS_ABI_VERSION		ELFOSABI_ARM
63
63
64
typedef struct { bfd_vma v; } __attribute__((packed)) unaligned_bfd_vma;
65
typedef struct { bfd_signed_vma v; } __attribute__((packed)) unaligned_bfd_signed_vma;
66
64
static bfd_boolean elf32_arm_write_section (bfd *output_bfd,
67
static bfd_boolean elf32_arm_write_section (bfd *output_bfd,
65
					    struct bfd_link_info *link_info,
68
					    struct bfd_link_info *link_info,
66
					    asection *sec,
69
					    asection *sec,
Lines 7851-7858 Link Here
7851
  unsigned long                 r_type = howto->type;
7854
  unsigned long                 r_type = howto->type;
7852
  unsigned long                 r_symndx;
7855
  unsigned long                 r_symndx;
7853
  bfd_byte *                    hit_data = contents + rel->r_offset;
7856
  bfd_byte *                    hit_data = contents + rel->r_offset;
7854
  bfd_vma *                     local_got_offsets;
7857
  unaligned_bfd_vma *                     local_got_offsets;
7855
  bfd_vma *                     local_tlsdesc_gotents;
7858
  unaligned_bfd_vma *                     local_tlsdesc_gotents;
7856
  asection *                    sgot;
7859
  asection *                    sgot;
7857
  asection *                    splt;
7860
  asection *                    splt;
7858
  asection *                    sreloc = NULL;
7861
  asection *                    sreloc = NULL;
Lines 7900-7907 Link Here
7900
7903
7901
  eh = (struct elf32_arm_link_hash_entry *) h;
7904
  eh = (struct elf32_arm_link_hash_entry *) h;
7902
  sgot = globals->root.sgot;
7905
  sgot = globals->root.sgot;
7903
  local_got_offsets = elf_local_got_offsets (input_bfd);
7906
  local_got_offsets = (void *)elf_local_got_offsets (input_bfd);
7904
  local_tlsdesc_gotents = elf32_arm_local_tlsdesc_gotent (input_bfd);
7907
  local_tlsdesc_gotents = (void *)elf32_arm_local_tlsdesc_gotent (input_bfd);
7905
7908
7906
  if (globals->root.dynamic_sections_created)
7909
  if (globals->root.dynamic_sections_created)
7907
    srelgot = globals->root.srelgot;
7910
    srelgot = globals->root.srelgot;
Lines 9041-9049 Link Here
9041
	  bfd_vma off;
9044
	  bfd_vma off;
9042
9045
9043
	  BFD_ASSERT (local_got_offsets != NULL &&
9046
	  BFD_ASSERT (local_got_offsets != NULL &&
9044
		      local_got_offsets[r_symndx] != (bfd_vma) -1);
9047
		      local_got_offsets[r_symndx].v != (bfd_vma) -1);
9045
9048
9046
	  off = local_got_offsets[r_symndx];
9049
	  off = local_got_offsets[r_symndx].v;
9047
9050
9048
	  /* The offset must always be a multiple of 4.  We use the
9051
	  /* The offset must always be a multiple of 4.  We use the
9049
	     least significant bit to record whether we have already
9052
	     least significant bit to record whether we have already
Lines 9070-9076 Link Here
9070
		  elf32_arm_add_dynreloc (output_bfd, info, srelgot, &outrel);
9073
		  elf32_arm_add_dynreloc (output_bfd, info, srelgot, &outrel);
9071
		}
9074
		}
9072
9075
9073
	      local_got_offsets[r_symndx] |= 1;
9076
	      local_got_offsets[r_symndx].v |= 1;
9074
	    }
9077
	    }
9075
9078
9076
	  value = sgot->output_offset + off;
9079
	  value = sgot->output_offset + off;
Lines 9168-9175 Link Here
9168
	else
9171
	else
9169
	  {
9172
	  {
9170
	    BFD_ASSERT (local_got_offsets != NULL);
9173
	    BFD_ASSERT (local_got_offsets != NULL);
9171
	    off = local_got_offsets[r_symndx];
9174
	    off = local_got_offsets[r_symndx].v;
9172
	    offplt = local_tlsdesc_gotents[r_symndx];
9175
	    offplt = local_tlsdesc_gotents[r_symndx].v;
9173
	    tls_type = elf32_arm_local_got_tls_type (input_bfd)[r_symndx];
9176
	    tls_type = elf32_arm_local_got_tls_type (input_bfd)[r_symndx];
9174
	  }
9177
	  }
9175
9178
Lines 9321-9327 Link Here
9321
	    if (h != NULL)
9324
	    if (h != NULL)
9322
	      h->got.offset |= 1;
9325
	      h->got.offset |= 1;
9323
	    else
9326
	    else
9324
	      local_got_offsets[r_symndx] |= 1;
9327
	      local_got_offsets[r_symndx].v |= 1;
9325
	  }
9328
	  }
9326
9329
9327
	if ((tls_type & GOT_TLS_GD) && r_type != R_ARM_TLS_GD32)
9330
	if ((tls_type & GOT_TLS_GD) && r_type != R_ARM_TLS_GD32)
Lines 13248-13258 Link Here
13248
     relocs.  */
13251
     relocs.  */
13249
  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
13252
  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
13250
    {
13253
    {
13251
      bfd_signed_vma *local_got;
13254
      unaligned_bfd_signed_vma *local_got;
13252
      bfd_signed_vma *end_local_got;
13255
      unaligned_bfd_signed_vma *end_local_got;
13253
      struct arm_local_iplt_info **local_iplt_ptr, *local_iplt;
13256
      struct arm_local_iplt_info **local_iplt_ptr, *local_iplt;
13254
      char *local_tls_type;
13257
      char *local_tls_type;
13255
      bfd_vma *local_tlsdesc_gotent;
13258
      unaligned_bfd_vma *local_tlsdesc_gotent;
13256
      bfd_size_type locsymcount;
13259
      bfd_size_type locsymcount;
13257
      Elf_Internal_Shdr *symtab_hdr;
13260
      Elf_Internal_Shdr *symtab_hdr;
13258
      asection *srel;
13261
      asection *srel;
Lines 13294-13300 Link Here
13294
	    }
13297
	    }
13295
	}
13298
	}
13296
13299
13297
      local_got = elf_local_got_refcounts (ibfd);
13300
      local_got = (void *)elf_local_got_refcounts (ibfd);
13298
      if (!local_got)
13301
      if (!local_got)
13299
	continue;
13302
	continue;
13300
13303
Lines 13311-13317 Link Here
13311
	   ++local_got, ++local_iplt_ptr, ++local_tls_type,
13314
	   ++local_got, ++local_iplt_ptr, ++local_tls_type,
13312
	   ++local_tlsdesc_gotent, ++symndx)
13315
	   ++local_tlsdesc_gotent, ++symndx)
13313
	{
13316
	{
13314
	  *local_tlsdesc_gotent = (bfd_vma) -1;
13317
	  local_tlsdesc_gotent->v = (bfd_vma) -1;
13315
	  local_iplt = *local_iplt_ptr;
13318
	  local_iplt = *local_iplt_ptr;
13316
	  if (local_iplt != NULL)
13319
	  if (local_iplt != NULL)
13317
	    {
13320
	    {
Lines 13328-13334 Link Here
13328
		       run-time target.  This means that the .got entry
13331
		       run-time target.  This means that the .got entry
13329
		       would be the same as the .igot.plt entry, so there's
13332
		       would be the same as the .igot.plt entry, so there's
13330
		       no point creating both.  */
13333
		       no point creating both.  */
13331
		    *local_got = 0;
13334
		    local_got->v = 0;
13332
		}
13335
		}
13333
	      else
13336
	      else
13334
		{
13337
		{
Lines 13347-13366 Link Here
13347
		    elf32_arm_allocate_dynrelocs (info, psrel, p->count);
13350
		    elf32_arm_allocate_dynrelocs (info, psrel, p->count);
13348
		}
13351
		}
13349
	    }
13352
	    }
13350
	  if (*local_got > 0)
13353
	  if (local_got->v > 0)
13351
	    {
13354
	    {
13352
	      Elf_Internal_Sym *isym;
13355
	      Elf_Internal_Sym *isym;
13353
13356
13354
	      *local_got = s->size;
13357
	      local_got->v = s->size;
13355
	      if (*local_tls_type & GOT_TLS_GD)
13358
	      if (*local_tls_type & GOT_TLS_GD)
13356
		/* TLS_GD relocs need an 8-byte structure in the GOT.  */
13359
		/* TLS_GD relocs need an 8-byte structure in the GOT.  */
13357
		s->size += 8;
13360
		s->size += 8;
13358
	      if (*local_tls_type & GOT_TLS_GDESC)
13361
	      if (*local_tls_type & GOT_TLS_GDESC)
13359
		{
13362
		{
13360
		  *local_tlsdesc_gotent = htab->root.sgotplt->size
13363
		  local_tlsdesc_gotent->v = htab->root.sgotplt->size
13361
		    - elf32_arm_compute_jump_table_size (htab);
13364
		    - elf32_arm_compute_jump_table_size (htab);
13362
		  htab->root.sgotplt->size += 8;
13365
		  htab->root.sgotplt->size += 8;
13363
		  *local_got = (bfd_vma) -2;
13366
		  local_got->v = (bfd_vma) -2;
13364
		  /* plt.got_offset needs to know there's a TLS_DESC
13367
		  /* plt.got_offset needs to know there's a TLS_DESC
13365
		     reloc in the middle of .got.plt.  */
13368
		     reloc in the middle of .got.plt.  */
13366
                  htab->num_tls_desc++;
13369
                  htab->num_tls_desc++;
Lines 13372-13378 Link Here
13372
		{
13375
		{
13373
		  /* If the symbol is both GD and GDESC, *local_got
13376
		  /* If the symbol is both GD and GDESC, *local_got
13374
		     may have been overwritten.  */
13377
		     may have been overwritten.  */
13375
		  *local_got = s->size;
13378
		  local_got->v = s->size;
13376
		  s->size += 4;
13379
		  s->size += 4;
13377
		}
13380
		}
13378
13381
Lines 13398-13404 Link Here
13398
		}
13401
		}
13399
	    }
13402
	    }
13400
	  else
13403
	  else
13401
	    *local_got = (bfd_vma) -1;
13404
	    local_got->v = (bfd_vma) -1;
13402
	}
13405
	}
13403
    }
13406
    }
13404
13407

Return to bug 433669