From patchwork Wed Jul 28 23:47:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denys Vlasenko X-Patchwork-Id: 114969 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6SNnJwi008312 for ; Wed, 28 Jul 2010 23:49:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755801Ab0G1XtC (ORCPT ); Wed, 28 Jul 2010 19:49:02 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:33096 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752508Ab0G1XsR (ORCPT ); Wed, 28 Jul 2010 19:48:17 -0400 Received: by mail-fx0-f46.google.com with SMTP id 14so1531444fxm.19 for ; Wed, 28 Jul 2010 16:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=4xixXnlkkziBsIca87Ka7NA4IUaDVPPccKrbrFI/Hqo=; b=XAtE4wlIumGZA/1+PZrlkVgHKOW3t6x7NENAE2xRA0zvuROSePdw17qZWM0LPMmxNw VUPlt1KYr4VwBI/0zvsZDB3ZSAxSHMxDFlG6IOSkiesziMQawPavxuzJ3h7pLBF1w/7X OtKeuBjicDI5/zOGkLbBxMHaavX+vBj3CAYss= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=iS0s8917TVLBBIOinlFXnQdLZA6zc7onc2TgpNJcvu4M56ruHTtYRTkYvZS25886uh d/lBijZAYeBXKLs849J728I0ujhx0JnUbvdJsoSNyCk2PMBDXw37z0D1ct2+W7aMD78v soun2N+recsj5RlGq5YlUYxn4CwibJlO70TY8= Received: by 10.223.122.145 with SMTP id l17mr10794055far.81.1280360896356; Wed, 28 Jul 2010 16:48:16 -0700 (PDT) Received: from localhost.localdomain (221.47.broadband5.iol.cz [88.100.47.221]) by mx.google.com with ESMTPS id a9sm54590faa.3.2010.07.28.16.48.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 28 Jul 2010 16:48:15 -0700 (PDT) From: Denys Vlasenko To: Michal Marek , linux-kbuild , linux-arch@vger.kernel.org, Parisc List Cc: lkml , Sam Ravnborg , Tim Abbott , Tim Bird , James Bottomley , Matt Fleming , Arnd Bergmann , Anders Kaseorg , Andi Kleen , Stephen Rothwell , Denys Vlasenko Subject: [PATCH 2/4] module linker script: coalesce function and data sections Date: Thu, 29 Jul 2010 01:47:54 +0200 Message-Id: <1280360876-2571-3-git-send-email-vda.linux@googlemail.com> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1280360876-2571-1-git-send-email-vda.linux@googlemail.com> References: <1280360876-2571-1-git-send-email-vda.linux@googlemail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 28 Jul 2010 23:49:20 +0000 (UTC) diff --git a/scripts/module-common.lds b/scripts/module-common.lds index 47a1f9a..4a197e8 100644 --- a/scripts/module-common.lds +++ b/scripts/module-common.lds @@ -3,6 +3,29 @@ * Archs are free to supply their own linker scripts. ld will * combine them automatically. */ + +/* .data.foo are generated by gcc itself with -fdata-sections, + * whereas double-dot sections (like .data..percpu) are generated + * by kernel's magic macros. + * + * Since this script does not specify what to do with double-dot sections, + * ld -r will coalesce all .data..foo input sections into one .data..foo + * output section, all .data..bar input sections into one .data..bar + * output section and so on. This is exactly what we want. + * + * Same goes for .text, .bss and .rodata. In case of .rodata, various + * .rodata.foo sections are generated by gcc even without -fdata-sections + */ + SECTIONS { + + /* Coalesce sections produced by gcc -ffunction-sections */ + .text 0 : AT(0) { *(.text .text.[A-Za-z0-9_$^]*) } + + /* Coalesce sections produced by gcc -fdata-sections */ + .rodata 0 : AT(0) { *(.rodata .rodata.[A-Za-z0-9_$^]*) } + .data 0 : AT(0) { *(.data .data.[A-Za-z0-9_$^]*) } + .bss 0 : AT(0) { *(.bss .bss.[A-Za-z0-9_$^]*) } + /DISCARD/ : { *(.discard) } }