Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 23 Apr 2014 10:47:52 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: musl-llvm and crtbegin/crtend

On Wed, Apr 23, 2014 at 04:47:55AM -0400, writeonce@...ipix.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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.