* [patch] elf64-hppa handling for undefweak symbols
@ 2003-07-24 4:46 Randolph Chung
2003-07-30 2:15 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: Randolph Chung @ 2003-07-24 4:46 UTC (permalink / raw)
To: binutils
We are seeing ld segfaults when compiling linux kernels for
hppa64-linux. It looks like the linker does not properly handle LTOFF
relocs against undefweak symbols.
The following patch seems to allow me to build a working kernel.
Comments appreciated. Pls apply if it's ok.
thanks,
randolph
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
2003-07-15 Randolph Chung <tausq@debian.org>
* elf-hppa.h: fill in dyn_h to pass to
elf_hppa_final_link_relocate
* elf64-hppa.c: check to make sure symbol is
defined before applying relocation
Index: elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.62
diff -u -p -r1.62 elf-hppa.h
--- elf-hppa.h 25 Jun 2003 06:40:19 -0000 1.62
+++ elf-hppa.h 16 Jul 2003 05:10:49 -0000
@@ -1496,7 +1496,22 @@ elf_hppa_relocate_section (output_bfd, i
relocation = 0;
}
else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
+ {
+ dyn_name = get_dyn_name (input_section, h, rel,
+ &dynh_buf, &dynh_buflen);
+ dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+ dyn_name, FALSE, FALSE);
+
+ if (dyn_h == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
+ bfd_archive_filename (input_bfd), h->root.root.string,
+ bfd_get_section_name (input_bfd, input_section));
+ relocation = 0;
+ }
+ relocation = 0;
+ }
else
{
/* Ignore dynamic loader defined symbols. */
Index: elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.33
diff -u -p -r1.33 elf64-hppa.c
--- elf64-hppa.c 25 Jun 2003 06:40:23 -0000 1.33
+++ elf64-hppa.c 16 Jul 2003 05:10:49 -0000
@@ -2269,7 +2269,9 @@ elf64_hppa_finalize_dlt (dyn_h, data)
+ hppa_info->opd_sec->output_offset
+ hppa_info->opd_sec->output_section->vma);
}
- else if (h->root.u.def.section)
+ else if (h->root.type != bfd_link_hash_undefined &&
+ h->root.type != bfd_link_hash_undefweak &&
+ h->root.u.def.section)
{
value = h->root.u.def.value + h->root.u.def.section->output_offset;
if (h->root.u.def.section->output_section)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] elf64-hppa handling for undefweak symbols
2003-07-24 4:46 [patch] elf64-hppa handling for undefweak symbols Randolph Chung
@ 2003-07-30 2:15 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2003-07-30 2:15 UTC (permalink / raw)
To: Randolph Chung; +Cc: binutils
On Wed, Jul 23, 2003 at 09:50:24PM -0700, Randolph Chung wrote:
> 2003-07-15 Randolph Chung <tausq@debian.org>
>
> * elf-hppa.h: fill in dyn_h to pass to
> elf_hppa_final_link_relocate
> * elf64-hppa.c: check to make sure symbol is
> defined before applying relocation
ChangeLog needs to include function.
* elf-hppa.h (elf_hppa_relocate_section): Look up dyn_h for undefweak.
* elf64-hppa.c (elf64_hppa_finalize_dlt): Check h->root.type.
Applied with some tweaks.
> Index: elf-hppa.h
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf-hppa.h,v
> retrieving revision 1.62
> diff -u -p -r1.62 elf-hppa.h
> --- elf-hppa.h 25 Jun 2003 06:40:19 -0000 1.62
> +++ elf-hppa.h 16 Jul 2003 05:10:49 -0000
> @@ -1496,7 +1496,22 @@ elf_hppa_relocate_section (output_bfd, i
> relocation = 0;
> }
> else if (h->root.type == bfd_link_hash_undefweak)
> - relocation = 0;
> + {
> + dyn_name = get_dyn_name (input_section, h, rel,
> + &dynh_buf, &dynh_buflen);
> + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
> + dyn_name, FALSE, FALSE);
> +
> + if (dyn_h == NULL)
> + {
> + (*_bfd_error_handler)
> + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
> + bfd_archive_filename (input_bfd), h->root.root.string,
> + bfd_get_section_name (input_bfd, input_section));
> + relocation = 0;
Redundant assignment removed.
> + }
> + relocation = 0;
> + }
> else
> {
> /* Ignore dynamic loader defined symbols. */
> Index: elf64-hppa.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 elf64-hppa.c
> --- elf64-hppa.c 25 Jun 2003 06:40:23 -0000 1.33
> +++ elf64-hppa.c 16 Jul 2003 05:10:49 -0000
> @@ -2269,7 +2269,9 @@ elf64_hppa_finalize_dlt (dyn_h, data)
> + hppa_info->opd_sec->output_offset
> + hppa_info->opd_sec->output_section->vma);
> }
> - else if (h->root.u.def.section)
> + else if (h->root.type != bfd_link_hash_undefined &&
> + h->root.type != bfd_link_hash_undefweak &&
> + h->root.u.def.section)
Formatting! Hmm, better rewritten as
else if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->root.u.def.section)
> {
> value = h->root.u.def.value + h->root.u.def.section->output_offset;
> if (h->root.u.def.section->output_section)
>
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-07-30 2:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-24 4:46 [patch] elf64-hppa handling for undefweak symbols Randolph Chung
2003-07-30 2:15 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).