BFD/elflinker create empty symbols in symtab after binutils-2.20

Bug #707487 reported by Luse Cheng on 2011-01-25
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro Binutils
Invalid
Undecided
Unassigned

Bug Description

When the symbol entry in rodata.str1.1 is fully-merged by relaxing, the BFD/elflinker will create a zero address empty name symbol in symtab after binutils-2.20 since the bit of SEC_EXCLUDE in flag will be set by following code (elf_link_output_sym@bfd/elflink.c)

  if (name == NULL || *name == '\0')
    elfsym->st_name = 0;
  else if (input_sec->flags & SEC_EXCLUDE)
    elfsym->st_name = 0; // st_name will be set to emtry
  else
    {
      elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab,
                                                            name, TRUE, FALSE);
      if (elfsym->st_name == (unsigned long) -1)
        return 0;
    }

I think it's make sense that the address of NOTYPE symbol must be behind its section but zero address is not behind section "rodata.str1.1". In addition, Android's prelink makes errors for zero address symbol when prelinking.

Note: before binutils-2.19, merged string is saved in .glue_t section.

Alexander Sack (asac) wrote :
Jim Huang (jserv) wrote :

To clarify, I just make list about the combination and test results.

Original: csl-gcc + csl-binutils (binutils-2.20.51) => FAIL

Once the version of linaro-gcc is set to gcc-linaro-4.5-2011.01-1, binutils tests:
    linaro-gcc + binutils-2.19 (FSF) => OK
    linaro-gcc + binutils-2.20.1 (FSF) => OK
    linaro-gcc + binutils-2.21 (FSF) => FAIL
    linaro-gcc + binutils-2.20.51 (CSL) => FAIL
    linaro-gcc + binutils-2.20.1 (Google) => OK

Source:
(1) FSF: upstream
(2) CSL: CodeSourcery 2010q3
(3) Google: http://android.git.kernel.org/?p=toolchain/binutils.git;a=summary

Jim Huang (jserv) wrote :

From the above observation, it seems there are some regressions in binutils shipped with CodeSourcery 2010q3 release and binutils-2.21 from FSF.

Jim Huang (jserv) wrote :

NOTE: Google recently checked in binutils-20100303 [*], and it has the same problem.

[*] http://android.git.kernel.org/?p=toolchain/binutils.git;a=summary

Jim Huang (jserv) on 2011-04-06
Changed in binutils-linaro:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers