* [PATCH 1/4] Add .bss.{init,exit} sections
2007-10-18 21:12 [RFC] Add .bss.{init,exit} sections [take #2] Franck Bui-Huu
@ 2007-10-18 21:12 ` Franck Bui-Huu
2007-10-18 21:12 ` [PATCH 2/4] Add .init.bss section for MIPS Franck Bui-Huu
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Franck Bui-Huu @ 2007-10-18 21:12 UTC (permalink / raw)
To: linux-mips; +Cc: ralf, macro
This patch creates a new init section called .bss.init.
This section is similar to .init.data but doesn't consume
any space in the vmlinux image.
All data marked as part of this section must not be initialized,
of course.
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
include/linux/init.h | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index 74b1f43..0febf3e 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -43,6 +43,8 @@
#define __init __attribute__ ((__section__ (".init.text"))) __cold
#define __initdata __attribute__ ((__section__ (".init.data")))
#define __exitdata __attribute__ ((__section__(".exit.data")))
+#define __initbss __attribute__ ((__section__ (".bss.init")))
+#define __exitbss __attribute__ ((__section__ (".bss.exit")))
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
/* modpost check for section mismatches during the kernel build.
@@ -68,6 +70,7 @@
#define __INIT .section ".init.text","ax"
#define __FINIT .previous
#define __INITDATA .section ".init.data","aw"
+#define __INITBSS .section ".bss.init","aw",@nobits
#ifndef __ASSEMBLY__
/*
@@ -257,10 +260,12 @@ void __init parse_early_param(void);
#define __devexit
#define __devexitdata
#else
-#define __devinit __init
-#define __devinitdata __initdata
-#define __devexit __exit
-#define __devexitdata __exitdata
+#define __devinit __init
+#define __devinitdata __initdata
+#define __devinitbss __initbss
+#define __devexit __exit
+#define __devexitdata __exitdata
+#define __devexitbss __exitbss
#endif
#ifdef CONFIG_HOTPLUG_CPU
@@ -270,9 +275,11 @@ void __init parse_early_param(void);
#define __cpuexitdata
#else
#define __cpuinit __init
-#define __cpuinitdata __initdata
-#define __cpuexit __exit
+#define __cpuinitdata __initdata
+#define __cpuinitbss __initbss
+#define __cpuexit __exit
#define __cpuexitdata __exitdata
+#define __cpuexitbss __exitbss
#endif
#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
@@ -283,9 +290,11 @@ void __init parse_early_param(void);
#define __memexitdata
#else
#define __meminit __init
-#define __meminitdata __initdata
-#define __memexit __exit
+#define __meminitdata __initdata
+#define __meminitbss __meminitbss
+#define __memexit __exit
#define __memexitdata __exitdata
+#define __memexitbss __exitbss
#endif
/* Functions marked as __devexit may be discarded at kernel link time, depending
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] Add .init.bss section for MIPS
2007-10-18 21:12 [RFC] Add .bss.{init,exit} sections [take #2] Franck Bui-Huu
2007-10-18 21:12 ` [PATCH 1/4] Add .bss.{init,exit} sections Franck Bui-Huu
@ 2007-10-18 21:12 ` Franck Bui-Huu
2007-10-18 21:12 ` [PATCH 3/4] vmlinux.ld.S: correctly indent .data section Franck Bui-Huu
2007-10-18 21:12 ` [PATCH 4/4] Use __bzero to clear .bss Franck Bui-Huu
3 siblings, 0 replies; 7+ messages in thread
From: Franck Bui-Huu @ 2007-10-18 21:12 UTC (permalink / raw)
To: linux-mips; +Cc: ralf, macro
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
arch/mips/kernel/vmlinux.lds.S | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 84f9a4c..e0a4dc0 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -100,7 +100,7 @@ SECTIONS
_edata = .; /* End of data section */
/* will be freed after init */
- . = ALIGN(_PAGE_SIZE); /* Init code and data */
+ . = ALIGN(_PAGE_SIZE); /* Init code, data and bss */
__init_begin = .;
.init.text : {
_sinittext = .;
@@ -148,19 +148,27 @@ SECTIONS
}
#endif
PERCPU(_PAGE_SIZE)
- . = ALIGN(_PAGE_SIZE);
- __init_end = .;
- /* freed after init ends here */
- __bss_start = .; /* BSS */
- .sbss : {
- *(.sbss)
- *(.scommon)
+ /*
+ * Note that .bss.exit is also discarded at runtime for the
+ * same reason as above.
+ */
+ .bss.exit : {
+ *(.bss.exit)
}
+ __bss_start = .; /* BSS */
.bss : {
+ *(.bss.init)
+ . = ALIGN(_PAGE_SIZE);
+ __init_end = .; /* freed after init ends here */
+
*(.bss)
*(COMMON)
}
+ .sbss : {
+ *(.sbss)
+ *(.scommon)
+ }
__bss_stop = .;
_end = . ;
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] vmlinux.ld.S: correctly indent .data section
2007-10-18 21:12 [RFC] Add .bss.{init,exit} sections [take #2] Franck Bui-Huu
2007-10-18 21:12 ` [PATCH 1/4] Add .bss.{init,exit} sections Franck Bui-Huu
2007-10-18 21:12 ` [PATCH 2/4] Add .init.bss section for MIPS Franck Bui-Huu
@ 2007-10-18 21:12 ` Franck Bui-Huu
[not found] ` <20071018145723.4e4153c1@ripper.onstor.net>
2007-10-29 18:40 ` Ralf Baechle
2007-10-18 21:12 ` [PATCH 4/4] Use __bzero to clear .bss Franck Bui-Huu
3 siblings, 2 replies; 7+ messages in thread
From: Franck Bui-Huu @ 2007-10-18 21:12 UTC (permalink / raw)
To: linux-mips; +Cc: ralf, macro
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
arch/mips/kernel/vmlinux.lds.S | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index e0a4dc0..2f6c225 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -55,21 +55,23 @@ SECTIONS
/* writeable */
.data : { /* Data */
- . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
- /*
- * This ALIGN is needed as a workaround for a bug a gcc bug upto 4.1 which
- * limits the maximum alignment to at most 32kB and results in the following
- * warning:
- *
- * CC arch/mips/kernel/init_task.o
- * arch/mips/kernel/init_task.c:30: warning: alignment of ‘init_thread_union’
- * is greater than maximum object file alignment. Using 32768
- */
- . = ALIGN(_PAGE_SIZE);
- *(.data.init_task)
-
- DATA_DATA
- CONSTRUCTORS
+ . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
+ /*
+ * This ALIGN is needed as a workaround for a bug a
+ * gcc bug upto 4.1 which limits the maximum alignment
+ * to at most 32kB and results in the following
+ * warning:
+ *
+ * CC arch/mips/kernel/init_task.o
+ * arch/mips/kernel/init_task.c:30: warning: alignment
+ * of ‘init_thread_union’ is greater than maximum
+ * object file alignment. Using 32768
+ */
+ . = ALIGN(_PAGE_SIZE);
+ *(.data.init_task)
+
+ DATA_DATA
+ CONSTRUCTORS
}
_gp = . + 0x8000;
.lit8 : {
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread[parent not found: <20071018145723.4e4153c1@ripper.onstor.net>]
* Re: [PATCH 3/4] vmlinux.ld.S: correctly indent .data section
[not found] ` <20071018145723.4e4153c1@ripper.onstor.net>
@ 2007-10-19 7:54 ` Franck Bui-Huu
0 siblings, 0 replies; 7+ messages in thread
From: Franck Bui-Huu @ 2007-10-19 7:54 UTC (permalink / raw)
To: Andrew Sharp; +Cc: macro, linux-mips
Andrew Sharp wrote:
> On Thu, 18 Oct 2007 23:12:32 +0200 Franck Bui-Huu <fbuihuu@gmail.com>
> wrote:
>
>> Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
>> ---
>> arch/mips/kernel/vmlinux.lds.S | 32
>> +++++++++++++++++--------------- 1 files changed, 17 insertions(+),
>> 15 deletions(-)
>>
>> diff --git a/arch/mips/kernel/vmlinux.lds.S
>> b/arch/mips/kernel/vmlinux.lds.S index e0a4dc0..2f6c225 100644
>> --- a/arch/mips/kernel/vmlinux.lds.S
>> +++ b/arch/mips/kernel/vmlinux.lds.S
>> @@ -55,21 +55,23 @@ SECTIONS
>>
>> /* writeable */
>> .data : { /* Data */
>> - . = . + DATAOFFSET; /* for
>> CONFIG_MAPPED_KERNEL */
>> - /*
>> - * This ALIGN is needed as a workaround for a bug a gcc
>> bug upto 4.1 which
>> - * limits the maximum alignment to at most 32kB and
>> results in the following
>> - * warning:
>> - *
>> - * CC arch/mips/kernel/init_task.o
>> - * arch/mips/kernel/init_task.c:30: warning: alignment of
>> â??init_thread_unionâ??
>> - * is greater than maximum object file alignment. Using
>> 32768
>> - */
>> - . = ALIGN(_PAGE_SIZE);
>> - *(.data.init_task)
>> -
>> - DATA_DATA
>> - CONSTRUCTORS
>> + . = . + DATAOFFSET; /* for
>> CONFIG_MAPPED_KERNEL */
>> + /*
>> + * This ALIGN is needed as a workaround for a bug a
>> + * gcc bug upto 4.1 which limits the maximum
>
> at least fix the text while you're here: 'a bug a gcc bug'
>
>> + * to at most 32kB and results in the following
>> + * warning:
>> + *
>> + * CC arch/mips/kernel/init_task.o
>> + * arch/mips/kernel/init_task.c:30: warning:
>> alignment
>> + * of â??init_thread_unionâ?? is greater than maximum
>
> is that utf-8 or something? probably should remove that.
>
> sorry for the picayunes, but hey as long as you're here changing the
> indenting ~:^)
>
>
Okay I'll fix them.
Thanks
Franck
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] vmlinux.ld.S: correctly indent .data section
2007-10-18 21:12 ` [PATCH 3/4] vmlinux.ld.S: correctly indent .data section Franck Bui-Huu
[not found] ` <20071018145723.4e4153c1@ripper.onstor.net>
@ 2007-10-29 18:40 ` Ralf Baechle
1 sibling, 0 replies; 7+ messages in thread
From: Ralf Baechle @ 2007-10-29 18:40 UTC (permalink / raw)
To: Franck Bui-Huu; +Cc: linux-mips, macro
On Thu, Oct 18, 2007 at 11:12:32PM +0200, Franck Bui-Huu wrote:
Thanks, applied.
Ralf
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/4] Use __bzero to clear .bss
2007-10-18 21:12 [RFC] Add .bss.{init,exit} sections [take #2] Franck Bui-Huu
` (2 preceding siblings ...)
2007-10-18 21:12 ` [PATCH 3/4] vmlinux.ld.S: correctly indent .data section Franck Bui-Huu
@ 2007-10-18 21:12 ` Franck Bui-Huu
3 siblings, 0 replies; 7+ messages in thread
From: Franck Bui-Huu @ 2007-10-18 21:12 UTC (permalink / raw)
To: linux-mips; +Cc: ralf, macro
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
arch/mips/kernel/head.S | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index e46782b..330eec1 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -175,13 +175,10 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
mtc0 t0, CP0_STATUS
#endif /* CONFIG_MIPS_MT_SMTC */
- PTR_LA t0, __bss_start # clear .bss
- LONG_S zero, (t0)
- PTR_LA t1, __bss_stop - LONGSIZE
-1:
- PTR_ADDIU t0, LONGSIZE
- LONG_S zero, (t0)
- bne t0, t1, 1b
+ PTR_LA a0, __bss_start # clear .bss
+ PTR_LA a1, __bss_stop
+ PTR_SUBU a1, a0
+ jal __bzero
LONG_S a0, fw_arg0 # firmware arguments
LONG_S a1, fw_arg1
--
1.5.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread