Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 114008 | Differences between
and this patch

Collapse All | Expand All

(-)binutils-2.16.91.0.5.orig/bfd/elf-bfd.h (+13 lines)
Lines 170-175 Link Here
170
     matters.  */
170
     matters.  */
171
  unsigned int pointer_equality_needed : 1;
171
  unsigned int pointer_equality_needed : 1;
172
172
173
  /* FIXME: these 2 bits consume another 4 bytes */
174
  /* Symbol is concrete, ie. non-vague if we can detect that, from the
175
     .direct section */
176
  unsigned int concrete_ref : 1;
177
  /* Symbol is certainly vague (if we can detect that), from the
178
     .direct section */
179
  unsigned int vague_ref : 1;
180
173
  /* String table index in .dynstr if this is a dynamic symbol.  */
181
  /* String table index in .dynstr if this is a dynamic symbol.  */
174
  unsigned long dynstr_index;
182
  unsigned long dynstr_index;
175
183
Lines 398-403 Link Here
398
  asection *tls_sec;
406
  asection *tls_sec;
399
  bfd_size_type tls_size;
407
  bfd_size_type tls_size;
400
408
409
  /* Direct linkage output section */
410
  asection *direct_sec;
411
401
  /* A linked list of BFD's loaded in the link.  */
412
  /* A linked list of BFD's loaded in the link.  */
402
  struct elf_link_loaded_list *loaded;
413
  struct elf_link_loaded_list *loaded;
403
414
Lines 1276-1281 Link Here
1276
     name actually used, which will be the DT_SONAME entry if there is
1287
     name actually used, which will be the DT_SONAME entry if there is
1277
     one.  */
1288
     one.  */
1278
  const char *dt_name;
1289
  const char *dt_name;
1290
  int         dt_needed_idx;
1279
1291
1280
  /* Records the result of `get_program_header_size'.  */
1292
  /* Records the result of `get_program_header_size'.  */
1281
  bfd_size_type program_header_size;
1293
  bfd_size_type program_header_size;
Lines 1376-1381 Link Here
1376
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
1388
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
1377
#define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
1389
#define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
1378
#define elf_dt_name(bfd)	(elf_tdata(bfd) -> dt_name)
1390
#define elf_dt_name(bfd)	(elf_tdata(bfd) -> dt_name)
1391
#define elf_dt_needed_idx(bfd)	(elf_tdata(bfd) -> dt_needed_idx)
1379
#define elf_dyn_lib_class(bfd)	(elf_tdata(bfd) -> dyn_lib_class)
1392
#define elf_dyn_lib_class(bfd)	(elf_tdata(bfd) -> dyn_lib_class)
1380
#define elf_bad_symtab(bfd)	(elf_tdata(bfd) -> bad_symtab)
1393
#define elf_bad_symtab(bfd)	(elf_tdata(bfd) -> bad_symtab)
1381
#define elf_flags_init(bfd)	(elf_tdata(bfd) -> flags_init)
1394
#define elf_flags_init(bfd)	(elf_tdata(bfd) -> flags_init)
(-)binutils-2.16.91.0.5.orig/bfd/elf.c (+2 lines)
Lines 1220-1225 Link Here
1220
	    case DT_RELCOUNT: name = "RELCOUNT"; break;
1220
	    case DT_RELCOUNT: name = "RELCOUNT"; break;
1221
	    case DT_FLAGS_1: name = "FLAGS_1"; break;
1221
	    case DT_FLAGS_1: name = "FLAGS_1"; break;
1222
	    case DT_VERSYM: name = "VERSYM"; break;
1222
	    case DT_VERSYM: name = "VERSYM"; break;
1223
	    case DT_DIRECT: name = "DIRECT"; break;
1223
	    case DT_VERDEF: name = "VERDEF"; break;
1224
	    case DT_VERDEF: name = "VERDEF"; break;
1224
	    case DT_VERDEFNUM: name = "VERDEFNUM"; break;
1225
	    case DT_VERDEFNUM: name = "VERDEFNUM"; break;
1225
	    case DT_VERNEED: name = "VERNEED"; break;
1226
	    case DT_VERNEED: name = "VERNEED"; break;
Lines 1573-1578 Link Here
1573
  table->runpath = NULL;
1574
  table->runpath = NULL;
1574
  table->tls_sec = NULL;
1575
  table->tls_sec = NULL;
1575
  table->tls_size = 0;
1576
  table->tls_size = 0;
1577
  table->direct_sec = NULL;
1576
  table->loaded = NULL;
1578
  table->loaded = NULL;
1577
  table->is_relocatable_executable = FALSE;
1579
  table->is_relocatable_executable = FALSE;
1578
1580
(-)binutils-2.16.91.0.5.orig/bfd/elflink.c (+144 lines)
Lines 194-199 Link Here
194
      elf_hash_table (info)->eh_info.hdr_sec = s;
194
      elf_hash_table (info)->eh_info.hdr_sec = s;
195
    }
195
    }
196
196
197
  if ( info->direct && !info->executable )
198
    {
199
      s = bfd_make_section (abfd, ".direct");
200
      if (s == NULL
201
	  || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
202
	  || ! bfd_set_section_alignment (abfd, s, 2))
203
	return FALSE;
204
      elf_hash_table (info)->direct_sec = s;
205
    }
206
197
  /* Create sections to hold version informations.  These are removed
207
  /* Create sections to hold version informations.  These are removed
198
     if they are not needed.  */
208
     if they are not needed.  */
199
  s = bfd_make_section_with_flags (abfd, ".gnu.version_d",
209
  s = bfd_make_section_with_flags (abfd, ".gnu.version_d",
Lines 2844-2849 Link Here
2844
2854
2845
      if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
2855
      if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
2846
	return -1;
2856
	return -1;
2857
      elf_dt_needed_idx (abfd) = ++(info->dt_needed_index);
2858
/*      fprintf (stderr, "Set soname '%s' as index %d\n",
2859
	       soname, info->dt_needed_index); */
2847
    }
2860
    }
2848
  else
2861
  else
2849
    /* We were just checking for existence of the tag.  */
2862
    /* We were just checking for existence of the tag.  */
Lines 3139-3144 Link Here
3139
  bfd_boolean add_needed;
3152
  bfd_boolean add_needed;
3140
  struct elf_link_hash_table * hash_table;
3153
  struct elf_link_hash_table * hash_table;
3141
  bfd_size_type amt;
3154
  bfd_size_type amt;
3155
  asection *direct_sec;
3156
  unsigned char *direct_data;
3142
3157
3143
  hash_table = elf_hash_table (info);
3158
  hash_table = elf_hash_table (info);
3144
3159
Lines 3146-3151 Link Here
3146
  add_symbol_hook = bed->elf_add_symbol_hook;
3161
  add_symbol_hook = bed->elf_add_symbol_hook;
3147
  collect = bed->collect;
3162
  collect = bed->collect;
3148
3163
3164
  direct_sec = NULL;
3165
  direct_data = NULL;
3166
3149
  if ((abfd->flags & DYNAMIC) == 0)
3167
  if ((abfd->flags & DYNAMIC) == 0)
3150
    dynamic = FALSE;
3168
    dynamic = FALSE;
3151
  else
3169
  else
Lines 3165-3170 Link Here
3165
	    bfd_set_error (bfd_error_wrong_format);
3183
	    bfd_set_error (bfd_error_wrong_format);
3166
	  goto error_return;
3184
	  goto error_return;
3167
	}
3185
	}
3186
      if (info->direct &&
3187
	  (direct_sec = bfd_get_section_by_name (abfd, ".direct")))
3188
        {
3189
          direct_data = bfd_alloc (abfd, direct_sec->size);
3190
	  if (direct_data == NULL ||
3191
	      ! bfd_get_section_contents (abfd, direct_sec, direct_data, 0, direct_sec->size))
3192
	    goto error_return;
3193
	}
3168
    }
3194
    }
