From patchwork Thu Apr 11 14:11:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Kranz X-Patchwork-Id: 2428841 X-Patchwork-Delegate: deller@gmx.de Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id F1E563FD8C for ; Thu, 11 Apr 2013 14:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755678Ab3DKOJh (ORCPT ); Thu, 11 Apr 2013 10:09:37 -0400 Received: from mail-we0-f170.google.com ([74.125.82.170]:54798 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513Ab3DKOJg (ORCPT ); Thu, 11 Apr 2013 10:09:36 -0400 Received: by mail-we0-f170.google.com with SMTP id z2so1262422wey.15 for ; Thu, 11 Apr 2013 07:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=jPKKwkd3hZxvvMQyvfn2qvDkeGJDn2Wf4PkqoBQ7ORw=; b=VwSEoZNa6Zaixt68xHKJImC6XBDUko1edkysf7brEcaqfsUVPl3i4QhWZjAAAJXO4Z 6zvjX5i2LBfR1UXWGAQymt3AFoHmbrGuvqV6UAw7rAP4pjAeeas31EG1h+HXhYd+9Dl5 +YCgsjxSUAazd7sI5Ps7BZjMWu/LxltUoUe/hn2JSPUuCOZUw2U6GtnOBsjbeKRUl4CC 6Bh/dm/1DT4gnf38f0gFGLdlycJEvrwKcJxgUayE7f+ZYtuJPx4NSmMIHoOTjCJnqQ5m Gf8yM3fc9/gaK1+KYEFgYnwBpOpyiLB3yju8jc6SthBAxpZ2B1UjCJ0IN43UgBotra10 kpyg== X-Received: by 10.180.98.198 with SMTP id ek6mr10715571wib.7.1365689375591; Thu, 11 Apr 2013 07:09:35 -0700 (PDT) Received: from hydra.lan (p5494880C.dip0.t-ipconnect.de. [84.148.136.12]) by mx.google.com with ESMTPS id o5sm3752108wix.3.2013.04.11.07.09.32 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 11 Apr 2013 07:09:34 -0700 (PDT) Received: from [192.168.1.20] (helo=yoda.lan) by hydra.lan with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1UQI5x-0007DS-Ba; Thu, 11 Apr 2013 16:03:21 +0200 Date: Thu, 11 Apr 2013 16:11:55 +0200 From: Philip Kranz To: Rusty Russell Cc: Philip Kranz , James Bottomley , Sebastian Wankerl , linux-kernel@vger.kernel.org, i4passt@lists.informatik.uni-erlangen.de, linux-parisc@vger.kernel.org Subject: Re: [PATCH] Add non-zero module sections to sysfs Message-ID: <20130411141155.GA21480@yoda.lan> References: <1364994499-23708-1-git-send-email-sisewank@cip.cs.fau.de> <87mwtf3ya1.fsf@rustcorp.com.au> <515D4A7F.5070102@cip.cs.fau.de> <87vc81lj7x.fsf@rustcorp.com.au> <1365156435.1970.31.camel@dabdike> <20130406104053.GA24710@yoda.lan> <878v4tbqve.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <878v4tbqve.fsf@rustcorp.com.au> User-Agent: Mutt/1.5.14 (2007-03-31) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On Mon, Apr 08, 2013 at 01:44:45PM +0930, Rusty Russell wrote: > Philip Kranz writes: > > Hello. > > > > On Fri, Apr 05, 2013 at 12:07:15PM +0200, James Bottomley wrote: > >> Just so you know: this isn't a parisc specific problem. Gcc produces > >> duplicate section names under various circumstances, but the one that > >> bites us is -ffunction-sections. Note that there are proposals to use > >> -ffunction-sections on all architectures (so we can garbage collect > >> unused functions) in which case you'll induce the bug identified in > >> 35dead4235e2b67da7275b4122fed37099c2f462 on every architecture > > > > I am not able to produce an object file with duplicate section names > > using gcc on x86. Even with -ffunction-sections, every section gets a > > unique name. Is this architecture-specific behaviour of gcc? > > Good point. ld -r will collapse them into the same section (since gcc > produces them they have to have the same section attributes). > > You can do it with --unique, but no arch uses that. PARISC has a > platform-specific toolchain hack which does that for .text sections. > (Thanks to Alan Modra for that clue...) Just for clarification, as we are currently preparing a patch set that depends on this: Would the patch below be an acceptable solution for this? Thanks, Philip --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c index 2a625fb..1fd4411 100644 --- a/arch/parisc/kernel/module.c +++ b/arch/parisc/kernel/module.c @@ -341,6 +341,11 @@ int module_frob_arch_sections(CONST Elf_Ehdr *hdr, ".PARISC.unwind", 14) == 0) me->arch.unwind_section = i; + /* we produce multiple, empty .text sections, and kallsyms + * gets upset. make non-alloc so it doesn't see them. */ + if (sechdrs[i].sh_size == 0) + sechdrs[i].sh_flags &= ~SHF_ALLOC; + if (sechdrs[i].sh_type != SHT_RELA) continue; diff --git a/kernel/module.c b/kernel/module.c index 3c2c72d..42e0d5a 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1316,7 +1316,7 @@ resolve_symbol_wait(struct module *mod, #ifdef CONFIG_KALLSYMS static inline bool sect_empty(const Elf_Shdr *sect) { - return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0; + return !(sect->sh_flags & SHF_ALLOC); } struct module_sect_attr