Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2013 07:58:22 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Ilya Kaliman <ilya.kaliman@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Linking produces unusable executable
Message-ID:  <20130311055822.GK3794@kib.kiev.ua>
In-Reply-To: <CA%2BSmX2BCY=ySp-1aXHRHWa2LbCb31vBGvu4ivwyzAi2M4S_ujQ@mail.gmail.com>
References:  <CA%2BSmX2BCY=ySp-1aXHRHWa2LbCb31vBGvu4ivwyzAi2M4S_ujQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130311055822.GK3794>