3169
3195
3170
  /* As a GNU extension, any input sections which are named
3196
  /* As a GNU extension, any input sections which are named
Lines 3814-3819 Link Here
3814
	      && vernum > 1
3840
	      && vernum > 1
3815
	      && definition)
3841
	      && definition)
3816
	    h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
3842
	    h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
3843
3844
	  if (direct_sec)
3845
	    {
3846
	      unsigned long d_idx = isym - isymbuf;
3847
	      /* FIXME: does bfd_elf_get_elf_syms read dynsym or the symbol
3848
		 table ? */
3849
	      d_idx += extsymoff;
3850
	      d_idx *= 2;
3851
	      if (d_idx > bfd_get_section_size (direct_sec))
3852
	        fprintf (stderr, "Warning - strange error on '%s': 0x%x 0x%x\n",
3853
			 h->root.root.string, (int)d_idx,
3854
			 (int)bfd_get_section_size (direct_sec));
3855
	      else
3856
	        {
3857
		  unsigned int direct_entry;
3858
		  direct_entry = bfd_get_16 (abfd, direct_data + d_idx);
3859
		  if ((direct_entry & DT_DIRECT_VAGUE))
3860
		    h->vague_ref = 1;
3861
		  if (!h->vague_ref &&
3862
		      (direct_entry & DT_DIRECT_MASK) != DT_DIRECT_UNKNOWN)
3863
		      h->concrete_ref = 1;
3864
#if 0
3865
		  fprintf (stderr, "symbol '%s': %s direct entry 0x%x (index %d) section '%s' : '%s'\n",
3866
			   h->root.root.string,
3867
			   h->vague_ref ? "vague " : h->concrete_ref ? "concrete" : "unknown",
3868
			   direct_entry, (int)d_idx/2,
3869
			   new_sec ? new_sec->name : "<nosec>",
3870
			   new_sec && new_sec->owner ? new_sec->owner->filename : "<noownername>");
3871
#endif
3872
		}
3873
	    }
3817
	}
3874
	}
3818
3875
3819
      if (! (_bfd_generic_link_add_one_symbol
3876
      if (! (_bfd_generic_link_add_one_symbol
Lines 3827-3832 Link Here
3827
	h = (struct elf_link_hash_entry *) h->root.u.i.link;
3884
	h = (struct elf_link_hash_entry *) h->root.u.i.link;
3828
      *sym_hash = h;
3885
      *sym_hash = h;
3829
3886
3887
      /* FIXME: move direct bits here ? - seem fine where they are ... */
3888
3830
      new_weakdef = FALSE;
3889
      new_weakdef = FALSE;
3831
      if (dynamic
3890
      if (dynamic
3832
	  && definition
3891
	  && definition
Lines 4446-4451 Link Here
4446
  if (isymbuf != NULL)
4505
  if (isymbuf != NULL)
4447
    free (isymbuf);
4506
    free (isymbuf);
4448
 error_return:
4507
 error_return:
4508
  if (direct_data != NULL)
4509
    free (direct_data);
4449
  return FALSE;
4510
  return FALSE;
4450
}
4511
}
4451
4512
Lines 5695-5700 Link Here
5695
	    return FALSE;
5756
	    return FALSE;
5696
	}
5757
	}
5697
5758
5759
      /* Create the direct bindings section - 1 entry per dynsym */
5760
      s = bfd_get_section_by_name (dynobj, ".direct");
5761
      if (s)
5762
        {
5763
  	  if (dynsymcount == 0)
5764
	    _bfd_strip_section_from_output (info, s);
5765
	  else
5766
	    {
5767
	      s->size = dynsymcount * sizeof (Elf_External_Direct);
5768
	      s->contents = bfd_zalloc (output_bfd, s->size);
5769
	      if (s->contents == NULL)
5770
	        return FALSE;
5771
	      memset (s->contents, 0xff, s->size);
5772
	      if (!_bfd_elf_add_dynamic_entry (info, DT_DIRECT, 0))
5773
	        return FALSE;
5774
	    }
5775
	}
5776
5698
      /* Set the size of the .dynsym and .hash sections.  We counted
5777
      /* Set the size of the .dynsym and .hash sections.  We counted
5699
	 the number of dynamic symbols in elf_link_add_object_symbols.
5778
	 the number of dynamic symbols in elf_link_add_object_symbols.
5700
	 We will build the contents of .dynsym and .hash when we build
5779
	 We will build the contents of .dynsym and .hash when we build
Lines 5769-5774 Link Here
5769
  asection *hash_sec;
5848
  asection *hash_sec;
5770
  /* symbol version section (.gnu.version).  */
5849
  /* symbol version section (.gnu.version).  */
5771
  asection *symver_sec;
5850
  asection *symver_sec;
5851
  /* .direct linkage section */
5852
  asection *direct_sec;
5772
  /* Buffer large enough to hold contents of any section.  */
5853
  /* Buffer large enough to hold contents of any section.  */
5773
  bfd_byte *contents;
5854
  bfd_byte *contents;
5774
  /* Buffer large enough to hold external relocs of any section.  */
5855
  /* Buffer large enough to hold external relocs of any section.  */
Lines 6625-6630 Link Here
6625
	  eversym += h->dynindx;
6706
	  eversym += h->dynindx;
6626
	  _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
6707
	  _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
6627
	}
6708
	}
