From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4949 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: musl-llvm and crtbegin/crtend Date: Wed, 23 Apr 2014 10:47:52 -0400 Message-ID: <20140423144752.GN26358@brightrain.aerifal.cx> References: <5356E4CA.7060907@midipix.org> <20140422223811.GM26358@brightrain.aerifal.cx> <53577E3B.9080902@midipix.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1398265391 21556 80.91.229.3 (23 Apr 2014 15:03:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Apr 2014 15:03:11 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4953-gllmg-musl=m.gmane.org@lists.openwall.com Wed Apr 23 17:03:04 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WcyhT-0001YC-P6 for gllmg-musl@plane.gmane.org; Wed, 23 Apr 2014 17:03:03 +0200 Original-Received: (qmail 12004 invoked by uid 550); 23 Apr 2014 15:03:00 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11990 invoked from network); 23 Apr 2014 15:03:00 -0000 Content-Disposition: inline In-Reply-To: <53577E3B.9080902@midipix.org> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:4949 Archived-At: On Wed, Apr 23, 2014 at 04:47:55AM -0400, writeonce@midipix.org wrote: > Thanks, Rich. From the sources of gcc (4.6 -- 4.8) and llvm/clang > (3.4 -- trunk) it appears that gcc introduced __init_array in > version 4.7; when used, __do_global_ctors_aux is absent, however > the implementation of __do_global_dtors_aux is still there (in > crtbegin.o). > > When clang invokes the linker, it asks for crtbegin.o and crtend.o > to be included regardless of the executable type (c/c++), which > might be worth a patch (clang/lib/Driver/Tools.cpp). On the other > hand, it does support __init_array (by default, I believe, and also > through -fuse-init-array), and there are also relevant bits in the > code for llvm's native linker (lld). > > Given that clang also supports the old ctor/dtor system (through > -fno-use-init-array), the status of crtbegin/crtend seems to be > still relevant. My point was just that if you're using exclusively new .o files built with init-array, I think it's possible to compile without crtbegin.o and crtend.o (or equivalently, with empty .o files dropped in their place). Rich