public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [arm-gnu] interlinking with other EABI toolchains
       [not found] <831x8xon6s.fsf@www2.muking.org>
@ 2005-04-27 16:22 ` Nick Clifton
  2005-04-27 17:25   ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2005-04-27 16:22 UTC (permalink / raw)
  To: Kevin Hilman, Daniel Jacobowitz; +Cc: arm-gnu, binutils

[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

Hi Kevin,

> For simple tests, I can use the GNU linker to link GNU-compiled and
> TI-compiled files.  However, I started applying this to a bigger
> project and I'm seeing a crash (SIGSEGV) in the GNU linker.

Although the cause of this problem has now been found (the TI assembler 
was emitting WEAK symbols in the LOCAL section of the symbol table) this 
does not excuse the linker - it should never seg fault.  Instead it 
should issue a proper error message and exit without completing the link.

Hence I am going to apply the patch below to fix this fault.  With the 
patch applied I now get:

   ld: error: bspSystem.o contains a reloc (0x00000602) for section 
.data that references a non-existent global symbol
   ld: final link failed: Bad value

when attempting to link your test case.

Daniel - I  would like this patch to go into the 2.16 branch if there is 
still time ?

Cheers
   Nick

bfd/ChangeLog
2005-04-27  Nick Clifton  <nickc@redhat.com>

	* elflink.c (elf_link_input_bfd): Handle the case where a badly
	formatted input file results in a reloc which has no associated
	global symbol.


[-- Attachment #2: elflink.c.patch --]
[-- Type: text/plain, Size: 1184 bytes --]

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.147
diff -c -3 -p -r1.147 elflink.c
*** bfd/elflink.c	25 Apr 2005 14:59:09 -0000	1.147
--- bfd/elflink.c	27 Apr 2005 10:07:21 -0000
*************** elf_link_input_bfd (struct elf_final_lin
*** 7019,7024 ****
--- 7019,7041 ----
  			  && finfo->sections[r_symndx] == NULL))
  		    {
  		      h = sym_hashes[r_symndx - extsymoff];
+ 		      
+ 		      /* Badly formatted input files can contain relocs that
+ 			 reference non-existant symbols.  Check here so that
+ 			 we do not seg fault.  */
+ 		      if (h == NULL)
+ 			{
+ 			  char buffer [32];
+ 
+ 			  sprintf_vma (buffer, rel->r_info);
+ 			  (*_bfd_error_handler)
+ 			    (_("error: %B contains a reloc (0x%s) for section %A "
+ 			       "that references a non-existant global symbol"),
+ 			     input_bfd, o, buffer);
+ 			  bfd_set_error (bfd_error_bad_value);
+ 			  return FALSE;
+ 			}
+ 		      
  		      while (h->root.type == bfd_link_hash_indirect
  			     || h->root.type == bfd_link_hash_warning)
  			h = (struct elf_link_hash_entry *) h->root.u.i.link;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [arm-gnu] interlinking with other EABI toolchains
  2005-04-27 16:22 ` [arm-gnu] interlinking with other EABI toolchains Nick Clifton
@ 2005-04-27 17:25   ` Daniel Jacobowitz
  2005-04-27 17:54     ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-04-27 17:25 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Kevin Hilman, arm-gnu, binutils

On Wed, Apr 27, 2005 at 11:08:05AM +0100, Nick Clifton wrote:
> Daniel - I  would like this patch to go into the 2.16 branch if there is 
> still time ?
> 
> Cheers
>   Nick
> 
> bfd/ChangeLog
> 2005-04-27  Nick Clifton  <nickc@redhat.com>
> 
> 	* elflink.c (elf_link_input_bfd): Handle the case where a badly
> 	formatted input file results in a reloc which has no associated
> 	global symbol.

Yes, this is fine for the branch.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [arm-gnu] interlinking with other EABI toolchains
  2005-04-27 17:25   ` Daniel Jacobowitz
@ 2005-04-27 17:54     ` Nick Clifton
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2005-04-27 17:54 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: binutils

Hi Daniel,

>>Daniel - I  would like this patch to go into the 2.16 branch if there is 
>>still time ?

>>bfd/ChangeLog
>>2005-04-27  Nick Clifton  <nickc@redhat.com>
>>
>>	* elflink.c (elf_link_input_bfd): Handle the case where a badly
>>	formatted input file results in a reloc which has no associated
>>	global symbol.

> Yes, this is fine for the branch.

Thanks - I have checked it in.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-27 16:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <831x8xon6s.fsf@www2.muking.org>
2005-04-27 16:22 ` [arm-gnu] interlinking with other EABI toolchains Nick Clifton
2005-04-27 17:25   ` Daniel Jacobowitz
2005-04-27 17:54     ` Nick Clifton

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).