6709
6710
      if (finfo->direct_sec)
6711
	{
6712
	  bfd_vma offset = 2 * h->dynindx;
6713
	  if (offset > finfo->direct_sec->size)
6714
	    fprintf (stderr, "Out of bounds direct section index %d\n",
6715
		     (int) offset);
6716
	  else
6717
	    {
6718
	      int dt_index = DT_DIRECT_UNKNOWN;
6719
6720
#if 0
6721
	      fprintf (stderr, "Symbol '%s' type %d\n",
6722
	               h->root.root.string, h->root.type);
6723
#endif
6724
	      if ((h->root.type == bfd_link_hash_defined
6725
		   || h->root.type == bfd_link_hash_defweak) &&
6726
		  h->root.u.def.section != NULL &&
6727
		  h->root.u.def.section->owner != NULL)
6728
							   
6729
	        {
6730
		  asection *sec = h->root.u.def.section;
6731
6732
		  dt_index = elf_dt_needed_idx (sec->owner);
6733
6734
		  if (!(sec->owner->flags & DYNAMIC))
6735
		    {
6736
		      if (!sec->name ||
6737
			  !strncmp (sec->name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1))
6738
			dt_index |= DT_DIRECT_VAGUE;
6739
6740
		      /* app -> library data references get turned into copy
6741
			 relocs, so objects can migrate unpredictably into the
6742
			 application itself. */
6743
		      else if (h->type == STT_OBJECT)
6744
			dt_index |= DT_DIRECT_VAGUE;
6745
		    }
6746
		  else if (h->vague_ref)
6747
		    dt_index |= DT_DIRECT_VAGUE;
6748
6749
		  else if (!h->concrete_ref)
6750
		    dt_index = DT_DIRECT_UNKNOWN;
6751
6752
#if 0
6753
		  fprintf (stderr, "Sym '%s' (type %d) [type %d] section  %s [%s] owner '%s' [%d] offset %d resolves '%s'\n",
6754
			   h->root.root.string, h->root.type, h->type,
6755
			   sec->name ? sec->name : "<null>",
6756
			   sec->owner->flags & DYNAMIC ? "dynamic" : "static",
6757
			   sec->owner ? sec->owner->filename : "<noowner?>",
6758
			   dt_index, (int) offset,
6759
			   dt_index & DT_DIRECT_VAGUE ? "<vague>" : "concrete");
6760
#endif
6761
		}
6762
	      bfd_put_16 (finfo->output_bfd,
6763
			  dt_index,
6764
			  finfo->direct_sec->contents + offset);
6765
	    }
6766
	}
6628
    }
6767
    }
6629
6768
6630
  /* If we're stripping it, then it was just a dynamic symbol, and
6769
  /* If we're stripping it, then it was just a dynamic symbol, and
Lines 7768-7773 Link Here
7768
      finfo.dynsym_sec = NULL;
7907
      finfo.dynsym_sec = NULL;
7769
      finfo.hash_sec = NULL;
7908
      finfo.hash_sec = NULL;
7770
      finfo.symver_sec = NULL;
7909
      finfo.symver_sec = NULL;
7910
      finfo.direct_sec = NULL;
7771
    }
7911
    }
7772
  else
7912
  else
7773
    {
7913
    {
Lines 7776-7781 Link Here
7776
      BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
7916
      BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
7777
      finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
7917
      finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version");
7778
      /* Note that it is OK if symver_sec is NULL.  */
7918
      /* Note that it is OK if symver_sec is NULL.  */
7919
      finfo.direct_sec = bfd_get_section_by_name (dynobj, ".direct");
7779
    }
7920
    }
7780
7921
7781
  finfo.contents = NULL;
7922
  finfo.contents = NULL;
Lines 8527-8532 Link Here
8527
	    case DT_VERNEED:
8668
	    case DT_VERNEED:
8528
	      name = ".gnu.version_r";
8669
	      name = ".gnu.version_r";
8529
	      goto get_vma;
8670
	      goto get_vma;
8671
	    case DT_DIRECT:
8672
	      name = ".direct";
8673
	      goto get_vma;
8530
	    case DT_VERSYM:
8674
	    case DT_VERSYM:
8531
	      name = ".gnu.version";
8675
	      name = ".gnu.version";
8532
	    get_vma:
8676
	    get_vma:
(-)binutils-2.16.91.0.5.orig/binutils/readelf.c (-2 / +138 lines)
Lines 145-150 Link Here
145
static int do_dynamic;
145
static int do_dynamic;
146
static int do_syms;
146
static int do_syms;
147
static int do_reloc;
147
static int do_reloc;
148
static int do_direct;
148
static int do_sections;
149
static int do_sections;
149
static int do_section_groups;
150
static int do_section_groups;
150
static int do_section_details;
151
static int do_section_details;
Lines 1477-1482 Link Here
1477
    case DT_SYMINFO:	return "SYMINFO"; /* aka ADDRRNGHI */
1478
    case DT_SYMINFO:	return "SYMINFO"; /* aka ADDRRNGHI */
1478
1479
1479
    case DT_VERSYM:	return "VERSYM";
1480
    case DT_VERSYM:	return "VERSYM";
1481
    case DT_DIRECT:	return "DIRECT";
1480
1482
1481
    case DT_RELACOUNT:	return "RELACOUNT";
1483
    case DT_RELACOUNT:	return "RELACOUNT";
1482
    case DT_RELCOUNT:	return "RELCOUNT";
1484
    case DT_RELCOUNT:	return "RELCOUNT";
Lines 2573-2578 Link Here
2573
  {"symbols",	       no_argument, 0, 's'},
2575
  {"symbols",	       no_argument, 0, 's'},
2574
  {"syms",	       no_argument, 0, 's'},
2576
  {"syms",	       no_argument, 0, 's'},
2575
  {"relocs",	       no_argument, 0, 'r'},
2577
  {"relocs",	       no_argument, 0, 'r'},
2578
  {"direct",	       no_argument, 0, 'y'},
2576
  {"notes",	       no_argument, 0, 'n'},
2579
  {"notes",	       no_argument, 0, 'n'},
2577
  {"dynamic",	       no_argument, 0, 'd'},
2580
  {"dynamic",	       no_argument, 0, 'd'},
2578
  {"arch-specific",    no_argument, 0, 'A'},
2581
  {"arch-specific",    no_argument, 0, 'A'},
Lines 2610-2615 Link Here
2610
      --symbols          An alias for --syms\n\
2613
      --symbols          An alias for --syms\n\
2611
  -n --notes             Display the core notes (if present)\n\
2614
  -n --notes             Display the core notes (if present)\n\
2612
  -r --relocs            Display the relocations (if present)\n\
2615
  -r --relocs            Display the relocations (if present)\n\
2616
  -y --direct            Display direct linkage table (if present)\n\
2613
  -u --unwind            Display the unwind info (if present)\n\
2617
  -u --unwind            Display the unwind info (if present)\n\
2614
  -d --dynamic           Display the dynamic section (if present)\n\
2618
  -d --dynamic           Display the dynamic section (if present)\n\
2615
  -V --version-info      Display the version sections (if present)\n\
