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/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 396-401 Link Here
396
  asection *tls_sec;
404
  asection *tls_sec;
397
  bfd_size_type tls_size;
405
  bfd_size_type tls_size;
398
406
407
  /* Direct linkage output section */
408
  asection *direct_sec;
409
399
  /* A linked list of BFD's loaded in the link.  */
410
  /* A linked list of BFD's loaded in the link.  */
400
  struct elf_link_loaded_list *loaded;
411
  struct elf_link_loaded_list *loaded;
401
412
Lines 1238-1243 Link Here
1238
     name actually used, which will be the DT_SONAME entry if there is
1249
     name actually used, which will be the DT_SONAME entry if there is
1239
     one.  */
1250
     one.  */
1240
  const char *dt_name;
1251
  const char *dt_name;
1252
  int         dt_needed_idx;
1241
1253
1242
  /* Records the result of `get_program_header_size'.  */
1254
  /* Records the result of `get_program_header_size'.  */
1243
  bfd_size_type program_header_size;
1255
  bfd_size_type program_header_size;
Lines 1338-1343 Link Here
1338
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
1350
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
1339
#define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
1351
#define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
1340
#define elf_dt_name(bfd)	(elf_tdata(bfd) -> dt_name)
1352
#define elf_dt_name(bfd)	(elf_tdata(bfd) -> dt_name)
1353
#define elf_dt_needed_idx(bfd)	(elf_tdata(bfd) -> dt_needed_idx)
1341
#define elf_dyn_lib_class(bfd)	(elf_tdata(bfd) -> dyn_lib_class)
1354
#define elf_dyn_lib_class(bfd)	(elf_tdata(bfd) -> dyn_lib_class)
1342
#define elf_bad_symtab(bfd)	(elf_tdata(bfd) -> bad_symtab)
1355
#define elf_bad_symtab(bfd)	(elf_tdata(bfd) -> bad_symtab)
1343
#define elf_flags_init(bfd)	(elf_tdata(bfd) -> flags_init)
1356
#define elf_flags_init(bfd)	(elf_tdata(bfd) -> flags_init)
(-)binutils-2.16/bfd/elf.c (+2 lines)
Lines 1145-1150 Link Here
1145
	    case DT_RELCOUNT: name = "RELCOUNT"; break;
1145
	    case DT_RELCOUNT: name = "RELCOUNT"; break;
1146
	    case DT_FLAGS_1: name = "FLAGS_1"; break;
1146
	    case DT_FLAGS_1: name = "FLAGS_1"; break;
1147
	    case DT_VERSYM: name = "VERSYM"; break;
1147
	    case DT_VERSYM: name = "VERSYM"; break;
1148
	    case DT_SUSE_DIRECT: name = "SUSE_DIRECT"; break;
1148
	    case DT_VERDEF: name = "VERDEF"; break;
1149
	    case DT_VERDEF: name = "VERDEF"; break;
1149
	    case DT_VERDEFNUM: name = "VERDEFNUM"; break;
1150
	    case DT_VERDEFNUM: name = "VERDEFNUM"; break;
1150
	    case DT_VERNEED: name = "VERNEED"; break;
1151
	    case DT_VERNEED: name = "VERNEED"; break;
Lines 1495-1500 Link Here
1495
  table->runpath = NULL;
1496
  table->runpath = NULL;
1496
  table->tls_sec = NULL;
1497
  table->tls_sec = NULL;
1497
  table->tls_size = 0;
1498
  table->tls_size = 0;
1499
  table->direct_sec = NULL;
1498
  table->loaded = NULL;
1500
  table->loaded = NULL;
1499
  table->is_relocatable_executable = FALSE;
1501
  table->is_relocatable_executable = FALSE;
1500
1502
(-)binutils-2.16/bfd/elflink.c (+146 lines)
Lines 172-177 Link Here
172
      elf_hash_table (info)->eh_info.hdr_sec = s;
172
      elf_hash_table (info)->eh_info.hdr_sec = s;
173
    }
173
    }
174
174
175
  if ( info->direct && !info->executable )
176
    {
177
      s = bfd_make_section (abfd, ".suse.direct");
178
      if (s == NULL
179
	  || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
180
	  || ! bfd_set_section_alignment (abfd, s, 2))
181
	return FALSE;
182
      elf_hash_table (info)->direct_sec = s;
183
    }
