From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 11 16:12:42 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 76BBB6B7 for ; Mon, 11 Mar 2013 16:12:42 +0000 (UTC) (envelope-from ilya.kaliman@gmail.com) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com [IPv6:2a00:1450:4010:c03::22d]) by mx1.freebsd.org (Postfix) with ESMTP id 06455D22 for ; Mon, 11 Mar 2013 16:12:41 +0000 (UTC) Received: by mail-la0-f45.google.com with SMTP id er20so4068265lab.4 for ; Mon, 11 Mar 2013 09:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=nmRmrHG6DHmt8JS38kDGdy4p8aZfRAusATNGKCRIUGw=; b=HK2Fa5wOEmKU+TOoRolLEmQSGytkkC8qnF6nldgzq+FSM6DKWrFZsgvySdsSu3bDW5 JY73+z7u5e7srMu4Evc0MvUg0TtLoMR7QOL/pAsZZjjATookC1DQ+AnymwuGx9IUOHDO 41J7NkvEilOv9wKohcIl9WiTp1RSaLPTOTvO/DJmA/i4hDLzzrD7nfJYlh6xFoDkY8dw CtTDpB1qZburLKvTse0Ce2N0O5GAGPWpaBqpy1JG6Osdw7VpCwn8nWsS3FcXIIUuh1PB 5o/bwQGx5QQcpQ/BDJkTB4HdPjcAN1YlZ7dYM56lB1Brf/TXGTn0i4Pdz7b112MVpZY4 nFyw== MIME-Version: 1.0 X-Received: by 10.152.109.208 with SMTP id hu16mr10796035lab.45.1363018360759; Mon, 11 Mar 2013 09:12:40 -0700 (PDT) Received: by 10.114.19.105 with HTTP; Mon, 11 Mar 2013 09:12:40 -0700 (PDT) In-Reply-To: <20130311055822.GK3794@kib.kiev.ua> References: <20130311055822.GK3794@kib.kiev.ua> Date: Mon, 11 Mar 2013 12:12:40 -0400 Message-ID: Subject: Re: Linking produces unusable executable From: Ilya Kaliman To: Konstantin Belousov Content-Type: text/plain; charset=ISO-8859-1 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 16:12:42 -0000 Thanks a lot for the help! Increasing kern.maxtsiz solved the problem. Best, Ilya. On Mon, Mar 11, 2013 at 1:58 AM, Konstantin Belousov wrote: > On Sun, Mar 10, 2013 at 09:00:02PM -0400, Ilya Kaliman wrote: >> Hello, hackers! >> >> I have a strange problem with a big executable. I have a piece of scientific >> software and some C++ module in it with a LOT of template code. When compiled >> this module produces 450 MB archive file (w/o debugging symbols). Now, when I >> compile the program without this module everything works perfect. With this >> 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. >> >> I watched the memory consumption during linking and it doesn't seem to exhaust >> 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. >> >> I've tried it on 9.1 and 10-CURRENT with both gcc/g++/ld from the base system >> and from ports (gcc 4.7.3, binutils 2.23.1) and with clang. >> >> I've tried to build some of the bigger ports like chromium (just in case): >> all works fine. >> >> Everything works on linux though (with the same gcc/ld). With debugging symbols >> the exe is around 1GB, without them its around 200MB. Works fine in every case >> with different optimization levels. >> >> 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.