From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHfAQ-0000je-0F for qemu-devel@nongnu.org; Thu, 05 Sep 2013 15:24:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHfAH-0003OU-Ii for qemu-devel@nongnu.org; Thu, 05 Sep 2013 15:24:33 -0400 Received: from mail-qa0-x234.google.com ([2607:f8b0:400d:c00::234]:54825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHfAH-0003OM-E8 for qemu-devel@nongnu.org; Thu, 05 Sep 2013 15:24:25 -0400 Received: by mail-qa0-f52.google.com with SMTP id ii20so1149552qab.18 for ; Thu, 05 Sep 2013 12:24:25 -0700 (PDT) Sender: Richard Henderson Message-ID: <5228DA64.2020009@twiddle.net> Date: Thu, 05 Sep 2013 12:24:20 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1378376448-29036-1-git-send-email-famz@redhat.com> <1378376448-29036-5-git-send-email-famz@redhat.com> In-Reply-To: <1378376448-29036-5-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 4/6] Makefile: introduce common-obj-m and block-obj-m for DSO List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: pbonzini@redhat.com, mjt@tls.msk.ru, qemu-devel@nongnu.org, stefanha@redhat.com On 09/05/2013 03:20 AM, Fam Zheng wrote: > 1) %.o in $(common-obj-m) is compiled to %.o, with > "QEMU_CFLAGS += -shared -fPIC". Then "linked" to %.mo, which is an > incremental object with "ln -r". This step is for consistency with > %.mod case and has no effect. As a general rule, you should avoid ld -r unless you know exactly what that implies for the given machine. This is the sort of thing that's highly likely to work on x86 while failing elsewhere. E.g. ARM and PPC ld would like to add trampolines for direct calls to reach the PLT entry. If you create one object that's too large then that's no longer possible. E.g. MIPS and Alpha ld require that any one input object file reference less than 64K worth of got entries. Every separate object file can address its own 64K segment of the got. If you combine too many objectsyou could overflow the got subsegments. If our modules are small enough, we may never see any of these, but... If you really require a single input file to ld for pattern matching purposes, I highly recommend an ar file, and then use --whole-archive to force the entire contents of the .a to be included. This preserves the original translation-unit boundaries for ld. r~