From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 11 01:08:16 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 59673B67 for ; Mon, 11 Mar 2013 01:08:16 +0000 (UTC) (envelope-from ilya.kaliman@gmail.com) Received: from mail-la0-x22e.google.com (mail-la0-x22e.google.com [IPv6:2a00:1450:4010:c03::22e]) by mx1.freebsd.org (Postfix) with ESMTP id CF2B1A91 for ; Mon, 11 Mar 2013 01:08:15 +0000 (UTC) Received: by mail-la0-f46.google.com with SMTP id fq12so3287101lab.5 for ; Sun, 10 Mar 2013 18:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=DBpREcCNEoB4ddEMfKH9cbDURFQBNsQfBJ91TKHDNlg=; b=Ux96hEfcqweC72zit0RYE0QzHH60OlnP8KMc32JmxzpRJlzObNGfpbjGnVOft3Shgt Rimlg+EKwFoeil4RJgSOArRW737nLh63DRYiqLHPMhj32qWS0j4YkuuLEwX0Z2BwEkSE SAdCY6V51ARblVChPJVviEv/rUwwt6I4I4usK2gnaKB2RHuOfZpgVTYy+COVAtwmzUiQ Ah4jX8iAoTRdplvVfwPlI1KwlegQRNc+zYT7qepTRECuQsk8ys+YXOmSvJZYQjh37mnb 7ZGFlLAGRRIlNrg81tF4YIEsO+ZH/xvqhs/gKoLEAL4sRRS8dAKTAkGE0iMPgw+VNV/w rLvw== MIME-Version: 1.0 X-Received: by 10.152.122.100 with SMTP id lr4mr8595586lab.28.1362963602496; Sun, 10 Mar 2013 18:00:02 -0700 (PDT) Received: by 10.114.19.105 with HTTP; Sun, 10 Mar 2013 18:00:02 -0700 (PDT) Date: Sun, 10 Mar 2013 21:00:02 -0400 Message-ID: Subject: Linking produces unusable executable From: Ilya Kaliman To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 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 01:08:16 -0000 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? Thanks, Ilya.