From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30241 invoked by alias); 17 Apr 2012 20:25:42 -0000 Received: (qmail 30227 invoked by uid 22791); 17 Apr 2012 20:25:41 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Apr 2012 20:24:54 +0000 From: "ccoutant at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/46770] Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them Date: Tue, 17 Apr 2012 20:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ccoutant at google dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: hjl.tools at gmail dot com X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg01440.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770 --- Comment #83 from ccoutant at google dot com 2012-04-17 20:10:07 UTC --- >> Didn't I just do that? > > Let me ask it again: > > The proposed --reverse-init-array switch will only reverse the order across > translation units, while keeping the same order within translation unit. > Is this correct? Maybe I'm misunderstanding the question. As I said before: If you have translation unit A with .ctors entries A1 and A2, and translation unit B with .ctors entries B1 and B2, we'll build a .init_array section with: B1 B2 A1 A2 Expanding on that, we will reverse the order of the individual input sections relative to one another, but we will not modify the contents of any input section at all. Everything I said for .ctors sections goes for .init_array sections, since we just map .ctors -> .init_array on the way in, and treat them as if they were .init_array sections from the beginning. Paul suggested to me offline that maybe you're asking about translation units with several .ctors or .init_array sections. Since that doesn't happen in practice, I don't really care so much, and would prefer to do the easy thing of just reversing the order of all input sections, even to the point of reversing the order of the sections within a translation unit. I think the important point is that we do not reverse the order of entries within a single input section. -cary