From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 11 05:58:27 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 122CEA66 for ; Mon, 11 Mar 2013 05:58:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 9CAE97AA for ; Mon, 11 Mar 2013 05:58:26 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r2B5wMrB049097; Mon, 11 Mar 2013 07:58:22 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.0 kib.kiev.ua r2B5wMrB049097 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r2B5wMW4049096; Mon, 11 Mar 2013 07:58:22 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 11 Mar 2013 07:58:22 +0200 From: Konstantin Belousov To: Ilya Kaliman Subject: Re: Linking produces unusable executable Message-ID: <20130311055822.GK3794@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lKueCj4EYK2W7OYQ" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 05:58:27 -0000 --lKueCj4EYK2W7OYQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 10, 2013 at 09:00:02PM -0400, Ilya Kaliman wrote: > Hello, hackers! >=20 > I have a strange problem with a big executable. I have a piece of scienti= fic > software and some C++ module in it with a LOT of template code. When comp= iled > this module produces 450 MB archive file (w/o debugging symbols). Now, wh= en I > compile the program without this module everything works perfect. With th= is > module turned on the linker produces an executable (around 180 MB in size) > without any errors or warnings. But when I try to start the final program= zsh > just says: abort. ldd on this exe says: ./a.out: signal 6. >=20 > I watched the memory consumption during linking and it doesn't seem to ex= haust > all available memory (the linker seem to stop allocating on around 2 GB).= I've > also tried to enable --no-keep-memory for ld with no luck - linking still > produces no errors but the resulting executable is unusable. >=20 > I've tried it on 9.1 and 10-CURRENT with both gcc/g++/ld from the base sy= stem > and from ports (gcc 4.7.3, binutils 2.23.1) and with clang. >=20 > I've tried to build some of the bigger ports like chromium (just in case): > all works fine. >=20 > Everything works on linux though (with the same gcc/ld). With debugging s= ymbols > the exe is around 1GB, without them its around 200MB. Works fine in every= case > with different optimization levels. >=20 > Any ideas how to solve this? For start, it would be nice to provide some useful information together or even instead of the long story. What is the architecture ? Show at least the output of the size(1) on the final binary. Show exact shell message on the attempt of the binary run. Show the ktrace/kdump of the start attempt. As a guess, look at the sysctl kern.maxtsiz and compare it to the text size reported by the size(1). The same for the initialized data segment and kern.maxdsiz. --lKueCj4EYK2W7OYQ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRPXJ9AAoJEJDCuSvBvK1BqbYP/2g3sQxERXQQ21Sxuvey6lpF 2Cp1KERyXmHyUoPmC9DPXykarsGffS8+z8138/0go2gYr84w1d++WVgdwsT8soAk eXbbxKv76/TlVD5P27GLX0v7m4H1KLQYOrr1bVKS2F7Qt5pfj0k9xLch557nHGnk 5a2w9PN/61WP4Lvjx+8m/hU7Tp/vwzy0Ol91hPgHHVrw/VCGO1sTW3GWaHDcg1Q9 uNs6wiBY97Oes/y563feK5MG+BlKCBsuTNZTb0nGxKlBEYxU3sRDJYfxVAYyyUUC 4svtbLt3iyvvlxC4uWbxuzR/YZWX0mYnwWJVpqRH46d3d0Q8SODV1N0Wcnzq0YJV 7FYywUGTUGFnlFYXnZ7JgJb659VdIoKHkSZ3fc00gLPCSzL9hU5FNKSvCdYrV37j wpm1x5hmg12yTnEEDh4/g1CXTRQsqCEKSSd2CsnttMnInym9WbXNN4h56y5R1sY7 o3LRCY2egB35yWY/TSHsDh3eOEMIRjB9Rc/2AIiAfcOdAJNRgOxwFF0NATC7/QKg /Si5/HyUawKqiRl9SbQyXTlS4AJr8YCp388H+XWZLYR0xfG6aQ5X1CnWLEKZoing v8FstUkXjfWhCtF7qixrA1TTXfizc3kOozDbcOa1ZnT52zQwzNzRVxT3i6GyCIGV JLML4A17D2vID2yxRkPK =Sxze -----END PGP SIGNATURE----- --lKueCj4EYK2W7OYQ--