~ubuntu-branches/debian/squeeze/binutils/squeeze

« back to all changes in this revision

Viewing changes to bfd/elf64-x86-64.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-09-10 17:05:30 UTC
  • mfrom: (1.4.5 upstream) (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090910170530-wa6gpju9pq5c56on
Tags: 2.19.91.20090910-1
* Snapshot, taken from the 2.20 release branch 20090910, corresponding
  to the 2.19.90 upstream snapshot.
* Fix Thumb-2 shared libraries (Daniel Jacobowitz), patch taken
  from the trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* X86-64 specific support for 64-bit ELF
2
 
   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 
2
   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
3
3
   Free Software Foundation, Inc.
4
4
   Contributed by Jan Hubicka <jh@suse.cz>.
5
5
 
517
517
     subclass.  */
518
518
  if (entry == NULL)
519
519
    {
520
 
      entry = bfd_hash_allocate (table,
521
 
                                 sizeof (struct elf64_x86_64_link_hash_entry));
 
520
      entry = (struct bfd_hash_entry *)
 
521
          bfd_hash_allocate (table,
 
522
                             sizeof (struct elf64_x86_64_link_hash_entry));
522
523
      if (entry == NULL)
523
524
        return entry;
524
525
    }
950
951
    case R_X86_64_GOTPC32_TLSDESC:
951
952
    case R_X86_64_TLSDESC_CALL:
952
953
    case R_X86_64_GOTTPOFF:
953
 
      if (!info->shared)
 
954
      if (info->executable)
954
955
        {
955
956
          if (h == NULL)
956
957
            to_type = R_X86_64_TPOFF32;
965
966
        {
966
967
          unsigned int new_to_type = to_type;
967
968
 
968
 
          if (!info->shared
 
969
          if (info->executable
969
970
              && h != NULL
970
971
              && h->dynindx == -1
971
972
              && tls_type == GOT_TLS_IE)
989
990
      break;
990
991
 
991
992
    case R_X86_64_TLSLD:
992
 
      if (!info->shared)
 
993
      if (info->executable)
993
994
        to_type = R_X86_64_TPOFF32;
994
995
      break;
995
996
 
1231
1232
          goto create_got;
1232
1233
 
1233
1234
        case R_X86_64_TPOFF32:
1234
 
          if (info->shared)
 
1235
          if (!info->executable)
1235
1236
            {
1236
1237
              if (h)
1237
1238
                name = h->root.root.string;
1248
1249
          break;
1249
1250
 
1250
1251
        case R_X86_64_GOTTPOFF:
1251
 
          if (info->shared)
 
1252
          if (!info->executable)
1252
1253
            info->flags |= DF_STATIC_TLS;
1253
1254
          /* Fall through */
1254
1255
 
1942
1943
  /* If R_X86_64_GOTTPOFF symbol is now local to the binary,
1943
1944
     make it a R_X86_64_TPOFF32 requiring no GOT entry.  */
1944
1945
  if (h->got.refcount > 0
1945
 
      && !info->shared
 
1946
      && info->executable
1946
1947
      && h->dynindx == -1
1947
1948
      && elf64_x86_64_hash_entry (h)->tls_type == GOT_TLS_IE)
1948
1949
    {
3632
3633
          break;
3633
3634
 
3634
3635
        case R_X86_64_DTPOFF32:
3635
 
          if (info->shared || (input_section->flags & SEC_CODE) == 0)
 
3636
          if (!info->executable|| (input_section->flags & SEC_CODE) == 0)
3636
3637
            relocation -= elf64_x86_64_dtpoff_base (info);
3637
3638
          else
3638
3639
            relocation = elf64_x86_64_tpoff (info, relocation);
3639
3640
          break;
3640
3641
 
3641
3642
        case R_X86_64_TPOFF32:
3642
 
          BFD_ASSERT (! info->shared);
 
3643
          BFD_ASSERT (info->executable);
3643
3644
          relocation = elf64_x86_64_tpoff (info, relocation);
3644
3645
          break;
3645
3646
 
3883
3884
            }
3884
3885
          else
3885
3886
            {
 
3887
              asection *plt;
 
3888
 
3886
3889
              if (!h->pointer_equality_needed)
3887
3890
                abort ();
3888
3891
 
3889
3892
              /* For non-shared object, we can't use .got.plt, which
3890
3893
                 contains the real function addres if we need pointer
3891
3894
                 equality.  We load the GOT entry with the PLT entry.  */
3892
 
              asection *plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt;
 
3895
              plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt;
3893
3896
              bfd_put_64 (output_bfd, (plt->output_section->vma
3894
3897
                                       + plt->output_offset
3895
3898
                                       + h->plt.offset),
4483
4486
#define elf64_bed elf64_x86_64_fbsd_bed
4484
4487
 
4485
4488
#include "elf64-target.h"
 
4489
 
 
4490
/* Intel L1OM support.  */
 
4491
 
 
4492
static bfd_boolean
 
4493
elf64_l1om_elf_object_p (bfd *abfd)
 
4494
{
 
4495
  /* Set the right machine number for an L1OM elf64 file.  */
 
4496
  bfd_default_set_arch_mach (abfd, bfd_arch_l1om, bfd_mach_l1om);
 
4497
  return TRUE;
 
4498
}
 
4499
 
 
4500
#undef  TARGET_LITTLE_SYM
 
4501
#define TARGET_LITTLE_SYM                   bfd_elf64_l1om_vec
 
4502
#undef  TARGET_LITTLE_NAME
 
4503
#define TARGET_LITTLE_NAME                  "elf64-l1om"
 
4504
#undef ELF_ARCH
 
4505
#define ELF_ARCH                            bfd_arch_l1om
 
4506
 
 
4507
#undef  ELF_MACHINE_CODE
 
4508
#define ELF_MACHINE_CODE                    EM_L1OM
 
4509
 
 
4510
#undef  ELF_OSABI
 
4511
 
 
4512
#undef  elf64_bed
 
4513
#define elf64_bed elf64_l1om_bed
 
4514
 
 
4515
#undef elf_backend_object_p
 
4516
#define elf_backend_object_p                elf64_l1om_elf_object_p
 
4517
 
 
4518
#undef  elf_backend_post_process_headers
 
4519
 
 
4520
#include "elf64-target.h"
 
4521
 
 
4522
/* FreeBSD L1OM support.  */
 
4523
 
 
4524
#undef  TARGET_LITTLE_SYM
 
4525
#define TARGET_LITTLE_SYM                   bfd_elf64_l1om_freebsd_vec
 
4526
#undef  TARGET_LITTLE_NAME
 
4527
#define TARGET_LITTLE_NAME                  "elf64-l1om-freebsd"
 
4528
 
 
4529
#undef  ELF_OSABI
 
4530
#define ELF_OSABI                           ELFOSABI_FREEBSD
 
4531
 
 
4532
#undef  elf64_bed
 
4533
#define elf64_bed elf64_l1om_fbsd_bed
 
4534
 
 
4535
#undef  elf_backend_post_process_headers
 
4536
#define elf_backend_post_process_headers  _bfd_elf_set_osabi
 
4537
 
 
4538
#include "elf64-target.h"