<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>1463</bug_id>
          
          <creation_ts>2011-09-08 08:54:52 +0000</creation_ts>
          <short_desc>MIPS prelinking with latest compiler produces warnings/errors</short_desc>
          <delta_ts>2012-01-25 08:24:28 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Cross-prelink</product>
          <component>cross-prelink</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>mips</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Hatle">mark.hatle</reporter>
          <assigned_to name="Mark Hatle">mark.hatle</assigned_to>
          <cc>raj.khem</cc>
    
    <cc>sgw</cc>
    
    <cc>yp.cp.watcher</cc>
    
    <cc>yp.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>16101</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-09-08 08:54:52 +0000</bug_when>
    <thetext>When prelinking against executables produce with the latest compilers, a number of warnings/errors are produced that indicate that section ordering does not match the prelinker&apos;s expectations.

The error message is:

NOBITS section followed by non-NOBITS section in the same segment

In order to reproduce the issue.  Use oe-core or Yocto Project to build a mips target image with the prelinker enabled.  Look at the temp/log.do_rootfs file for the error messages.

The error is traced down to the code:


exec.c:

        for (j = 1; j &lt; dso-&gt;ehdr.e_shnum; ++j)
          if (dso-&gt;shdr[j].sh_addr &gt;= dso-&gt;phdr[i].p_vaddr
              &amp;&amp; dso-&gt;shdr[j].sh_addr + dso-&gt;shdr[j].sh_size
                 &lt;= dso-&gt;phdr[i].p_vaddr + dso-&gt;phdr[i].p_memsz)
            {
              if (dso-&gt;shdr[j].sh_type != SHT_NOBITS
                  || (dso-&gt;shdr[j].sh_flags &amp; SHF_TLS))
                {
                  if (sfirst)
                    {
                      error (0, 0, &quot;%s: NOBITS section followed by non-NOBITS
section in the same segment&quot;,
                             dso-&gt;filename);
                      goto error_out;
                    }
                  continue;
                }

              if (!sfirst)
                sfirst = j;
              if (strcmp (strptr (dso, dso-&gt;ehdr.e_shstrndx,
                                  dso-&gt;shdr[j].sh_name), &quot;.plt&quot;) == 0)
                slast = j + 1;
              else if (j == new_dynbss || j == new_sdynbss)
                slast = j;
            }

It loops over the sections, and if there is a PROGBITS and other sections after
non-NOBITS it throws an error.

All of the executables being produced by the latest toolchains look like:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        00400134 000134 00000d 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            00400144 000144 000020 00   A  0   0  4
  [ 3] .dynamic          DYNAMIC         00400164 000164 0000d8 08   A  6   0  4
  [ 4] .hash             HASH            0040023c 00023c 000f94 04   A  5   0  4
  [ 5] .dynsym           DYNSYM          004011d0 0011d0 001540 10   A  6   1  4
  [ 6] .dynstr           STRTAB          00402710 002710 000b75 00   A  0   0  1
  [ 7] .gnu.version      VERSYM          00403286 003286 0002a8 02   A  5   0  2
  [ 8] .gnu.version_r    VERNEED         00403530 003530 000080 00   A  6   1  4
  [ 9] .init             PROGBITS        004035b0 0035b0 000078 00  AX  0   0  4
  [10] .text             PROGBITS        00403630 003630 090450 00  AX  0   0 16
  [11] .MIPS.stubs       PROGBITS        00493a80 093a80 001280 00  AX  0   0  4
  [12] .fini             PROGBITS        00494d00 094d00 000044 00  AX  0   0  4
  [13] .rodata           PROGBITS        00494d50 094d50 010631 00   A  0   0 16
  [14] .eh_frame_hdr     PROGBITS        004a5384 0a5384 00002c 00   A  0   0  4
  [15] .eh_frame         PROGBITS        004a53b0 0a53b0 000068 00   A  0   0  4
  [16] .ctors            PROGBITS        004b5418 0a5418 000008 00  WA  0   0  4
  [17] .dtors            PROGBITS        004b5420 0a5420 000008 00  WA  0   0  4
  [18] .jcr              PROGBITS        004b5428 0a5428 000004 00  WA  0   0  4
  [19] .data.rel.ro      PROGBITS        004b542c 0a542c 000c48 00  WA  0   0  4
  [20] .data             PROGBITS        004b6074 0a6074 00013a 00  WA  0   0  4
  [21] .rld_map          PROGBITS        004b61b0 0a61b0 000004 00  WA  0   0  4
  [22] .got              PROGBITS        004b61c0 0a61c0 000568 04 WAp  0   0 16
  [23] .sdata            PROGBITS        004b6728 0a6728 000004 00 WAp  0   0  4
  [24] .sbss             NOBITS          004b672c 0a672c 00003d 00 WAp  0   0  4
  [25] .bss              NOBITS          004b6770 0a672c 0021cc 00  WA  0   0 16
  [26] .gnu.attributes   LOOS+ffffff5    00000000 0a672c 000010 00      0   0  1
  [27] .mdebug.abi32     PROGBITS        004b893c 0a673c 000000 00      0   0  1
  [28] .gnu_debuglink    PROGBITS        00000000 0a673c 00000c 00      0   0  1
  [29] .shstrtab         STRTAB          00000000 0a6748 00010d 00      0   0  1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17932</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-01-03 10:34:24 +0000</bug_when>
    <thetext>This is still an ongoing issue.

I believe the generated code from the linker is correct, but I&apos;m not sure yet how to either change the linker ordering or update the prelinker to support this unique ordering.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17974</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-01-05 11:40:47 +0000</bug_when>
    <thetext>A possible fix for this issue has been sent to the oe-core mailing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18140</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-01-13 09:42:23 +0000</bug_when>
    <thetext>Fix has been pushed to the cross-prelink repository.  An update to the prelink recipe is pending.

cross-prelink commit id: 7b47f2f8a15ed13b7905bc120bb2586f3e164f7d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18347</commentid>
    <comment_count>4</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-01-25 08:24:28 +0000</bug_when>
    <thetext>Fixed - oe-core commit: 09a70c55e590d169b8a3b4b89853c96b7b977fc0</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>