All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <vda.linux@googlemail.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] build system: section garbage collection for vmlinux
Date: Tue, 11 Sep 2007 21:10:14 +0100	[thread overview]
Message-ID: <200709112110.14270.vda.linux@googlemail.com> (raw)
In-Reply-To: <200709112107.53155.vda.linux@googlemail.com>

[-- Attachment #1: Type: text/plain, Size: 264 bytes --]

This patch fixes x86_64 vdso image so that it builds with --gc-sections.

Then it fixes comment in arch/i386/kernel/vmlinux.lds.S
and adds comments to other linker scripts about .bss.

Please apply.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
--
vda

[-- Attachment #2: linux-2.6.23-rc4.2.lds.patch --]
[-- Type: text/x-diff, Size: 3738 bytes --]

--- linux-2.6.23-rc4.gc1/arch/x86_64/vdso/vdso.lds.S	Sat Sep  8 22:06:52 2007
+++ linux-2.6.23-rc4.gc2/arch/x86_64/vdso/vdso.lds.S	Sat Sep  8 22:07:05 2007
@@ -26,11 +26,11 @@
      is insufficient, ld -shared will barf.  Just increase it here.  */
   . = VDSO_PRELINK + VDSO_TEXT_OFFSET;
 
-  .text           : { *(.text) }		:text
+  .text           : { *(.text) *(.text.*) }	:text
   .ptr.text       : { *(.ptr.text) }		:text
   . = VDSO_PRELINK + 0x900;
-  .data           : { *(.data) }		:text
-  .bss            : { *(.bss) }			:text
+  .data           : { *(.data) *(.data.*) }	:text
+  .bss            : { *(.bss) *(.bss.*) }	:text
 
   .altinstructions : { *(.altinstructions) }			:text
   .altinstr_replacement  : { *(.altinstr_replacement) }	:text
diff -urpN linux-2.6.23-rc4.gc1/arch/i386/kernel/vmlinux.lds.S linux-2.6.23-rc4.gc2/arch/i386/kernel/vmlinux.lds.S
--- linux-2.6.23-rc4.gc1/arch/i386/kernel/vmlinux.lds.S	2007-09-10 18:54:38.000000000 +0100
+++ linux-2.6.23-rc4.gc2/arch/i386/kernel/vmlinux.lds.S	2007-09-10 19:09:24.000000000 +0100
@@ -2,17 +2,10 @@
  * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
  *
  * Don't define absolute symbols until and unless you know that symbol
- * value is should remain constant even if kernel image is relocated
+ * value should remain constant even if kernel image is relocated
  * at run time. Absolute symbols are not relocated. If symbol value should
- * change if kernel is relocated, make the symbol section relative and
- * put it inside the section definition.
- */
-
-/* Don't define absolute symbols until and unless you know that symbol
- * value is should remain constant even if kernel image is relocated
- * at run time. Absolute symbols are not relocated. If symbol value should
- * change if kernel is relocated, make the symbol section relative and
- * put it inside the section definition.
+ * change if kernel is relocated, make the symbol section relative
+ * by putting it inside the section definition.
  */
 #define LOAD_OFFSET __PAGE_OFFSET
 
@@ -192,6 +185,9 @@ SECTIONS
   .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
 	__init_end = .;
 	__bss_start = .;		/* BSS */
+        /* We must use .bss.xxx section names for zero-initialized sections
+         * we want to combine into bss, otherwise gcc does not set
+         * 'nobits' flag for the section, and it cannot be merged into bss. */
 	*(.bss.k.page_aligned)
 	*(.bss)
 	. = ALIGN(4);
diff -urpN linux-2.6.23-rc4.gc1/arch/sh/kernel/vmlinux.lds.S linux-2.6.23-rc4.gc2/arch/sh/kernel/vmlinux.lds.S
--- linux-2.6.23-rc4.gc1/arch/sh/kernel/vmlinux.lds.S	2007-09-10 18:54:38.000000000 +0100
+++ linux-2.6.23-rc4.gc2/arch/sh/kernel/vmlinux.lds.S	2007-09-10 19:09:24.000000000 +0100
@@ -104,6 +104,9 @@ SECTIONS
   .bss : {
 	__init_end = .;
 	__bss_start = .;		/* BSS */
+        /* We must use .bss.xxx section names for zero-initialized sections
+         * we want to combine into bss, otherwise gcc does not set
+         * 'nobits' flag for the section, and it cannot be merged into bss. */
   	*(.bss.k.page_aligned)
   	*(.bss)
 	. = ALIGN(4);
diff -urpN linux-2.6.23-rc4.gc1/arch/xtensa/kernel/vmlinux.lds.S linux-2.6.23-rc4.gc2/arch/xtensa/kernel/vmlinux.lds.S
--- linux-2.6.23-rc4.gc1/arch/xtensa/kernel/vmlinux.lds.S	2007-09-10 18:54:38.000000000 +0100
+++ linux-2.6.23-rc4.gc2/arch/xtensa/kernel/vmlinux.lds.S	2007-09-10 19:09:24.000000000 +0100
@@ -255,6 +255,9 @@ SECTIONS
 
   /* BSS section */
   _bss_start = .;
+  /* We must use .bss.xxx section names for zero-initialized sections
+   * we want to combine into bss, otherwise gcc does not set
+   * 'nobits' flag for the section, and it cannot be merged into bss. */
   .bss : { *(.bss.k.page_aligned) *(.bss) }
   _bss_end = .;
 

  reply	other threads:[~2007-09-11 20:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-11 20:05 [PATCH 0/4] build system: section garbage collection for vmlinux Denys Vlasenko
2007-09-11 20:07 ` [PATCH 1/4] " Denys Vlasenko
2007-09-11 20:10   ` Denys Vlasenko [this message]
2007-09-11 20:11     ` [PATCH 3/4] " Denys Vlasenko
2007-09-11 20:22       ` [PATCH 4/4] " Denys Vlasenko
2007-09-11 21:47   ` [PATCH 1/4] " Daniel Walker
2007-09-12 20:18     ` Denys Vlasenko
2007-09-12 20:52       ` Daniel Walker
2007-09-11 21:03 ` [PATCH 0/4] " Andi Kleen
2007-09-12 20:19   ` Denys Vlasenko
2007-09-13 18:26 ` Abhishek Sagar
2007-09-13 18:35   ` Sam Ravnborg
2007-09-14 18:06     ` Abhishek Sagar
     [not found] ` <20071118230057.GA6303@uranus.ravnborg.org>
2007-11-24 23:14   ` [PATCH 0/3] build system: section garbage collection Denys Vlasenko
2007-11-24 23:17     ` [PATCH 1/3] build system: section garbage collection - rename sections Denys Vlasenko
2008-06-24  7:29       ` Matthieu CASTET
2007-11-24 23:17     ` [PATCH 2/3] build system: section garbage collection - modpost fix Denys Vlasenko
2007-11-24 23:18     ` [PATCH 3/3] build system: section garbage collection - main part Denys Vlasenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200709112110.14270.vda.linux@googlemail.com \
    --to=vda.linux@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.