Your elf-bfd.h and elflink.c changes caused ld regressions for cris-axis-elf (likely others)

Alan Modra amodra@bigpond.net.au
Sat Mar 19 00:18:00 GMT 2005


On Fri, Mar 18, 2005 at 07:37:23AM -0800, H. J. Lu wrote:
> On Fri, Mar 18, 2005 at 04:08:28PM +0100, Hans-Peter Nilsson wrote:
> > (Forgot to CC the list.  I'm not *that* polite. :-)
> > 
> > Apparently (because it's the only change) this change:
> > 
> > 2005-03-18  Alan Modra  <amodra@bigpond.net.au>
> > 
> > 	* elf-bfd.h (_bfd_elf_link_renumber_dynsyms): Delete.
> > 	* elflink.c (_bfd_elf_link_renumber_dynsyms): Make static, add
> > 	section_sym_count param, and return number of section symbols.
> > 	(bfd_elf_size_dynamic_sections): Clear section symbol area of
> > 	.dynsym contents.  Don't bother calling swap_symbol_out on the
> > 	first all-zero dynsym.
> > 	(elf_mark_used_section): Formatting.  Avoid twiddling flags in
> > 	special sections like bfd_abs_section.
> > 	(bfd_elf_gc_sections): Spelling fix.
> > 
> > caused these failures for cris-axis-elf:

Huh.  What cris weirdness is this exposing?  Symbols defined in output
sections?

Looks..  Oh, OK, the symbols defined in output sections are some
provided by the linker script.  I guess it's not cris weirdness after
all.  ;-)

> I will check it in shortly.
> 
> 
> H.J.
> ----
> --- bfd/elflink.c.zero	2005-03-18 06:23:37.000000000 -0800
> +++ bfd/elflink.c	2005-03-18 06:55:10.322391518 -0800
> @@ -9012,7 +9012,9 @@ elf_mark_used_section (struct elf_link_h
>        || h->root.type == bfd_link_hash_defweak)
>      {
>        asection *s = h->root.u.def.section;
> -      if (s != NULL && s->output_section != NULL && s->output_section != s)
> +      if (s != NULL
> +	  && s->output_section != NULL
> +	  && !bfd_is_const_section (s->output_section))
>  	s->output_section->flags |= SEC_KEEP;
>      }

You may as well leave off the !bfd_is_const_section test, or revert to
as you had it.  At one stage bdf_abs_section was const, so attempting to
change flags would cause segfaults.  I overreacted to think it incorrect
to twiddle bfd_abs_section.  It doesn't really matter to just set
SEC_KEEP.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list