184
175
  /* Create sections to hold version informations.  These are removed
185
  /* Create sections to hold version informations.  These are removed
176
     if they are not needed.  */
186
     if they are not needed.  */
177
  s = bfd_make_section (abfd, ".gnu.version_d");
187
  s = bfd_make_section (abfd, ".gnu.version_d");
Lines 2193-2199 Link Here
2193
2203
2194
  return TRUE;
2204
  return TRUE;
2195
}
2205
}
2206
2196
2207
2208
2197
/* Fix up the flags for a symbol.  This handles various cases which
2209
/* Fix up the flags for a symbol.  This handles various cases which
2198
   can only be fixed after all the input files are seen.  This is
2210
   can only be fixed after all the input files are seen.  This is
2199
   currently called by both adjust_dynamic_symbol and
2211
   currently called by both adjust_dynamic_symbol and
Lines 2848-2853 Link Here
2848
2860
2849
      if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
2861
      if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
2850
	return -1;
2862
	return -1;
2863
      elf_dt_needed_idx (abfd) = ++(info->dt_needed_index);
2864
/*      fprintf (stderr, "Set soname '%s' as index %d\n",
2865
	       soname, info->dt_needed_index); */
2851
    }
2866
    }
2852
  else
2867
  else
2853
    /* We were just checking for existence of the tag.  */
2868
    /* We were just checking for existence of the tag.  */
Lines 3143-3148 Link Here
3143
  bfd_boolean add_needed;
3158
  bfd_boolean add_needed;
3144
  struct elf_link_hash_table * hash_table;
3159
  struct elf_link_hash_table * hash_table;
3145
  bfd_size_type amt;
3160
  bfd_size_type amt;
3161
  asection *direct_sec;
3162
  unsigned char *direct_data;
3146
3163
3147
  hash_table = elf_hash_table (info);
3164
  hash_table = elf_hash_table (info);
3148
3165
Lines 3150-3155 Link Here
3150
  add_symbol_hook = bed->elf_add_symbol_hook;
3167
  add_symbol_hook = bed->elf_add_symbol_hook;
3151
  collect = bed->collect;
3168
  collect = bed->collect;
3152
3169
3170
  direct_sec = NULL;
3171
  direct_data = NULL;
3172
3153
  if ((abfd->flags & DYNAMIC) == 0)
3173
  if ((abfd->flags & DYNAMIC) == 0)
3154
    dynamic = FALSE;
3174
    dynamic = FALSE;
3155
  else
3175
  else
Lines 3169-3174 Link Here
3169
	    bfd_set_error (bfd_error_wrong_format);
3189
	    bfd_set_error (bfd_error_wrong_format);
3170
	  goto error_return;
3190
	  goto error_return;
3171
	}
3191
	}
3192
      if (info->direct &&
3193
	  (direct_sec = bfd_get_section_by_name (abfd, ".suse.direct")))
3194
        {
3195
          direct_data = bfd_alloc (abfd, direct_sec->size);
3196
	  if (direct_data == NULL ||
3197
	      ! bfd_get_section_contents (abfd, direct_sec, direct_data, 0, direct_sec->size))
3198
	    goto error_return;
3199
	}
3172
    }
3200
    }
3173
3201
3174
  /* As a GNU extension, any input sections which are named
3202
  /* As a GNU extension, any input sections which are named
Lines 3817-3822 Link Here
3817
	      && vernum > 1
3845
	      && vernum > 1
3818
	      && definition)
3846
	      && definition)
3819
	    h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
3847
	    h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
3848
3849
	  if (direct_sec)
3850
	    {
3851
	      unsigned long d_idx = isym - isymbuf;
3852
	      /* FIXME: does bfd_elf_get_elf_syms read dynsym or the symbol
3853
		 table ? */
3854
	      d_idx += extsymoff;
3855
	      d_idx *= 2;
3856
	      if (d_idx > bfd_get_section_size (direct_sec))
3857
	        fprintf (stderr, "Warning - strange error on '%s': 0x%x 0x%x\n",
3858
			 h->root.root.string, (int)d_idx,
3859
			 (int)bfd_get_section_size (direct_sec));
3860
	      else
3861
	        {
3862
		  unsigned int direct_entry;
3863
		  direct_entry = bfd_get_16 (abfd, direct_data + d_idx);
3864
		  if ((direct_entry & DT_SUSE_DIRECT_VAGUE))
3865
		    h->vague_ref = 1;
3866
		  if (!h->vague_ref &&
3867
		      (direct_entry & DT_SUSE_DIRECT_MASK) != DT_SUSE_DIRECT_UNKNOWN)
3868
		      h->concrete_ref = 1;
3869
#if 0
3870
		  fprintf (stderr, "symbol '%s': %s direct entry 0x%x (index %d) section '%s' : '%s'\n",
3871
			   h->root.root.string,
3872
			   h->vague_ref ? "vague " : h->concrete_ref ? "concrete" : "unknown",
3873
			   direct_entry, (int)d_idx/2,
3874
			   new_sec ? new_sec->name : "<nosec>",
3875
			   new_sec && new_sec->owner ? new_sec->owner->filename : "<noownername>");
3876
#endif
3877
		}
3878
	    }
3820
	}
3879
	}
3821
3880
3822
      if (! (_bfd_generic_link_add_one_symbol
3881
      if (! (_bfd_generic_link_add_one_symbol
Lines 3830-3835 Link Here
3830
	h = (struct elf_link_hash_entry *) h->root.u.i.link;
3889
	h = (struct elf_link_hash_entry *) h->root.u.i.link;
3831
      *sym_hash = h;
3890
      *sym_hash = h;
3832
3891
3892
      /* FIXME: move direct bits here ? - seem fine where they are ... */
3893
3833
      new_weakdef = FALSE;
3894
      new_weakdef = FALSE;
3834
      if (dynamic
3895
      if (dynamic
3835
	  && definition
3896
	  && definition
Lines 4450-4455 Link Here
4450
  if (isymbuf != NULL)
4511
  if (isymbuf != NULL)
4451
    free (isymbuf);
4512
    free (isymbuf);
4452
 error_return:
4513
 error_return:
4514
  if (direct_data != NULL)
4515
    free (direct_data);
4453
  return FALSE;
4516
  return FALSE;
4454
}
4517
}
4455
4518
Lines 5671-5676 Link Here
5671
	    return FALSE;
5734
	    return FALSE;
5672
	}
5735
	}
5673
5736
5737
      /* Create the direct bindings section - 1 entry per dynsym */
5738
      s = bfd_get_section_by_name (dynobj, ".direct");
5739
      if (s)
5740
        {
5741
  	  if (dynsymcount == 0)
5742
            s->flags |= SEC_EXCLUDE;
5743
	  else
5744
	    {
5745
	      s->size = dynsymcount * sizeof (Elf_External_Direct);
5746
	      s->contents = bfd_zalloc (output_bfd, s->size);
5747
	      if (s->contents == NULL)
5748
	        return FALSE;
5749
	      memset (s->contents, 0xff, s->size);
5750
	      if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_DIRECT, 0))
5751
	        return FALSE;
5752
	    }
5753
	}
5754
5674
      /* Set the size of the .dynsym and .hash sections.  We counted
5755
      /* Set the size of the .dynsym and .hash sections.  We counted
5675
	 the number of dynamic symbols in elf_link_add_object_symbols.
5756
	 the number of dynamic symbols in elf_link_add_object_symbols.
5676
	 We will build the contents of .dynsym and .hash when we build
5757
	 We will build the contents of .dynsym and .hash when we build
Lines 5749-5754 Link Here
5749
  asection *hash_sec;
5830
  asection *hash_sec;
5750
  /* symbol version section (.gnu.version).  */
5831
  /* symbol version section (.gnu.version).  */
5751
  asection *symver_sec;
5832
  asection *symver_sec;
5833
  /* .direct linkage section */
5834
  asection *direct_sec;
5752
  /* Buffer large enough to hold contents of any section.  */
5835
  /* Buffer large enough to hold contents of any section.  */
5753
  bfd_byte *contents;
5836
  bfd_byte *contents;
5754
  /* Buffer large enough to hold external relocs of any section.  */
5837
  /* Buffer large enough to hold external relocs of any section.  */
Lines 6603-6608 Link Here
6603
	  eversym += h->dynindx;
6704
	  eversym += h->dynindx;
6604
	  _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
6705
	  _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
6605
	}
6706
	}
6707
6708
      if (finfo->direct_sec)
6709
	{
6710
	  bfd_vma offset = 2 * h->dynindx;
6711
	  if (offset > finfo->direct_sec->size)
6712
	    fprintf (stderr, "Out of bounds direct section index %d\n",
6713
		     (int) offset);
6714
	  else
6715
	    {
6716
	      int dt_index = DT_SUSE_DIRECT_UNKNOWN;
6717
6718
#if 0
6719
	      fprintf (stderr, "Symbol '%s' type %d\n",
6720
	               h->root.root.string, h->root.type);
6721
#endif
6722
	      if ((h->root.type == bfd_link_hash_defined
6723
		   || h->root.type == bfd_link_hash_defweak) &&
6724
		  h->root.u.def.section != NULL &&
6725
		  h->root.u.def.section->owner != NULL)
6726
							   
6727
	        {
6728
		  asection *sec = h->root.u.def.section;
6729
6730
		  dt_index = elf_dt_needed_idx (sec->owner);
6731
6732
		  if (!(sec->owner->flags & DYNAMIC))
6733
		    {
6734
		      if (!sec->name ||
6735
			  !strncmp (sec->name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1))
6736
			dt_index |= DT_SUSE_DIRECT_VAGUE;
6737
6738
		      /* app -> library data references get turned into copy
6739
			 relocs, so objects can migrate unpredictably into the
6740
			 application itself. */
6741
		      else if (h->type == STT_OBJECT)
6742
			dt_index |= DT_SUSE_DIRECT_VAGUE;
6743
		    }
6744
		  else if (h->vague_ref)
6745
		    dt_index |= DT_SUSE_DIRECT_VAGUE;
6746
6747
		  else if (!h->concrete_ref)
6748
		    dt_index = DT_SUSE_DIRECT_UNKNOWN;
6749
6750
#if 0
6751
		  fprintf (stderr, "Sym '%s' (type %d) [type %d] section  %s [%s] owner '%s' [%d] offset %d resolves '%s'\n",
6752
			   h->root.root.string, h->root.type, h->type,
6753
			   sec->name ? sec->name : "<null>",
6754
			   sec->owner->flags & DYNAMIC ? "dynamic" : "static",
6755
			   sec->owner ? sec->owner->filename : "<noowner?>",
6756
			   dt_index, (int) offset,
6757
			   dt_index & DT_SUSE_DIRECT_VAGUE ? "<vague>" : "concrete");
6758
#endif
6759
		}
6760
	      bfd_put_16 (finfo->output_bfd,
6761
			  dt_index,
6762
			  finfo->direct_sec->contents + offset);
6763
	    }
6764
	}
6606
    }
6765
    }
6607
6766
6608
  /* If we're stripping it, then it was just a dynamic symbol, and
6767
  /* If we're stripping it, then it was just a dynamic symbol, and
Lines 7732-7737 Link Here
7732
7891
7733
  if (! dynamic)
7892
  if (! dynamic)
7734
    {
7893
    {
7894
      finfo.direct_sec = NULL;
7735
      finfo.dynsym_sec = NULL;
7895
      finfo.dynsym_sec = NULL;
7736
      finfo.hash_sec = NULL;
7896
      finfo.hash_sec = NULL;
7737
      finfo.symver_sec = NULL;
7897
      finfo.symver_sec = NULL;
Lines 7740-7745 Link Here
7740
    }
7900
    }
7741
  else
7901
  else
7742
    {
7902
    {
7903
      finfo.direct_sec = bfd_get_section_by_name (dynobj, ".suse.direct");
7743
      finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym");
7904
      finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym");
7744
      finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
7905
      finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash");
7745
      BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
7906
      BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL);
Lines 8492-8497 Link Here
8492
	    case DT_VERNEED:
8653
	    case DT_VERNEED:
8493
	      name = ".gnu.version_r";
8654
	      name = ".gnu.version_r";
8494
	      goto get_vma;
8655
	      goto get_vma;
8656
	    case DT_SUSE_DIRECT:
8657
	      name = ".suse.direct";
8658
	      goto get_vma;
8495
	    case DT_VERSYM:
8659
	    case DT_VERSYM:
8496
	      name = ".gnu.version";
8660
	      name = ".gnu.version";
8497
	    get_vma:
8661
	    get_vma:
(-)binutils-2.16/binutils/readelf.c (-2 / +138 lines)
Lines 143-148 Link Here
143
static int do_dynamic;
143
static int do_dynamic;
144
static int do_syms;
144
static int do_syms;
145
static int do_reloc;
145
static int do_reloc;
146
static int do_direct;
146
static int do_sections;
147
static int do_sections;
147
static int do_section_groups;
148
static int do_section_groups;
148
static int do_section_details;
149
static int do_section_details;
Lines 1519-1524 Link Here
1519
    case DT_SYMINFO:	return "SYMINFO"; /* aka ADDRRNGHI */
1520
    case DT_SYMINFO:	return "SYMINFO"; /* aka ADDRRNGHI */
1520
1521
1521
    case DT_VERSYM:	return "VERSYM";
1522
    case DT_VERSYM:	return "VERSYM";
1523
    case DT_SUSE_DIRECT:	return "SUSE_DIRECT";
1522
1524
1523
    case DT_RELACOUNT:	return "RELACOUNT";
1525
    case DT_RELACOUNT:	return "RELACOUNT";
1524
    case DT_RELCOUNT:	return "RELCOUNT";
1526
    case DT_RELCOUNT:	return "RELCOUNT";
Lines 2590-2595 Link Here
2590
  {"symbols",	       no_argument, 0, 's'},
2592
  {"symbols",	       no_argument, 0, 's'},
2591
  {"syms",	       no_argument, 0, 's'},
2593
  {"syms",	       no_argument, 0, 's'},
2592
  {"relocs",	       no_argument, 0, 'r'},
2594
  {"relocs",	       no_argument, 0, 'r'},
2595
  {"direct",	       no_argument, 0, 'y'},
2593
  {"notes",	       no_argument, 0, 'n'},
2596
  {"notes",	       no_argument, 0, 'n'},
2594
  {"dynamic",	       no_argument, 0, 'd'},
2597
  {"dynamic",	       no_argument, 0, 'd'},
2595
  {"arch-specific",    no_argument, 0, 'A'},
2598
  {"arch-specific",    no_argument, 0, 'A'},
Lines 2626-2631 Link Here
2626
      --symbols          An alias for --syms\n\
2629
      --symbols          An alias for --syms\n\
2627
  -n --notes             Display the core notes (if present)\n\
2630
  -n --notes             Display the core notes (if present)\n\
2628
  -r --relocs            Display the relocations (if present)\n\
2631
  -r --relocs            Display the relocations (if present)\n\
2632
  -y --direct            Display direct linkage table (if present)\n\
2629
  -u --unwind            Display the unwind info (if present)\n\
2633
  -u --unwind            Display the unwind info (if present)\n\
2630
  -d --dynamic           Display the dynamic section (if present)\n\
2634
  -d --dynamic           Display the dynamic section (if present)\n\
2631
  -V --version-info      Display the version sections (if present)\n\
2635
  -V --version-info      Display the version sections (if present)\n\
Lines 2693-2699 Link Here
2693
    usage ();
2697
    usage ();
