[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ld internal error with --just-symbols flag
From: |
Alan Modra |
Subject: |
Re: ld internal error with --just-symbols flag |
Date: |
Tue, 18 Jan 2005 19:06:38 +1030 |
User-agent: |
Mutt/1.4i |
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