[Top][All Lists]

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

[Bug ld/14156] New: --sort-section=alignment trashes init/fini sections,

From: bugdal at aerifal dot cx
Subject: [Bug ld/14156] New: --sort-section=alignment trashes init/fini sections, and anything similar
Date: Thu, 24 May 2012 00:21:30 +0000


             Bug #: 14156
           Summary: --sort-section=alignment trashes init/fini sections,
                    and anything similar
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden
    Classification: Unclassified

This bug came up from a user of musl libc (my project) building busybox (which
has --sort-section=alignment in its makefile) on arm. He was experiencing
crashes in busybox and nothing else, and upon examining the binary, found that
the _init label (from crti.o) was getting reordered *after* the return code
(from crtn.o), causing the call to _init to run off into other unrelated code.
The problem has not been observed on any other systems (non-arm) with musl, nor
with other libc implementations, but as far as I can tell,
--sort-section=alignment is only working BY CHANCE on these systems due to the
section sizes/alignments happening to keep the parts in the right order.

I'm not sure what the right fix for this is, but I think the linker scripts
should do something to ensure that sections which are pieced-together in a
particular link order (init/fini and probably also ctors/dtors, and perhaps
others) never get reordered. If that's not possible, then this option should be
documented as dangerous/broken so that projects don't put it in their

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.

reply via email to

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