* elf64-hppa.c (allocate_global_data_opd): We don't need an opd entry

for a symbol that has no output section.
	(allocate_dynrel_entries): Correct comment.
	(elf64_hppa_finalize_dynreloc): Likewise.  Don't create an opd entry
	unless we want one.
	(elf64_hppa_finalize_opd): Prevent segfault if dyn_h is NULL.
	(elf64_hppa_finalize_dlt): Likewise.  Prevent segfault for symbols
	with no section.  Remove unnecessary parentheses.
This commit is contained in:
Jeff Law 2002-06-12 18:12:25 +00:00
parent 03e83a45ae
commit 3db4b61245
2 changed files with 29 additions and 19 deletions

View file

@ -1,3 +1,14 @@
2002-06-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
* elf64-hppa.c (allocate_global_data_opd): We don't need an opd entry
for a symbol that has no output section.
(allocate_dynrel_entries): Correct comment.
(elf64_hppa_finalize_dynreloc): Likewise. Don't create an opd entry
unless we want one.
(elf64_hppa_finalize_opd): Prevent segfault if dyn_h is NULL.
(elf64_hppa_finalize_dlt): Likewise. Prevent segfault for symbols
with no section. Remove unnecessary parentheses.
2002-06-11 Tom Rix <trix@redhat.com>
* coffcode.h (coff_compute_section_file_positions): Add data

View file

@ -1159,7 +1159,8 @@ allocate_global_data_opd (dyn_h, data)
/* We never need an opd entry for a symbol which is not
defined by this output file. */
if (h && h->root.type == bfd_link_hash_undefined)
if (h && (h->root.type == bfd_link_hash_undefined
|| h->root.u.def.section->output_section == NULL))
dyn_h->want_opd = 0;
/* If we are creating a shared library, took the address of a local
@ -1168,9 +1169,8 @@ allocate_global_data_opd (dyn_h, data)
else if (x->info->shared
|| h == NULL
|| h->dynindx == -1
|| ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->root.u.def.section->output_section != NULL))
|| (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
{
/* If we are creating a shared library, then we will have to
create a runtime relocation for the symbol to properly
@ -1535,9 +1535,8 @@ allocate_dynrel_entries (dyn_h, data)
switch (rent->type)
{
case R_PARISC_FPTR64:
/* Allocate one iff we are not building a shared library and
!want_opd, which by this point will be true only if we're
actually allocating one statically in the main executable. */
/* Allocate one iff we are building a shared library and don't
want an opd entry. */
if (!x->info->shared && dyn_h->want_opd)
continue;
break;
@ -2115,7 +2114,7 @@ elf64_hppa_finalize_opd (dyn_h, data)
{
struct bfd_link_info *info = (struct bfd_link_info *)data;
struct elf64_hppa_link_hash_table *hppa_info;
struct elf_link_hash_entry *h = dyn_h->h;
struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL;
asection *sopd;
asection *sopdrel;
@ -2123,7 +2122,7 @@ elf64_hppa_finalize_opd (dyn_h, data)
sopd = hppa_info->opd_sec;
sopdrel = hppa_info->opd_rel_sec;
if (h && dyn_h && dyn_h->want_opd)
if (h && dyn_h->want_opd)
{
bfd_vma value;
@ -2236,7 +2235,7 @@ elf64_hppa_finalize_dlt (dyn_h, data)
struct bfd_link_info *info = (struct bfd_link_info *)data;
struct elf64_hppa_link_hash_table *hppa_info;
asection *sdlt, *sdltrel;
struct elf_link_hash_entry *h = dyn_h->h;
struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL;
hppa_info = elf64_hppa_hash_table (info);
@ -2247,7 +2246,7 @@ elf64_hppa_finalize_dlt (dyn_h, data)
address, so there is no need to create a relocation. Just install
the proper value into the DLT, note this shortcut can not be
skipped when building a shared library. */
if (! info->shared && h && dyn_h && dyn_h->want_dlt)
if (! info->shared && h && dyn_h->want_dlt)
{
bfd_vma value;
@ -2263,16 +2262,17 @@ elf64_hppa_finalize_dlt (dyn_h, data)
+ hppa_info->opd_sec->output_offset
+ hppa_info->opd_sec->output_section->vma);
}
else
else if (h->root.u.def.section)
{
value = (h->root.u.def.value
+ h->root.u.def.section->output_offset);
value = h->root.u.def.value + h->root.u.def.section->output_offset;
if (h->root.u.def.section->output_section)
value += h->root.u.def.section->output_section->vma;
else
value += h->root.u.def.section->vma;
}
else
/* We have an undefined function reference. */
value = 0;
/* We do not need to include the output offset of the DLT section
here because we are modifying the in-memory contents. */
@ -2360,9 +2360,8 @@ elf64_hppa_finalize_dynreloc (dyn_h, data)
switch (rent->type)
{
case R_PARISC_FPTR64:
/* Allocate one iff we are not building a shared library and
!want_opd, which by this point will be true only if we're
actually allocating one statically in the main executable. */
/* Allocate one iff we are building a shared library and don't
want an opd entry. */
if (!info->shared && dyn_h->want_opd)
continue;
break;
@ -2395,7 +2394,7 @@ elf64_hppa_finalize_dynreloc (dyn_h, data)
We use a section symbol recorded by check_relocs as the
base symbol for the relocation. The addend is the difference
between the section symbol and the address of the .opd entry. */
if (info->shared && rent->type == R_PARISC_FPTR64)
if (info->shared && rent->type == R_PARISC_FPTR64 && dyn_h->want_opd)
{
bfd_vma value, value2;