http://sourceware.org/bugzilla/show_bug.cgi?id=12921

           Summary: sh_offset for SHT_NOBITS sections
           Product: binutils
           Version: 2.22 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassig...@sources.redhat.com
        ReportedBy: ja...@redhat.com


A recent change in ld broke prelink.

E>g. on the attached testcase:

struct A { char a; struct A *b; int *c; };
static struct A local = { 77, &local, 0 };
int vbss[16384] __attribute__((aligned (4096)));
int vdata __attribute__((aligned (4096))) = 5;

asm (".text; .balign 4096; vtext:; .previous");

int main()
{
  asm volatile ("" : : "m" (local), "m" (vbss[0]), "m" (vdata));
  return 0;
}

we used to emit (e.g. in 2.21.0.51.0.6, but like since forever):
  [24] .data             PROGBITS        0000000000603000 003000 001028 00  WA 
0   0 4096
  [25] .bss              NOBITS          0000000000605000 004028 011000 00  WA 
0   0 4096
  [26] .comment          PROGBITS        0000000000000000 004028 000058 01  MS 
0   0  1
  [27] .shstrtab         STRTAB          0000000000000000 004080 0000ee 00     
0   0  1

but now (2.21.52.0.1) we emit:
  [24] .data             PROGBITS        0000000000603000 003000 002004 00  WA 
0   0 4096
  [25] .bss              NOBITS          0000000000606000 006000 011000 00  WA 
0   0 4096
  [26] .comment          PROGBITS        0000000000000000 005004 000059 01  MS 
0   0  1
  [27] .shstrtab         STRTAB          0000000000000000 00505d 0000ee 00     
0   0  1

The problem is that the sh_offset for .bss is no longer smaller or equal to the
next section's sh_offset, but, what's more important, is that it is even way
after the end of the file on disk.
When elfutils libelf tries to write this during prelink --undo, it will write
0x6000 bytes of file instead of just 0x505d+0xee the original file had.
Can this change be please reverted?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to