From patchwork Mon Apr 1 22:21:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "George G. Davis" X-Patchwork-Id: 2373221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id E80F93FDDA for ; Mon, 1 Apr 2013 22:30:20 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UMnCQ-00072b-VZ; Mon, 01 Apr 2013 22:27:34 +0000 Received: from mail-ob0-x22a.google.com ([2607:f8b0:4003:c01::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UMn6v-0003Tr-EQ for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2013 22:21:56 +0000 Received: by mail-ob0-f170.google.com with SMTP id wc20so2313138obb.29 for ; Mon, 01 Apr 2013 15:21:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=TZd/Hr3L2FGwBwTuJy5n8+7BhpRLAPNu0MGI2w49vWw=; b=D2gbZZkZALPuD+5M0KieZABVPb9NrLRluCjF5euhspXYFe3zE7yNR2bm57Dq007oZJ pvykZXctlQatv/JEjcblqO4OAHwM8z77ArrigF52stNI3vozUOZgEv6R8P5oMRsfc0H+ 32DOkvzrllBn6TD5oqokRV7vzX8zmxIsCllCj8E+S1sVNXZOY9+f57LJb5dmtDSBc/DC KCg6BEvW3YZR4sdMHmoiSXM8g6xFRAMzoDdVxlP4SfMeVMcrMrn6vcP3MR43JB00bRaP niAj9t6oQJlloIA1LZzPxhc/993WEqx5ZRf76RJrjn9nJzBrQGQK+TR3ytSxu7QMd1Ao O5ow== MIME-Version: 1.0 X-Received: by 10.182.107.66 with SMTP id ha2mr4816602obb.43.1364854911901; Mon, 01 Apr 2013 15:21:51 -0700 (PDT) Received: by 10.60.5.163 with HTTP; Mon, 1 Apr 2013 15:21:51 -0700 (PDT) In-Reply-To: <20130401215834.GA5972@merkur.ravnborg.org> References: <1338230018-31052-1-git-send-email-vincent.sanders@collabora.co.uk> <1338230018-31052-2-git-send-email-vincent.sanders@collabora.co.uk> <20120528203005.GA20560@merkur.ravnborg.org> <20120529090614.GD12217@n2100.arm.linux.org.uk> <20120606101253.GM8262@n2100.arm.linux.org.uk> <87F2CC87-0FAF-49CB-AE70-423FB063A0E5@mvista.com> <20130401215834.GA5972@merkur.ravnborg.org> Date: Mon, 1 Apr 2013 18:21:51 -0400 Message-ID: Subject: Re: [PATCH 1/2] Allow constructor name selection by architecture. From: "George G. Davis" To: Sam Ravnborg X-Gm-Message-State: ALoCoQlcEc6NYw7tFXTJPdujKLy48/E9CGlM/5nqV26wLetpHwI050NTkrr1EpboazOiNOdw7GOG X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130401_182153_607563_6C2F01C4 X-CRM114-Status: GOOD ( 23.32 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Russell King - ARM Linux , Vincent Sanders , Arnd Bergmann , linux-kernel@vger.kernel.org, Vincent Sanders , Andrew Morton , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Mon, Apr 1, 2013 at 5:58 PM, Sam Ravnborg wrote: > On Mon, Apr 01, 2013 at 05:47:38PM -0400, George G. Davis wrote: >> On Jun 6, 2012, at 6:12 AM, Russell King - ARM Linux wrote: >> > On Tue, May 29, 2012 at 10:06:14AM +0100, Russell King - ARM Linux wrote: >> >> On Mon, May 28, 2012 at 10:30:05PM +0200, Sam Ravnborg wrote: >> >>> On Mon, May 28, 2012 at 07:33:37PM +0100, Vincent Sanders wrote: >> >>>> From: Vincent Sanders >> >>>> >> >>>> The constructor symbol name is different between platforms. Allow this >> >>>> to be selected by configuration and set suitable default values. >> >>>> >> >>>> Signed-off-by: Vincent Sanders >> >>>> --- >> >>>> include/asm-generic/vmlinux.lds.h | 6 +++--- >> >>>> init/Kconfig | 6 ++++++ >> >>>> kernel/module.c | 2 +- >> >>>> 3 files changed, 10 insertions(+), 4 deletions(-) >> >>>> >> >>>> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h >> >>>> index 8aeadf6..fd34808 100644 >> >>>> --- a/include/asm-generic/vmlinux.lds.h >> >>>> +++ b/include/asm-generic/vmlinux.lds.h >> >>>> @@ -471,9 +471,9 @@ >> >>>> } >> >>>> >> >>>> #ifdef CONFIG_CONSTRUCTORS >> >>>> -#define KERNEL_CTORS() . = ALIGN(8); \ >> >>>> - VMLINUX_SYMBOL(__ctors_start) = .; \ >> >>>> - *(.ctors) \ >> >>>> +#define KERNEL_CTORS() . = ALIGN(8); \ >> >>>> + VMLINUX_SYMBOL(__ctors_start) = .; \ >> >>>> + *(CONFIG_CONSTRUCTORS_NAME) \ >> >>>> VMLINUX_SYMBOL(__ctors_end) = .; >> >>> >> >>> What is wrong with adding both "standard" names for ctors uncnditionally? >> >>> Like this: >> >>>> *(.ctors) \ >> >>>> + *(.init_array) \ >> >> >> >> That doesn't get rid of CONFIG_CONSTRUCTORS_NAME, because it's needed >> >> in the module code. Do you have a suggestion to solve that as well? >> > >> > Ping. >> >> Pinging this back to life. I'd like to see GCOV for ARM eABI finally make it upstream. >> So, any objections to this? Should it be resubmitted? > > Why is CONFIG_CONSTRUCTORS_NAME needed in module code? Because ARM eABI uses the .init_array section for C++ constructors, rather than .ctors. So the patch defined CONFIG_CONSTRUCTORS_NAME to set the correct section name for ARM eABI while leaving non-ARM-eABI as before, .ctors. Here are the changes from the patch for reference: W/o the above, GCOV does not work on ARM eABI for kernel modules. Meanwhile, it still works as before for non-ARM-eABI kernel modules. Thanks! Acked-by: Sam Ravnborg --- Regards, George diff --git a/init/Kconfig b/init/Kconfig index 6cfd71d..52181a1 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -20,6 +20,12 @@ config CONSTRUCTORS bool depends on !UML +config CONSTRUCTORS_NAME + string + depends on CONSTRUCTORS + default ".init_array" if ARM && AEABI + default ".ctors" + config HAVE_IRQ_WORK bool diff --git a/kernel/module.c b/kernel/module.c index 78ac6ec..e5fad5e 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2600,7 +2600,7 @@ static void find_module_sections(struct module *mod, struct load_info *info) mod->unused_gpl_crcs = section_addr(info, "__kcrctab_unused_gpl"); #endif #ifdef CONFIG_CONSTRUCTORS - mod->ctors = section_objs(info, ".ctors", + mod->ctors = section_objs(info, CONFIG_CONSTRUCTORS_NAME, sizeof(*mod->ctors), &mod->num_ctors); #endif