2694
2698
2695
  while ((c = getopt_long
2699
  while ((c = getopt_long
2696
	  (argc, argv, "ersuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF)
2700
	  (argc, argv, "erysuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF)
2697
    {
2701
    {
2698
      char *cp;
2702
      char *cp;
2699
      int section;
2703
      int section;
Lines 2710-2715 Link Here
2710
	case 'a':
2714
	case 'a':
2711
	  do_syms++;
2715
	  do_syms++;
2712
	  do_reloc++;
2716
	  do_reloc++;
2717
	  do_direct++;
2713
	  do_unwind++;
2718
	  do_unwind++;
2714
	  do_dynamic++;
2719
	  do_dynamic++;
2715
	  do_header++;
2720
	  do_header++;
Lines 2738-2743 Link Here
2738
	case 'r':
2743
	case 'r':
2739
	  do_reloc++;
2744
	  do_reloc++;
2740
	  break;
2745
	  break;
2746
	case 'y':
2747
	  do_direct++;
2748
	  break;
2741
	case 'u':
2749
	case 'u':
2742
	  do_unwind++;
2750
	  do_unwind++;
2743
	  break;
2751
	  break;
Lines 2943-2949 Link Here
2943
	}
2951
	}
2944
    }
2952
    }
2945
2953
2946
  if (!do_dynamic && !do_syms && !do_reloc && !do_unwind && !do_sections
2954
  if (!do_dynamic && !do_syms && !do_reloc && !do_direct && !do_unwind && !do_sections
2947
      && !do_segments && !do_header && !do_dump && !do_version
2955
      && !do_segments && !do_header && !do_dump && !do_version
2948
      && !do_histogram && !do_debugging && !do_arch && !do_notes
2956
      && !do_histogram && !do_debugging && !do_arch && !do_notes
2949
      && !do_section_groups)
2957
      && !do_section_groups)
Lines 4328-4333 Link Here
4328
  return 1;
4336
  return 1;
4329
}
4337
}
4330
4338
4339
static void
4340
print_dt_needed_name (int idx)
4341
{
4342
  const char *name = NULL;
4343
  Elf_Internal_Dyn *entry;
4344
4345
  idx &= DT_SUSE_DIRECT_MASK;
4346
 
4347
  switch (idx)
4348
    {
4349
    case 0:
4350
      name = _("<self>");
4351
      break;
4352
    case DT_SUSE_DIRECT_UNKNOWN:
4353
      name = _("<unknown>");
4354
      break;
4355
    default:
4356
      idx--;
4357
4358
      for (entry = dynamic_section;
4359
	   entry < dynamic_section + dynamic_nent && idx > 0;
4360
	   entry++)
4361
	if (entry->d_tag == DT_NEEDED)
4362
	  idx--;
4363
  
4364
      if (idx == 0)
4365
        {
4366
          if (VALID_DYNAMIC_NAME (entry->d_un.d_val))
4367
	    name = GET_DYNAMIC_NAME (entry->d_un.d_val);
4368
	  else
4369
	    name = NULL;
4370
	}
4371
      break;
4372
    }
4373
4374
  if (!name)
4375
    name = _("<out-of-range>");
4376
  if (do_wide)
4377
    printf ("%s", name);
4378
  else
4379
    printf ("%-25s", name);
4380
}
4381
4382
static int
4383
process_direct (FILE *file)
4384
{
4385
  unsigned int i;
4386
  unsigned int si;
4387
  char *strtab;
4388
  unsigned char *directtab;
4389
  Elf_Internal_Sym *symtab = NULL;
4390
  Elf_Internal_Sym *psym;
4391
  Elf_Internal_Shdr *direct = NULL;
4392
  Elf_Internal_Shdr *dynsym = NULL;
4393
  Elf_Internal_Shdr *section;
4394
4395
  if (!do_direct)
4396
    return 1;
4397
  if (!dynamic_symbols || !dynamic_section || !dynamic_strings)
4398
    return 1;
4399
4400
  for (i = 0, section = section_headers;
4401
       i < elf_header.e_shnum;
4402
       i++, section++)
4403
    {
4404
      if (section->sh_type == SHT_DYNSYM)
4405
        dynsym = section;
4406
      if (!strcmp (SECTION_NAME (section), ".suse.direct"))
4407
        direct = section;
4408
    }
4409
  if (!dynsym || !direct)
4410
    return 1;
4411
  
4412
  symtab = GET_ELF_SYMBOLS (file, dynsym);
4413
  if (!symtab)
4414
    return 1;
4415
4416
  directtab = get_data (NULL, file, direct->sh_offset,
4417
			direct->sh_size, 1, _("direct linkage table"));
4418
  if (!symtab)
4419
  {
4420
    free (symtab);
4421
    return 1;
4422
  }
4423
4424
  if (dynsym->sh_link == elf_header.e_shstrndx)
4425
    strtab = string_table;
4426
  else
4427
    {
4428
      Elf_Internal_Shdr *string_sec;
4429
4430
      string_sec = SECTION_HEADER (dynsym->sh_link);
4431
4432
      strtab = get_data (NULL, file, string_sec->sh_offset,
4433
			 string_sec->sh_size, 1, _("string table"));
4434
    }
4435
4436
  assert (strtab != NULL);
4437
4438
  printf (_("\nDirect relocations for image:\n"));
4439
  printf (_("   Num:  Index     Vague   Binding                    Symbol\n"));
4440
  for (si = 0, psym = symtab;
4441
       si < dynsym->sh_size / dynsym->sh_entsize;
4442
       si++, psym++)
4443
    {
4444
       unsigned int field;
4445
       printf ("%6d: ", si);
4446
       field = byte_get (directtab + (si * 2), 2);
4447
       printf ("[0x%.4x]   ", field);
4448
       printf ("%s", (field & DT_SUSE_DIRECT_VAGUE) ? "Vague" : "     ");
4449
       printf ("  ");
4450
       print_dt_needed_name (field);
4451
       printf ("  ");
4452
       print_symbol (25, strtab + psym->st_name);
4453
       printf ("\n");
4454
    }
4455
4456
4457
  free (symtab);
4458
  if (strtab != string_table)
4459
    free (strtab);
4460
4461
  return 1;
4462
}
4463
4464
4331
/* Process the unwind section.  */
4465
/* Process the unwind section.  */
4332
4466
4333
#include "unwind-ia64.h"
4467
#include "unwind-ia64.h"
Lines 11784-11789 Link Here
11784
11918
11785
  process_relocs (file);
11919
  process_relocs (file);
11786
11920
11921
  process_direct (file);
11922
11787
  process_unwind (file);
11923
  process_unwind (file);
11788
11924
11789
  process_symbol_table (file);
11925
  process_symbol_table (file);
(-)binutils-2.16/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 416-421 Link Here
416
419
417
  /* Start and end of RELRO region.  */
420
  /* Start and end of RELRO region.  */
418
  bfd_vma relro_start, relro_end;
421
  bfd_vma relro_start, relro_end;
422
423
  /* current max dtinfo section number */
424
  int dt_needed_index;
419
};
425
};
420
426
421
/* This structures holds a set of callback functions.  These are
427
/* This structures holds a set of callback functions.  These are
(-)binutils-2.16/include/elf/common.h (+5 lines)
Lines 635-640 Link Here
635
#define DF_BIND_NOW	(1 << 3)
636
#define DF_BIND_NOW	(1 << 3)
636
#define DF_STATIC_TLS	(1 << 4)
637
#define DF_STATIC_TLS	(1 << 4)
637
638
639
/* Constants for the DT_DIRECT entries. */
640
#define DT_SUSE_DIRECT_VAGUE   (1<<15)
641
#define DT_SUSE_DIRECT_MASK     0xfff
642
#define DT_SUSE_DIRECT_UNKNOWN  DT_SUSE_DIRECT_MASK
643
638
/* These constants are used for the version number of a Elf32_Verdef
644
/* These constants are used for the version number of a Elf32_Verdef
639
   structure.  */
