[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/6833] New: Linker sometimes produces 2MB section gap

From: jan dot kratochvil at redhat dot com
Subject: [Bug ld/6833] New: Linker sometimes produces 2MB section gap
Date: 11 Aug 2008 12:30:18 -0000

The produced file sometimes have a 2MB zeroed gap between sections.

Actual results:
-rwxr-xr-x 1 root root 2475480 Aug  7 17:12 cups-1.3.7-2.x86_64/usr/sbin/cupsd*

Expected results:
-rwxr-xr-x 1 root root 355264 May 13 13:14 /usr/sbin/cupsd*

Additional info:
Section Headers:
[Nr] Name                 Type         Addr             Off      Size     ES
Flags Lk Inf Al
[15] .eh_frame_hdr        PROGBITS     0000000000056830 00056830 00000944  0 A 
    0   0  4
[16] .eh_frame            PROGBITS     0000000000057178 00057178 00002a5c  0 A 
    0   0  8
[17] .ctors               PROGBITS     0000000000259bd0 00259bd0 00000010  0 WA
    0   0  8
[18] .dtors               PROGBITS     0000000000259be0 00259be0 00000010  0 WA
    0   0  8

On Thu, 07 Aug 2008 16:55:23 +0200, Ulrich Drepper wrote:
This looks like a linker bug.  The .ctors section has to be on a 
separate page (given the page size assumed for the binary, which is 2M)
because it is the first writable section.  But this doesn't mean that
the same offset has to be used in the binary itself.  In fact, what
should happen is exactly what you see in the other file, namely, the the
address and file offset differ in the resulting file.

.eh_frame ends at 0x59bd4 but .ctors starts at 0x259bd0.  This makes the runtime
mapping overlap and a whole MAXPAGE (2MB) range gets inserted into the file.

It is because lang_size_sections() condition
              if (expld.dataseg.base - (1 << max_alignment_power)
                  < old_min_base)
                expld.dataseg.base += expld.dataseg.pagesize;
does not work as OLD_MIN_BASE is there 0x200000 and for example (0x259bec - 32)
can never get under it.  Fixed OLD_MIN_BASE in the attached patch to ensure a
positive gap size for the runtime.

           Summary: Linker sometimes produces 2MB section gap
           Product: binutils
           Version: 2.19 (HEAD)
            Status: NEW
          Severity: minor
          Priority: P3
         Component: ld
        AssignedTo: jan dot kratochvil at redhat dot com
        ReportedBy: jan dot kratochvil at redhat dot com
                CC: bug-binutils at gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]