2619
  -V --version-info      Display the version sections (if present)\n\
Lines 2699-2705 Link Here
2699
    usage ();
2703
    usage ();
2700
2704
2701
  while ((c = getopt_long
2705
  while ((c = getopt_long
2702
	  (argc, argv, "ersuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF)
2706
	  (argc, argv, "erysuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF)
2703
    {
2707
    {
2704
      char *cp;
2708
      char *cp;
2705
      int section;
2709
      int section;
Lines 2716-2721 Link Here
2716
	case 'a':
2720
	case 'a':
2717
	  do_syms++;
2721
	  do_syms++;
2718
	  do_reloc++;
2722
	  do_reloc++;
2723
	  do_direct++;
2719
	  do_unwind++;
2724
	  do_unwind++;
2720
	  do_dynamic++;
2725
	  do_dynamic++;
2721
	  do_header++;
2726
	  do_header++;
Lines 2749-2754 Link Here
2749
	case 'r':
2754
	case 'r':
2750
	  do_reloc++;
2755
	  do_reloc++;
2751
	  break;
2756
	  break;
2757
	case 'y':
2758
	  do_direct++;
2759
	  break;
2752
	case 'u':
2760
	case 'u':
2753
	  do_unwind++;
2761
	  do_unwind++;
2754
	  break;
2762
	  break;
Lines 2955-2961 Link Here
2955
	}
2963
	}
2956
    }
2964
    }
2957
2965
2958
  if (!do_dynamic && !do_syms && !do_reloc && !do_unwind && !do_sections
2966
  if (!do_dynamic && !do_syms && !do_reloc && !do_direct && !do_unwind && !do_sections
2959
      && !do_segments && !do_header && !do_dump && !do_version
2967
      && !do_segments && !do_header && !do_dump && !do_version
2960
      && !do_histogram && !do_debugging && !do_arch && !do_notes
2968
      && !do_histogram && !do_debugging && !do_arch && !do_notes
2961
      && !do_section_groups)
2969
      && !do_section_groups)
Lines 4599-4604 Link Here
4599
  return 1;
4607
  return 1;
4600
}
4608
}
4601
4609
4610
static void
4611
print_dt_needed_name (int idx)
4612
{
4613
  const char *name = NULL;
4614
  Elf_Internal_Dyn *entry;
4615
4616
  idx &= DT_DIRECT_MASK;
4617
 
4618
  switch (idx)
4619
    {
4620
    case 0:
4621
      name = _("<self>");
4622
      break;
4623
    case DT_DIRECT_UNKNOWN:
4624
      name = _("<unknown>");
4625
      break;
4626
    default:
4627
      idx--;
4628
4629
      for (entry = dynamic_section;
4630
	   entry < dynamic_section + dynamic_nent && idx > 0;
4631
	   entry++)
4632
	if (entry->d_tag == DT_NEEDED)
4633
	  idx--;
4634
  
4635
      if (idx == 0)
4636
        {
4637
          if (VALID_DYNAMIC_NAME (entry->d_un.d_val))
4638
	    name = GET_DYNAMIC_NAME (entry->d_un.d_val);
4639
	  else
4640
	    name = NULL;
4641
	}
4642
      break;
4643
    }
4644
4645
  if (!name)
4646
    name = _("<out-of-range>");
4647
  if (do_wide)
4648
    printf ("%s", name);
4649
  else
4650
    printf ("%-25s", name);
4651
}
4652
4653
static int
4654
process_direct (FILE *file)
4655
{
4656
  unsigned int i;
4657
  unsigned int si;
4658
  char *strtab;
4659
  unsigned char *directtab;
4660
  Elf_Internal_Sym *symtab = NULL;
4661
  Elf_Internal_Sym *psym;
4662
  Elf_Internal_Shdr *direct = NULL;
4663
  Elf_Internal_Shdr *dynsym = NULL;
4664
  Elf_Internal_Shdr *section;
4665
4666
  if (!do_direct)
4667
    return 1;
4668
  if (!dynamic_symbols || !dynamic_section || !dynamic_strings)
4669
    return 1;
4670
4671
  for (i = 0, section = section_headers;
4672
       i < elf_header.e_shnum;
4673
       i++, section++)
4674
    {
4675
      if (section->sh_type == SHT_DYNSYM)
4676
        dynsym = section;
4677
      if (!strcmp (SECTION_NAME (section), ".direct"))
4678
        direct = section;
4679
    }
4680
  if (!dynsym || !direct)
4681
    return 1;
4682
  
4683
  symtab = GET_ELF_SYMBOLS (file, dynsym);
4684
  if (!symtab)
4685
    return 1;
4686
4687
  directtab = get_data (NULL, file, direct->sh_offset,
4688
			direct->sh_size, _("direct linkage table"));
4689
  if (!symtab)
4690
  {
4691
    free (symtab);
4692
    return 1;
4693
  }
4694
4695
  if (dynsym->sh_link == elf_header.e_shstrndx)
4696
    strtab = string_table;
4697
  else
4698
    {
4699
      Elf_Internal_Shdr *string_sec;
4700
4701
      string_sec = SECTION_HEADER (dynsym->sh_link);
4702
4703
      strtab = get_data (NULL, file, string_sec->sh_offset,
4704
			 string_sec->sh_size, _("string table"));
4705
    }
4706
4707
  assert (strtab != NULL);
4708
4709
  printf (_("\nDirect relocations for image:\n"));
4710
  printf (_("   Num:  Index     Vague   Binding                    Symbol\n"));
4711
  for (si = 0, psym = symtab;
4712
       si < dynsym->sh_size / dynsym->sh_entsize;
4713
       si++, psym++)
4714
    {
4715
       unsigned int field;
4716
       printf ("%6d: ", si);
4717
       field = byte_get (directtab + (si * 2), 2);
4718
       printf ("[0x%.4x]   ", field);
4719
       printf ("%s", (field & DT_DIRECT_VAGUE) ? "Vague" : "     ");
4720
       printf ("  ");
4721
       print_dt_needed_name (field);
4722
       printf ("  ");
4723
       print_symbol (25, strtab + psym->st_name);
4724
       printf ("\n");
4725
    }
4726
4727
4728
  free (symtab);
4729
  if (strtab != string_table)
4730
    free (strtab);
4731
4732
  return 1;
4733
}
4734
4735
4602
/* Process the unwind section.  */
4736
/* Process the unwind section.  */
4603
4737
4604
#include "unwind-ia64.h"
4738
#include "unwind-ia64.h"
Lines 8934-8939 Link Here
8934
9068
8935
  process_relocs (file);
9069
  process_relocs (file);
8936
9070
9071
  process_direct (file);
9072
8937
  process_unwind (file);
9073
  process_unwind (file);
8938
9074
8939
  process_symbol_table (file);
9075
  process_symbol_table (file);
(-)binutils-2.16.91.0.5.orig/include/bfdlink.h (+6 lines)
Lines 244-249 Link Here
244
  /* TRUE if BFD should pre-bind symbols in a shared object.  */
244
  /* TRUE if BFD should pre-bind symbols in a shared object.  */
245
  unsigned int symbolic: 1;
245
  unsigned int symbolic: 1;
246
246
247
  /* TRUE if BFD should bind symbols directly to resolved at link time.  */
248
  unsigned int direct: 1;
249
247
  /* TRUE if BFD should export all symbols in the dynamic symbol table
250
  /* TRUE if BFD should export all symbols in the dynamic symbol table
248
     of an executable, rather than only those used.  */
251
     of an executable, rather than only those used.  */
249
  unsigned int export_dynamic: 1;
252
  unsigned int export_dynamic: 1;
Lines 419-424 Link Here
419
422
420
  /* Start and end of RELRO region.  */
423
  /* Start and end of RELRO region.  */
421
  bfd_vma relro_start, relro_end;
424
  bfd_vma relro_start, relro_end;
425
426
  /* current max dtinfo section number */
427
  int dt_needed_index;
422
};
428
};
423
429
424
/* This structures holds a set of callback functions.  These are
430
/* This structures holds a set of callback functions.  These are
(-)binutils-2.16.91.0.5.orig/include/elf/common.h (+6 lines)
Lines 592-597 Link Here
592
592
593
/* This tag is a GNU extension to the Solaris version scheme.  */
593
/* This tag is a GNU extension to the Solaris version scheme.  */
594
#define DT_VERSYM	0x6ffffff0
594
#define DT_VERSYM	0x6ffffff0
595
#define DT_DIRECT	0x6ffffff1 /* FIXME - how are these allocated ? */
595
596
596
#define DT_LOPROC	0x70000000
597
#define DT_LOPROC	0x70000000
597
#define DT_HIPROC	0x7fffffff
598
#define DT_HIPROC	0x7fffffff
Lines 641-646 Link Here
641
#define DF_BIND_NOW	(1 << 3)
642
#define DF_BIND_NOW	(1 << 3)
642
#define DF_STATIC_TLS	(1 << 4)
643
#define DF_STATIC_TLS	(1 << 4)
643
644
645
/* Constants for the DT_DIRECT entries. */
646
#define DT_DIRECT_VAGUE   (1<<15)
647
#define DT_DIRECT_MASK     0x3ff
648
#define DT_DIRECT_UNKNOWN  DT_DIRECT_MASK
649
644
/* These constants are used for the version number of a Elf32_Verdef
650
/* These constants are used for the version number of a Elf32_Verdef
645
   structure.  */
651
   structure.  */
646
652
(-)binutils-2.16.91.0.5.orig/include/elf/external.h (+4 lines)
Lines 213-218 Link Here
213
  unsigned char		vd_next[4];
213
  unsigned char		vd_next[4];
214
} Elf_External_Verdef;
214
} Elf_External_Verdef;
215
215
216
typedef struct {
217
  unsigned char		dir_libidx[2];
218
} Elf_External_Direct;
219
216
/* This structure appears in a SHT_GNU_verdef section.  */
220
/* This structure appears in a SHT_GNU_verdef section.  */
217
221
218
typedef struct {
222
typedef struct {
(-)binutils-2.16.91.0.5.orig/ld/lexsup.c (+6 lines)
Lines 72-77 Link Here
72
  OPTION_DEFSYM,
72
  OPTION_DEFSYM,
73
  OPTION_DEMANGLE,
73
  OPTION_DEMANGLE,
74
  OPTION_DEMANGLER,
74
  OPTION_DEMANGLER,
75
  OPTION_DIRECT,
75
  OPTION_DYNAMIC_LINKER,
76
  OPTION_DYNAMIC_LINKER,
76
  OPTION_SYSROOT,
77
  OPTION_SYSROOT,
77
  OPTION_EB,
78
  OPTION_EB,
Lines 343-348 Link Here
343
    '\0', NULL, NULL, ONE_DASH },
344
    '\0', NULL, NULL, ONE_DASH },
