From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8723 invoked by alias); 21 Jul 2011 00:10:21 -0000 Received: (qmail 8700 invoked by uid 22791); 21 Jul 2011 00:10:16 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-vw0-f47.google.com (HELO mail-vw0-f47.google.com) (209.85.212.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jul 2011 00:10:01 +0000 Received: by vws2 with SMTP id 2so667480vws.20 for ; Wed, 20 Jul 2011 17:10:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.25.199 with SMTP id e7mr9524857vdg.363.1311207000476; Wed, 20 Jul 2011 17:10:00 -0700 (PDT) Received: by 10.52.106.193 with HTTP; Wed, 20 Jul 2011 17:10:00 -0700 (PDT) In-Reply-To: References: <4E26E775.7070802@moene.org> Date: Thu, 21 Jul 2011 06:57:00 -0000 Message-ID: Subject: Re: PATCH RFA: Build stages 2 and 3 with C++ From: David Edelsohn To: Mike Stump Cc: Ian Lance Taylor , gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg00399.txt.bz2 On Wed, Jul 20, 2011 at 4:53 PM, Mike Stump wrote: > On Jul 20, 2011, at 1:25 PM, Ian Lance Taylor wrote: >> Interesting. =A0I don't know why this doesn't happen on GNU/Linux. > > It doesn't happen as the symbols in question are local on linux. =A0colle= ct2 runs nm on public symbols looking for symbols of a particular form, it = then builds two lists, one for constructors of global objects (simplistic v= iew) and one for destructors. =A0a.out systems liked doing this sort of thi= ngs as well. =A0On more modern OSes, the constructors and destructors hook = into crt code that can run per translation unit initializations, for exampl= e on elf, one might use .init to achieve this. =A0When one uses one of thes= e more advanced features to hook into the OS, then the symbols no longer ne= ed to be public and the port is changed to make them non-public. This is not the global constructor/destructor issue with names generated by collect2. But ELF or SVR4 is able to provide a unique name without resorting to random numbers. - David