------- Additional Comments From wilson at specifix dot com 2006-09-11 20:26 ------- Subject: Re: New: ld elf64-ia64.c segfault in set_fptr_entry
On Sun, 2006-09-03 at 10:36 +0000, tbm at cyrius dot com wrote: > It fails both with Debian binutils 2.17 and current CVS HEAD. > /gcc-lib/ia64-linux-gnu/3.3.6/../../../crti.o symbol.s.o > /usr/bin/ld: BFD 2.17 Debian GNU/Linux assertion fail elf64-ia64.c:4874 > Segmentation fault There is a bug in the source code. It has #pragma weak _DYNAMIC void _DYNAMIC(void); if ((&_DYNAMIC != __null) && (d = (Elf64_Dyn *) _DYNAMIC)) ...process d as if it points to dynamic entries... This won't work on IA-64, as taking the address of a function returns the address of the function pointer. You would then have to redirect through the function pointer to get the actual function address you want. But to do so would be pointless. It is better to declare _DYNAMIC properly in the first place. If you use this extern char _DYNAMIC[0]; then you won't get a linker segfault, and you will also get code that has a chance of working. The linker shouldn't be segfaulting of course though. The linker bug appears to be in allocate_fptr in bfd/el64-ia64.c. This function returns false in this case, as a bfd_elf_link_record_local_dynamic_symbol call fails. I didn't look into this routine in detail, but this failure seems OK, as we can't make _DYNAMIC a local symbol presumably. The failure return result from allocate_fptr gets lost though, as it is called from a hash table traversal routine that throws away return values. Thus no error is emitted here, and no fptr section space is allocated. When we eventually try to generate the descriptor, we get the segfault as we are writing as no space was ever allocated for it. So the solution here seems to be to either fix the elf64_ia64_dyn_sym_traverse function to return failure results, or else emit the error in allocate_fptr directly. The latter seems easier. My problem at the moment now is that I'm not quite sure what the error message should be. Is there such a thing as a global dynamic symbol? If so, maybe the error should be something like "can't resolve fptr reloc for global dynamic symbol" Or maybe something more general like "invalid fptr reloc" or "failed to allocate fptr reloc" is more appropriate. -- http://sourceware.org/bugzilla/show_bug.cgi?id=3169 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils