public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: ld internal error with --just-symbols flag
       [not found] <200501171123.13780.jason@catapult.com>
@ 2005-01-18  8:36 ` Alan Modra
  2005-01-20  1:45   ` Jason Khallouf
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2005-01-18  8:36 UTC (permalink / raw)
  To: Jason Khallouf; +Cc: bug-binutils, binutils

On Mon, Jan 17, 2005 at 11:23:13AM +1100, Jason Khallouf wrote:
> ~/misc> echo "int y;" > testbug.c
> ~/misc> gcc -c testbug.c
> ~/misc> ld --just-symbols testbug.o
> ld: internal error: aborting at ../../binutils-2.15/ld/ldlang.c line 3835 in 
> lang_place_orphans
> ld: please report this bug
> ~/misc>         
> 
[snip]
> for the CVS version the reported line number is 4445.

Err, I think I'm the culprit who added the abort..  The problem here is
that common variables are assigned to a section at a later stage than
the code that sets up --just-symbols sections.  Since the section might
need to be created, it doesn't have its vma and output_section set
correctly, and lang_place_orphans tries to do something with it.

bfd/
	* bfd.c (bfd_link_just_syms): Add abfd param.
	* bfd-in2.h: Regenerate.
ld/
	* ldlang.c (section_already_linked): Adjust bfd_link_just_syms call.
	(lang_place_orphans): Don't abort on just_syms_flag, instead call
	bfd_link_just_syms.

Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.70
diff -u -p -r1.70 bfd.c
--- bfd/bfd.c	16 Oct 2004 18:13:52 -0000	1.70
+++ bfd/bfd.c	18 Jan 2005 08:08:17 -0000
@@ -1203,7 +1203,7 @@ DESCRIPTION
 .#define bfd_link_add_symbols(abfd, info) \
 .	BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
 .
-.#define bfd_link_just_syms(sec, info) \
+.#define bfd_link_just_syms(abfd, sec, info) \
 .	BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
 .
 .#define bfd_final_link(abfd, info) \
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.169
diff -u -p -r1.169 ldlang.c
--- ld/ldlang.c	17 Dec 2004 15:50:02 -0000	1.169
+++ ld/ldlang.c	18 Jan 2005 08:08:53 -0000
@@ -1284,7 +1284,7 @@ section_already_linked (bfd *abfd, asect
      discard all sections.  */
   if (entry->just_syms_flag)
     {
-      bfd_link_just_syms (sec, &link_info);
+      bfd_link_just_syms (abfd, sec, &link_info);
       return;
     }
 
@@ -4442,9 +4442,8 @@ lang_place_orphans (void)
 		 around for a sensible place for it to go.  */
 
 	      if (file->just_syms_flag)
-		abort ();
-
-	      if ((s->flags & SEC_EXCLUDE) != 0)
+		bfd_link_just_syms (file->the_bfd, s, &link_info);
+	      else if ((s->flags & SEC_EXCLUDE) != 0)
 		s->output_section = bfd_abs_section_ptr;
 	      else if (strcmp (s->name, "COMMON") == 0)
 		{


-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* Re: ld internal error with --just-symbols flag
  2005-01-18  8:36 ` ld internal error with --just-symbols flag Alan Modra
@ 2005-01-20  1:45   ` Jason Khallouf
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Khallouf @ 2005-01-20  1:45 UTC (permalink / raw)
  To: Alan Modra; +Cc: bug-binutils, binutils

On Tue, 18 Jan 2005 07:36 pm, Alan Modra wrote:
> Err, I think I'm the culprit who added the abort..  The problem here is
> that common variables are assigned to a section at a later stage than
> the code that sets up --just-symbols sections.  Since the section might
> need to be created, it doesn't have its vma and output_section set
> correctly, and lang_place_orphans tries to do something with it.
>
> bfd/
> 	* bfd.c (bfd_link_just_syms): Add abfd param.
> 	* bfd-in2.h: Regenerate.
> ld/
> 	* ldlang.c (section_already_linked): Adjust bfd_link_just_syms call.
> 	(lang_place_orphans): Don't abort on just_syms_flag, instead call
> 	bfd_link_just_syms.
>

Thanks, that seems to have fixed it.  My own code still doesn't link properly, 
but I think it's more to do with problems in the code and/or my linker 
script.   

Jason

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

end of thread, other threads:[~2005-01-20  1:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200501171123.13780.jason@catapult.com>
2005-01-18  8:36 ` ld internal error with --just-symbols flag Alan Modra
2005-01-20  1:45   ` Jason Khallouf

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