645
   structure.  */
640
646
(-)binutils-2.16/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/ld/lexsup.c (+6 lines)
Lines 70-75 Link Here
70
  OPTION_CREF,
70
  OPTION_CREF,
71
  OPTION_DEFSYM,
71
  OPTION_DEFSYM,
72
  OPTION_DEMANGLE,
72
  OPTION_DEMANGLE,
73
  OPTION_DIRECT,
73
  OPTION_DEMANGLER,
74
  OPTION_DEMANGLER,
74
  OPTION_DYNAMIC_LINKER,
75
  OPTION_DYNAMIC_LINKER,
75
  OPTION_SYSROOT,
76
  OPTION_SYSROOT,
Lines 341-346 Link Here
341
    '\0', NULL, NULL, ONE_DASH },
342
    '\0', NULL, NULL, ONE_DASH },
342
  { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
343
  { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
343
    '\0', NULL, N_("Bind global references locally"), ONE_DASH },
344
    '\0', NULL, N_("Bind global references locally"), ONE_DASH },
345
  { {"Bdirect", no_argument, NULL, OPTION_DIRECT},
346
    '\0', NULL, N_("Direct-linkage the the shared libraries"), ONE_DASH },
344
  { {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
347
  { {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
345
    '\0', NULL, N_("Check section addresses for overlaps (default)"),
348
    '\0', NULL, N_("Check section addresses for overlaps (default)"),
346
    TWO_DASHES },
349
    TWO_DASHES },
Lines 746-751 Link Here
746
	      cplus_demangle_set_style (style);
749
	      cplus_demangle_set_style (style);
747
	    }
750
	    }
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