From owner-freebsd-mips@freebsd.org Mon Nov 21 11:18:28 2016 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31F57C4C660 for ; Mon, 21 Nov 2016 11:18:28 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C416182E for ; Mon, 21 Nov 2016 11:18:27 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221]) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id uALBIGT6043003 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Nov 2016 12:18:17 +0100 (CET) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: imp@bsdimp.com Received: from eg.sd.rdtc.ru (eugen@localhost [127.0.0.1]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTP id uALBICC3026941; Mon, 21 Nov 2016 18:18:13 +0700 (KRAT) (envelope-from eugen@grosbein.net) Subject: Re: MIPS code size strangeness To: Warner Losh References: <5831E800.60003@grosbein.net> Cc: "freebsd-mips@freebsd.org" From: Eugene Grosbein Message-ID: <5832D7F4.9090206@grosbein.net> Date: Mon, 21 Nov 2016 18:18:12 +0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,LOCAL_FROM autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Nov 2016 11:18:28 -0000 On 21.11.2016 05:18, Warner Losh wrote: > On Sun, Nov 20, 2016 at 11:14 AM, Eugene Grosbein wrote: >> Hi! >> >> I'm currently struggle trying to fit my FreeBSD 12/mips build into 8M flash available. >> It used to fit with early 11.0-CURRENT and it has over megabyte overhead with 12.0-CURRENT. >> >> Large parts are /usr/bin and /usr/lib and I've found something very strange. >> For example: /usr/lib/libprivateucl.so.1 has 136064 bytes for amd64 >> and it has 241560 bytes for mips. >> >> "nm -C -D --print-size --size-sort libprivateucl.so.1" shows the symbol "ucl_hash_replace" >> has 330 bytes (0x14a) for amd64 and it has 25000 bytes (sic! 0x61a8) for mips. >> >> I understand that amd64 version is built with clang and MIPS code generated with gcc. >> But why such large difference? In no way such small function ucl_hash_replace() >> should expand to 25000 machine code bytes. >> >> I suspect other parts of code may have this problem too. > > Keep in mind that FreeBSD uses clang for amd64, which is quite good at > code generation, while we still have to use an ancient version of gcc > for mips, which is known to produce kinda crappy code for mips. To > know for sure, you'll need to look at the code. C code is pretty small and simple. How do I disassemble MIPS machine code? Is it possible to build FreeBSD12/mips with something more modern like gcc6, perhaps?