344
  { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
345
  { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
345
    '\0', NULL, N_("Bind global references locally"), ONE_DASH },
346
    '\0', NULL, N_("Bind global references locally"), ONE_DASH },
347
  { {"Bdirect", no_argument, NULL, OPTION_DIRECT},
348
    '\0', NULL, N_("Direct-linkage the the shared libraries"), ONE_DASH },
346
  { {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
349
  { {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
347
    '\0', NULL, N_("Check section addresses for overlaps (default)"),
350
    '\0', NULL, N_("Check section addresses for overlaps (default)"),
348
    TWO_DASHES },
351
    TWO_DASHES },
Lines 746-751 Link Here
746
	case OPTION_DEMANGLER:
749
	case OPTION_DEMANGLER:
747
	  demangler = optarg;
750
	  demangler = optarg;
748
	  break;
751
	  break;
752
	case OPTION_DIRECT:
753
	  link_info.direct = TRUE;
754
	  break;
749
	case 'I':		/* Used on Solaris.  */
755
	case 'I':		/* Used on Solaris.  */
750
	case OPTION_DYNAMIC_LINKER:
756
	case OPTION_DYNAMIC_LINKER:
751
	  command_line.interpreter = optarg;
757
	  command_line.interpreter = optarg;

Return to bug 114008