Lines 221-226
Link Here
|
221 |
return FALSE; |
221 |
return FALSE; |
222 |
} |
222 |
} |
223 |
|
223 |
|
|
|
224 |
if ( info->direct && !info->executable ) |
225 |
{ |
226 |
s = bfd_make_section (abfd, ".suse.direct"); |
227 |
if (s == NULL |
228 |
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) |
229 |
|| ! bfd_set_section_alignment (abfd, s, 2)) |
230 |
return FALSE; |
231 |
elf_hash_table (info)->direct_sec = s; |
232 |
} |
233 |
|
224 |
/* Create sections to hold version informations. These are removed |
234 |
/* Create sections to hold version informations. These are removed |
225 |
if they are not needed. */ |
235 |
if they are not needed. */ |
226 |
s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_d", |
236 |
s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_d", |
Lines 3085-3090
Link Here
|
3085 |
|
3095 |
|
3086 |
if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex)) |
3096 |
if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex)) |
3087 |
return -1; |
3097 |
return -1; |
|
|
3098 |
elf_dt_needed_idx (abfd) = ++(info->dt_needed_index); |
3088 |
} |
3099 |
} |
3089 |
else |
3100 |
else |
3090 |
/* We were just checking for existence of the tag. */ |
3101 |
/* We were just checking for existence of the tag. */ |
Lines 3338-3343
Link Here
|
3338 |
bfd_boolean add_needed; |
3349 |
bfd_boolean add_needed; |
3339 |
struct elf_link_hash_table *htab; |
3350 |
struct elf_link_hash_table *htab; |
3340 |
bfd_size_type amt; |
3351 |
bfd_size_type amt; |
|
|
3352 |
asection *direct_sec; |
3353 |
unsigned char *direct_data; |
3341 |
void *alloc_mark = NULL; |
3354 |
void *alloc_mark = NULL; |
3342 |
struct bfd_hash_entry **old_table = NULL; |
3355 |
struct bfd_hash_entry **old_table = NULL; |
3343 |
unsigned int old_size = 0; |
3356 |
unsigned int old_size = 0; |
Lines 3355-3360
Link Here
|
3355 |
htab = elf_hash_table (info); |
3368 |
htab = elf_hash_table (info); |
3356 |
bed = get_elf_backend_data (abfd); |
3369 |
bed = get_elf_backend_data (abfd); |
3357 |
|
3370 |
|
|
|
3371 |
direct_sec = NULL; |
3372 |
direct_data = NULL; |
3373 |
|
3358 |
if ((abfd->flags & DYNAMIC) == 0) |
3374 |
if ((abfd->flags & DYNAMIC) == 0) |
3359 |
dynamic = FALSE; |
3375 |
dynamic = FALSE; |
3360 |
else |
3376 |
else |
Lines 3374-3379
Link Here
|
3374 |
bfd_set_error (bfd_error_wrong_format); |
3390 |
bfd_set_error (bfd_error_wrong_format); |
3375 |
goto error_return; |
3391 |
goto error_return; |
3376 |
} |
3392 |
} |
|
|
3393 |
if (info->direct) |
3394 |
direct_sec = bfd_get_section_by_name (abfd, ".suse.direct"); |
3395 |
if (direct_sec != NULL) |
3396 |
{ |
3397 |
direct_data = bfd_alloc (abfd, direct_sec->size); |
3398 |
if (direct_data == NULL |
3399 |
|| ! bfd_get_section_contents (abfd, direct_sec, |
3400 |
direct_data, 0, direct_sec->size)) |
3401 |
goto error_return; |
3402 |
} |
3377 |
} |
3403 |
} |
3378 |
|
3404 |
|
3379 |
ehdr = elf_elfheader (abfd); |
3405 |
ehdr = elf_elfheader (abfd); |
Lines 4115-4120
Link Here
|
4115 |
&& vernum > 1 |
4141 |
&& vernum > 1 |
4116 |
&& definition) |
4142 |
&& definition) |
4117 |
h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1]; |
4143 |
h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1]; |
|
|
4144 |
|
4145 |
if (direct_sec != NULL) |
4146 |
{ |
4147 |
unsigned long d_idx = isym - isymbuf; |
4148 |
unsigned long direct_entry; |
4149 |
d_idx += extsymoff; |
4150 |
d_idx *= 2; |
4151 |
BFD_ASSERT (d_idx <= bfd_get_section_size (direct_sec)); |
4152 |
direct_entry = bfd_get_16 (abfd, direct_data + d_idx); |
4153 |
if ((direct_entry & DT_SUSE_DIRECT_VAGUE) != 0) |
4154 |
h->vague_ref = 1; |
4155 |
if (!h->vague_ref |
4156 |
&& (direct_entry & DT_SUSE_DIRECT_MASK) != |
4157 |
DT_SUSE_DIRECT_UNKNOWN) |
4158 |
h->concrete_ref = 1; |
4159 |
} |
4160 |
|
4118 |
} |
4161 |
} |
4119 |
|
4162 |
|
4120 |
if (! (_bfd_generic_link_add_one_symbol |
4163 |
if (! (_bfd_generic_link_add_one_symbol |
Lines 4885-4890
Link Here
|
4885 |
if (isymbuf != NULL) |
4928 |
if (isymbuf != NULL) |
4886 |
free (isymbuf); |
4929 |
free (isymbuf); |
4887 |
error_return: |
4930 |
error_return: |
|
|
4931 |
if (direct_data != NULL) |
4932 |
free (direct_data); |
4888 |
return FALSE; |
4933 |
return FALSE; |
4889 |
} |
4934 |
} |
4890 |
|
4935 |
|
Lines 6402-6407
Link Here
|
6402 |
return FALSE; |
6447 |
return FALSE; |
6403 |
} |
6448 |
} |
6404 |
|
6449 |
|
|
|
6450 |
/* Create the direct bindings section - 1 entry per dynsym. */ |
6451 |
s = bfd_get_section_by_name (dynobj, ".suse.direct"); |
6452 |
if (s != NULL) |
6453 |
{ |
6454 |
if (dynsymcount == 0) |
6455 |
s->flags |= SEC_EXCLUDE; |
6456 |
else |
6457 |
{ |
6458 |
s->size = dynsymcount * sizeof (Elf_External_Direct); |
6459 |
s->contents = bfd_zalloc (output_bfd, s->size); |
6460 |
if (s->contents == NULL) |
6461 |
return FALSE; |
6462 |
memset (s->contents, 0xff, s->size); |
6463 |
if (!_bfd_elf_add_dynamic_entry (info, DT_SUSE_DIRECT, 0)) |
6464 |
return FALSE; |
6465 |
} |
6466 |
} |
6467 |
|
6405 |
/* Set the size of the .dynsym and .hash sections. We counted |
6468 |
/* Set the size of the .dynsym and .hash sections. We counted |
6406 |
the number of dynamic symbols in elf_link_add_object_symbols. |
6469 |
the number of dynamic symbols in elf_link_add_object_symbols. |
6407 |
We will build the contents of .dynsym and .hash when we build |
6470 |
We will build the contents of .dynsym and .hash when we build |
Lines 6869-6874
Link Here
|
6869 |
|
6932 |
|
6870 |
table->root.type = bfd_link_elf_hash_table; |
6933 |
table->root.type = bfd_link_elf_hash_table; |
6871 |
table->hash_table_id = target_id; |
6934 |
table->hash_table_id = target_id; |
|
|
6935 |
table->direct_sec = NULL; |
6872 |
|
6936 |
|
6873 |
return ret; |
6937 |
return ret; |
6874 |
} |
6938 |
} |
Lines 7424-7429
Link Here
|
7424 |
asection *hash_sec; |
7488 |
asection *hash_sec; |
7425 |
/* symbol version section (.gnu.version). */ |
7489 |
/* symbol version section (.gnu.version). */ |
7426 |
asection *symver_sec; |
7490 |
asection *symver_sec; |
|
|
7491 |
/* .direct linkage section. */ |
7492 |
asection *direct_sec; |
7427 |
/* Buffer large enough to hold contents of any section. */ |
7493 |
/* Buffer large enough to hold contents of any section. */ |
7428 |
bfd_byte *contents; |
7494 |
bfd_byte *contents; |
7429 |
/* Buffer large enough to hold external relocs of any section. */ |
7495 |
/* Buffer large enough to hold external relocs of any section. */ |
Lines 8703-8708
Link Here
|
8703 |
|
8769 |
|
8704 |
eoinfo->file_sym_done = TRUE; |
8770 |
eoinfo->file_sym_done = TRUE; |
8705 |
} |
8771 |
} |
|
|
8772 |
|
8773 |
if (finfo->direct_sec != NULL) |
8774 |
{ |
8775 |
int dt_index = DT_SUSE_DIRECT_UNKNOWN; |
8776 |
bfd_vma offset = 2 * h->dynindx; |
8777 |
BFD_ASSERT (offset <= finfo->direct_sec->size); |
8778 |
|
8779 |
if ((h->root.type == bfd_link_hash_defined |
8780 |
|| h->root.type == bfd_link_hash_defweak) |
8781 |
&& h->root.u.def.section != NULL |
8782 |
&& h->root.u.def.section->owner != NULL) |
8783 |
{ |
8784 |
asection *sec = h->root.u.def.section; |
8785 |
|
8786 |
dt_index = elf_dt_needed_idx (sec->owner); |
8787 |
|
8788 |
if ((sec->owner->flags & DYNAMIC) == 0) |
8789 |
{ |
8790 |
if (sec->name == NULL |
8791 |
|| strncmp (sec->name, ".gnu.linkonce", |
8792 |
sizeof ".gnu.linkonce" - 1) == 0) |
8793 |
dt_index |= DT_SUSE_DIRECT_VAGUE; |
8794 |
|
8795 |
/* app -> library data references get turned into copy |
8796 |
relocs, so objects can migrate unpredictably into the |
8797 |
application itself. */ |
8798 |
else if (h->type == STT_OBJECT) |
8799 |
dt_index |= DT_SUSE_DIRECT_VAGUE; |
8800 |
} |
8801 |
else if (h->vague_ref) |
8802 |
dt_index |= DT_SUSE_DIRECT_VAGUE; |
8803 |
|
8804 |
else if (!h->concrete_ref) |
8805 |
dt_index = DT_SUSE_DIRECT_UNKNOWN; |
8806 |
|
8807 |
} |
8808 |
bfd_put_16 (finfo->output_bfd, |
8809 |
dt_index, |
8810 |
finfo->direct_sec->contents + offset); |
8811 |
} |
8706 |
} |
8812 |
} |
8707 |
else |
8813 |
else |
8708 |
{ |
8814 |
{ |
Lines 10511-10516
Link Here
|
10511 |
|
10617 |
|
10512 |
if (! dynamic) |
10618 |
if (! dynamic) |
10513 |
{ |
10619 |
{ |
|
|
10620 |
finfo.direct_sec = NULL; |
10514 |
flinfo.dynsym_sec = NULL; |
10621 |
flinfo.dynsym_sec = NULL; |
10515 |
flinfo.hash_sec = NULL; |
10622 |
flinfo.hash_sec = NULL; |
10516 |
flinfo.symver_sec = NULL; |
10623 |
flinfo.symver_sec = NULL; |
Lines 10518-10523
Link Here
|
10518 |
} |
10625 |
} |
10519 |
else |
10626 |
else |
10520 |
{ |
10627 |
{ |
|
|
10628 |
finfo.direct_sec = bfd_get_section_by_name (dynobj, ".suse.direct"); |
10521 |
flinfo.dynsym_sec = bfd_get_linker_section (dynobj, ".dynsym"); |
10629 |
flinfo.dynsym_sec = bfd_get_linker_section (dynobj, ".dynsym"); |
10522 |
flinfo.hash_sec = bfd_get_linker_section (dynobj, ".hash"); |
10630 |
flinfo.hash_sec = bfd_get_linker_section (dynobj, ".hash"); |
10523 |
/* Note that dynsym_sec can be NULL (on VMS). */ |
10631 |
/* Note that dynsym_sec can be NULL (on VMS). */ |
Lines 11350-11355
Link Here
|
11350 |
case DT_VERNEED: |
11458 |
case DT_VERNEED: |
11351 |
name = ".gnu.version_r"; |
11459 |
name = ".gnu.version_r"; |
11352 |
goto get_vma; |
11460 |
goto get_vma; |
|
|
11461 |
case DT_SUSE_DIRECT: |
11462 |
name = ".suse.direct"; |
11463 |
goto get_vma; |
11353 |
case DT_VERSYM: |
11464 |
case DT_VERSYM: |
11354 |
name = ".gnu.version"; |
11465 |
name = ".gnu.version"; |
11355 |
get_vma: |
11466 |
get_vma: |