Empty section removal broke MIPS

Daniel Jacobowitz drow@false.org
Wed Apr 13 14:53:00 GMT 2005


Assemble and link this with a mips64-linux toolchain:

        .section        .sbss
        .align  3
        .type   bar, @object
        .size   bar, 0
bar:
        .text
        .align  2
        .globl  __start
        .ent    __start
        .type   __start, @function
__start:
        j       $31
        .end    __start

You'll get "nonrepresentable section on output".  We try to output the local
symbol bar, even though we have removed its section.  This patch appears to
work; tested mips64-linux-gnu via the binutils testsuite and by booting a
kernel linked with the new linker (the previous linker could not build a UP
Linux kernel).

There's some serious mojo wrong with the mips64 linker at the moment,
including an assertion fail at elfxx-mips.c:2466, and it looks like some of
the ld tests were not updated for empty for some sort of symbol removal.
I'll be back.  Same failures without this patch.

OK to commit?

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-04-13  Daniel Jacobowitz  <dan@codesourcery.com>

	* elflink.c (elf_link_input_bfd): Update check for removed sections.

Index: binutils/bfd/elflink.c
===================================================================
--- binutils.orig/bfd/elflink.c	2005-04-12 16:39:52.000000000 -0400
+++ binutils/bfd/elflink.c	2005-04-13 10:39:07.050398494 -0400
@@ -6869,6 +6869,11 @@ elf_link_input_bfd (struct elf_final_lin
 		  && (isec->flags & SEC_EXCLUDE) != 0)))
 	continue;
 
+      /* If the section is not in the output BFD's section list, it is not
+	 being output.  */
+      if (bfd_section_removed_from_list (output_bfd, isec->output_section))
+	continue;
+
       /* Get the name of the symbol.  */
       name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link,
 					      isym->st_name);



More information about the Binutils mailing list