2009-04-27 18:06:29

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 0/8] cleanup old init and refok sections

Sam,

This patch series cleans up the use of the deprecated section names
.text.init, .text.init.refok, .exit.text.refok, and .data.init.refok
in the Linux kernel, replacing them with the appropriate macros that
reference the current names for these sections.

The long-term goal here is to be able to change the kernel's magic
section names to those that are compatible with -ffunction-sections
-fdata-sections. Doing so requires renaming all magic sections with
names of the form ".text.foo" or ".data.bar".

--

Tim Abbott (8):
frv: Remove unused header asm/init.h.
frv: Use __INIT macro instead of .text.init.
arm: Use __INIT macro instead of .text.init.
powerpc: Use TEXT_TEXT macro in linker script.
powerpc: Use __REF macro instead of old .text.init.refok.
sh: Use __INIT macro instead of .text.init.
sparc: cleanup references to deprecated .text.init* sections.
Remove unused support code for refok sections.

arch/arm/mm/proc-v6.S | 3 ++-
arch/arm/mm/proc-v7.S | 3 ++-
arch/arm/mm/tlb-v6.S | 3 ++-
arch/arm/mm/tlb-v7.S | 3 ++-
arch/frv/include/asm/init.h | 12 ------------
arch/frv/kernel/head-mmu-fr451.S | 3 ++-
arch/frv/kernel/head-uc-fr401.S | 3 ++-
arch/frv/kernel/head-uc-fr451.S | 3 ++-
arch/frv/kernel/head-uc-fr555.S | 3 ++-
arch/powerpc/include/asm/ppc_asm.h | 5 +++--
arch/powerpc/kernel/vmlinux.lds.S | 3 ++-
arch/sh/kernel/cpu/sh5/entry.S | 5 +++--
arch/sparc/kernel/head_32.S | 2 +-
arch/sparc/kernel/head_64.S | 2 +-
include/asm-generic/vmlinux.lds.h | 3 ---
include/linux/init.h | 8 --------
scripts/mod/modpost.c | 18 ------------------
17 files changed, 26 insertions(+), 56 deletions(-)
delete mode 100644 arch/frv/include/asm/init.h


2009-04-27 18:05:50

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 4/8] powerpc: Use TEXT_TEXT macro in linker script.

Rather than adding .ref.text to the powerpc linker script so that we
can use __REF on the powerpc architecture, it seems simpler to switch
to using the generic TEXT_TEXT macro.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
---
arch/powerpc/kernel/vmlinux.lds.S | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index d7425ff..433ae11 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -54,7 +54,8 @@ SECTIONS
ALIGN_FUNCTION();
HEAD_TEXT
_text = .;
- *(.text .fixup .text.init.refok .exit.text.refok __ftr_alt_*)
+ TEXT_TEXT
+ *(.fixup __ftr_alt_*)
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
--
1.6.2.1

2009-04-27 18:06:13

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 7/8] sparc: cleanup references to deprecated .text.init* sections.

The section .text.init.refok is deprecated and __REF (.ref.text)
should be used in assembly files instead. This patch cleans up a few
uses of .text.init.refok in the sparc architecture.

Also fix a reference to .text.init in a comment that wasn't updated to
.init.text.

Signed-off-by: Tim Abbott <[email protected]>
Cc: David S. Miller <[email protected]>
---
arch/sparc/kernel/head_32.S | 2 +-
arch/sparc/kernel/head_64.S | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/kernel/head_32.S b/arch/sparc/kernel/head_32.S
index e91f01a..6b4d8ac 100644
--- a/arch/sparc/kernel/head_32.S
+++ b/arch/sparc/kernel/head_32.S
@@ -735,7 +735,7 @@ go_to_highmem:
nop

/* The code above should be at beginning and we have to take care about
- * short jumps, as branching to .text.init section from .text is usually
+ * short jumps, as branching to .init.text section from .text is usually
* impossible */
__INIT
/* Acquire boot time privileged register values, this will help debugging.
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 3a1b7bf..91bf4c7 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -467,7 +467,7 @@ jump_to_sun4u_init:
jmpl %g2 + %g0, %g0
nop

- .section .text.init.refok
+ __REF
sun4u_init:
BRANCH_IF_SUN4V(g1, sun4v_init)

--
1.6.2.1

2009-04-27 18:06:45

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 1/8] frv: Remove unused header asm/init.h.

It seems nothing has included the frv asm/init.h header for some time,
and its actual contents are out of date with include/linux/init.h. So
just delete it.

Signed-off-by: Tim Abbott <[email protected]>
Cc: David Howells <[email protected]>
---
arch/frv/include/asm/init.h | 12 ------------
1 files changed, 0 insertions(+), 12 deletions(-)
delete mode 100644 arch/frv/include/asm/init.h

diff --git a/arch/frv/include/asm/init.h b/arch/frv/include/asm/init.h
deleted file mode 100644
index 8b15838..0000000
--- a/arch/frv/include/asm/init.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _ASM_INIT_H
-#define _ASM_INIT_H
-
-#define __init __attribute__ ((__section__ (".text.init")))
-#define __initdata __attribute__ ((__section__ (".data.init")))
-/* For assembly routines */
-#define __INIT .section ".text.init",#alloc,#execinstr
-#define __FINIT .previous
-#define __INITDATA .section ".data.init",#alloc,#write
-
-#endif
-
--
1.6.2.1

2009-04-27 18:07:15

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 6/8] sh: Use __INIT macro instead of .text.init.

The sh architecture has some code in the .text.init section, but it
does not reference that section in its linker scripts.

This change moves this code from the .text.init section to the
.init.text section, which is presumably where it belongs.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Paul Mundt <[email protected]>
---
arch/sh/kernel/cpu/sh5/entry.S | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S
index e640c63..7e49cb8 100644
--- a/arch/sh/kernel/cpu/sh5/entry.S
+++ b/arch/sh/kernel/cpu/sh5/entry.S
@@ -10,6 +10,7 @@
* for more details.
*/
#include <linux/errno.h>
+#include <linux/init.h>
#include <linux/sys.h>
#include <cpu/registers.h>
#include <asm/processor.h>
@@ -2058,10 +2059,10 @@ asm_uaccess_end:


/*
- * --- .text.init Section
+ * --- .init.text Section
*/

- .section .text.init, "ax"
+ __INIT

/*
* void trap_init (void)
--
1.6.2.1

2009-04-27 18:07:41

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 3/8] arm: Use __INIT macro instead of .text.init.

arm is placing some code in the .text.init section, but it does not
reference that section in its linker scripts.

This change moves this code from the .text.init section to the
.init.text section, which is presumably where it belongs.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/mm/proc-v6.S | 3 ++-
arch/arm/mm/proc-v7.S | 3 ++-
arch/arm/mm/tlb-v6.S | 3 ++-
arch/arm/mm/tlb-v7.S | 3 ++-
4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index f0cc599..087e239 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -10,6 +10,7 @@
*
* This is the "shell" of the ARMv6 processor support.
*/
+#include <linux/init.h>
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <asm/asm-offsets.h>
@@ -132,7 +133,7 @@ cpu_v6_name:
.asciz "ARMv6-compatible processor"
.align

- .section ".text.init", #alloc, #execinstr
+ __INIT

/*
* __v6_setup
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index d1ebec4..c221e26 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -9,6 +9,7 @@
*
* This is the "shell" of the ARMv7 processor support.
*/
+#include <linux/init.h>
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <asm/asm-offsets.h>
@@ -153,7 +154,7 @@ cpu_v7_name:
.ascii "ARMv7 Processor"
.align

- .section ".text.init", #alloc, #execinstr
+ __INIT

/*
* __v7_setup
diff --git a/arch/arm/mm/tlb-v6.S b/arch/arm/mm/tlb-v6.S
index 20f84bb..73d7d89 100644
--- a/arch/arm/mm/tlb-v6.S
+++ b/arch/arm/mm/tlb-v6.S
@@ -10,6 +10,7 @@
* ARM architecture version 6 TLB handling functions.
* These assume a split I/D TLB.
*/
+#include <linux/init.h>
#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/page.h>
@@ -87,7 +88,7 @@ ENTRY(v6wbi_flush_kern_tlb_range)
mcr p15, 0, r2, c7, c5, 4 @ prefetch flush
mov pc, lr

- .section ".text.init", #alloc, #execinstr
+ __INIT

.type v6wbi_tlb_fns, #object
ENTRY(v6wbi_tlb_fns)
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S
index 24ba510..b637e73 100644
--- a/arch/arm/mm/tlb-v7.S
+++ b/arch/arm/mm/tlb-v7.S
@@ -11,6 +11,7 @@
* ARM architecture version 6 TLB handling functions.
* These assume a split I/D TLB.
*/
+#include <linux/init.h>
#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/page.h>
@@ -80,7 +81,7 @@ ENTRY(v7wbi_flush_kern_tlb_range)
mov pc, lr
ENDPROC(v7wbi_flush_kern_tlb_range)

- .section ".text.init", #alloc, #execinstr
+ __INIT

.type v7wbi_tlb_fns, #object
ENTRY(v7wbi_tlb_fns)
--
1.6.2.1

2009-04-27 18:09:24

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 8/8] Remove unused support code for refok sections.

The old refok sections

.text.init.refok
.data.init.refok
.exit.text.refok

have been deprecated since commit
312b1485fb509c9bc32eda28ad29537896658cb8. After the other patches in
this patch series nothing is put in these sections, so clean things up
by eliminating all the remaining references to them.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Sam Ravnborg <[email protected]>
---
include/asm-generic/vmlinux.lds.h | 3 ---
include/linux/init.h | 8 --------
scripts/mod/modpost.c | 18 ------------------
3 files changed, 0 insertions(+), 29 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index eaa06ef..89853bc 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -90,7 +90,6 @@
/* .data section */
#define DATA_DATA \
*(.data) \
- *(.data.init.refok) \
*(.ref.data) \
DEV_KEEP(init.data) \
DEV_KEEP(exit.data) \
@@ -289,8 +288,6 @@
*(.text.hot) \
*(.text) \
*(.ref.text) \
- *(.text.init.refok) \
- *(.exit.text.refok) \
DEV_KEEP(init.text) \
DEV_KEEP(exit.text) \
CPU_KEEP(init.text) \
diff --git a/include/linux/init.h b/include/linux/init.h
index 20a1334..0e06c17 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -62,14 +62,6 @@
#define __refdata __section(.ref.data)
#define __refconst __section(.ref.rodata)

-/* backward compatibility note
- * A few places hardcode the old section names:
- * .text.init.refok
- * .data.init.refok
- * .exit.text.refok
- * They should be converted to use the defines from this file
- */
-
/* compatibility defines */
#define __init_refok __ref
#define __initdata_refok __refdata
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index df6e628..8d46ea7 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -794,15 +794,6 @@ static const char *init_exit_sections[] =
/* data section */
static const char *data_sections[] = { DATA_SECTIONS, NULL };

-/* sections that may refer to an init/exit section with no warning */
-static const char *initref_sections[] =
-{
- ".text.init.refok*",
- ".exit.text.refok*",
- ".data.init.refok*",
- NULL
-};
-

/* symbols in .data that may refer to init/exit sections */
static const char *symbol_white_list[] =
@@ -915,11 +906,6 @@ static int section_mismatch(const char *fromsec, const char *tosec)
/**
* Whitelist to allow certain references to pass with no warning.
*
- * Pattern 0:
- * Do not warn if funtion/data are marked with __init_refok/__initdata_refok.
- * The pattern is identified by:
- * fromsec = .text.init.refok* | .data.init.refok*
- *
* Pattern 1:
* If a module parameter is declared __initdata and permissions=0
* then this is legal despite the warning generated.
@@ -958,10 +944,6 @@ static int section_mismatch(const char *fromsec, const char *tosec)
static int secref_whitelist(const char *fromsec, const char *fromsym,
const char *tosec, const char *tosym)
{
- /* Check for pattern 0 */
- if (match(fromsec, initref_sections))
- return 0;
-
/* Check for pattern 1 */
if (match(tosec, init_data_sections) &&
match(fromsec, data_sections) &&
--
1.6.2.1

2009-04-27 18:12:22

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 2/8] frv: Use __INIT macro instead of .text.init.

frv is placing some code in the .text.init section but does not
reference that section in its linker scripts.

This change moves this code from the .text.init section to the
.init.text section, which is presumably where it belongs.

Signed-off-by: Tim Abbott <[email protected]>
Cc: David Howells <[email protected]>
---
arch/frv/kernel/head-mmu-fr451.S | 3 ++-
arch/frv/kernel/head-uc-fr401.S | 3 ++-
arch/frv/kernel/head-uc-fr451.S | 3 ++-
arch/frv/kernel/head-uc-fr555.S | 3 ++-
4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/frv/kernel/head-mmu-fr451.S b/arch/frv/kernel/head-mmu-fr451.S
index c8f210d..98f87d5 100644
--- a/arch/frv/kernel/head-mmu-fr451.S
+++ b/arch/frv/kernel/head-mmu-fr451.S
@@ -9,6 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/

+#include <linux/init.h>
#include <linux/threads.h>
#include <linux/linkage.h>
#include <asm/ptrace.h>
@@ -31,7 +32,7 @@
#define __400_LCR 0xfe000100
#define __400_LSBR 0xfe000c00

- .section .text.init,"ax"
+ __INIT
.balign 4

###############################################################################
diff --git a/arch/frv/kernel/head-uc-fr401.S b/arch/frv/kernel/head-uc-fr401.S
index ee282be..438643c 100644
--- a/arch/frv/kernel/head-uc-fr401.S
+++ b/arch/frv/kernel/head-uc-fr401.S
@@ -9,6 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/

+#include <linux/init.h>
#include <linux/threads.h>
#include <linux/linkage.h>
#include <asm/ptrace.h>
@@ -30,7 +31,7 @@
#define __400_LCR 0xfe000100
#define __400_LSBR 0xfe000c00

- .section .text.init,"ax"
+ __INIT
.balign 4

###############################################################################
diff --git a/arch/frv/kernel/head-uc-fr451.S b/arch/frv/kernel/head-uc-fr451.S
index b10d9c8..b2a76c4 100644
--- a/arch/frv/kernel/head-uc-fr451.S
+++ b/arch/frv/kernel/head-uc-fr451.S
@@ -9,6 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/

+#include <linux/init.h>
#include <linux/threads.h>
#include <linux/linkage.h>
#include <asm/ptrace.h>
@@ -30,7 +31,7 @@
#define __400_LCR 0xfe000100
#define __400_LSBR 0xfe000c00

- .section .text.init,"ax"
+ __INIT
.balign 4

###############################################################################
diff --git a/arch/frv/kernel/head-uc-fr555.S b/arch/frv/kernel/head-uc-fr555.S
index 39937c1..5497aaf 100644
--- a/arch/frv/kernel/head-uc-fr555.S
+++ b/arch/frv/kernel/head-uc-fr555.S
@@ -9,6 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/

+#include <linux/init.h>
#include <linux/threads.h>
#include <linux/linkage.h>
#include <asm/ptrace.h>
@@ -29,7 +30,7 @@
#define __551_LCR 0xfeff1100
#define __551_LSBR 0xfeff1c00

- .section .text.init,"ax"
+ __INIT
.balign 4

###############################################################################
--
1.6.2.1

2009-04-27 18:12:39

by Tim Abbott

[permalink] [raw]
Subject: [PATCH 5/8] powerpc: Use __REF macro instead of old .text.init.refok.

The section .text.init.refok is deprecated and __REF (.ref.text)
should be used in assembly files instead. This patch cleans up a few
uses of .text.init.refok in the powerpc architecture.

Signed-off-by: Tim Abbott <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
---
arch/powerpc/include/asm/ppc_asm.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index f59a666..384d90c 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -4,6 +4,7 @@
#ifndef _ASM_POWERPC_PPC_ASM_H
#define _ASM_POWERPC_PPC_ASM_H

+#include <linux/init.h>
#include <linux/stringify.h>
#include <asm/asm-compat.h>
#include <asm/processor.h>
@@ -189,7 +190,7 @@ name: \
GLUE(.,name):

#define _INIT_GLOBAL(name) \
- .section ".text.init.refok"; \
+ __REF; \
.align 2 ; \
.globl name; \
.globl GLUE(.,name); \
@@ -229,7 +230,7 @@ name: \
GLUE(.,name):

#define _INIT_STATIC(name) \
- .section ".text.init.refok"; \
+ __REF; \
.align 2 ; \
.section ".opd","aw"; \
name: \
--
1.6.2.1

2009-04-27 18:30:00

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 1/8] frv: Remove unused header asm/init.h.

On Mon, Apr 27, 2009 at 02:02:20PM -0400, Tim Abbott wrote:
> It seems nothing has included the frv asm/init.h header for some time,
> and its actual contents are out of date with include/linux/init.h. So
> just delete it.

git grep 'asm/init.h' agree with you.

>
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: David Howells <[email protected]>
Acked-by: Sam Ravnborg <[email protected]>
> ---
> arch/frv/include/asm/init.h | 12 ------------
> 1 files changed, 0 insertions(+), 12 deletions(-)
> delete mode 100644 arch/frv/include/asm/init.h
>
> diff --git a/arch/frv/include/asm/init.h b/arch/frv/include/asm/init.h
> deleted file mode 100644
> index 8b15838..0000000
> --- a/arch/frv/include/asm/init.h
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -#ifndef _ASM_INIT_H
> -#define _ASM_INIT_H
> -
> -#define __init __attribute__ ((__section__ (".text.init")))
> -#define __initdata __attribute__ ((__section__ (".data.init")))
> -/* For assembly routines */
> -#define __INIT .section ".text.init",#alloc,#execinstr
> -#define __FINIT .previous
> -#define __INITDATA .section ".data.init",#alloc,#write
> -
> -#endif
> -
> --
> 1.6.2.1
>

2009-04-27 18:35:41

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 2/8] frv: Use __INIT macro instead of .text.init.

On Mon, Apr 27, 2009 at 02:02:21PM -0400, Tim Abbott wrote:
> frv is placing some code in the .text.init section but does not
> reference that section in its linker scripts.
>
> This change moves this code from the .text.init section to the
> .init.text section, which is presumably where it belongs.

I checked a few of the assembler entries - they where all
called from __HEAD section.
So this change looks good.

>
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: David Howells <[email protected]>
Acked-by: Sam Ravnborg <[email protected]>

> ---
> arch/frv/kernel/head-mmu-fr451.S | 3 ++-
> arch/frv/kernel/head-uc-fr401.S | 3 ++-
> arch/frv/kernel/head-uc-fr451.S | 3 ++-
> arch/frv/kernel/head-uc-fr555.S | 3 ++-
> 4 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/frv/kernel/head-mmu-fr451.S b/arch/frv/kernel/head-mmu-fr451.S
> index c8f210d..98f87d5 100644
> --- a/arch/frv/kernel/head-mmu-fr451.S
> +++ b/arch/frv/kernel/head-mmu-fr451.S
> @@ -9,6 +9,7 @@
> * 2 of the License, or (at your option) any later version.
> */
>
> +#include <linux/init.h>
> #include <linux/threads.h>
> #include <linux/linkage.h>
> #include <asm/ptrace.h>
> @@ -31,7 +32,7 @@
> #define __400_LCR 0xfe000100
> #define __400_LSBR 0xfe000c00
>
> - .section .text.init,"ax"
> + __INIT
> .balign 4
>
> ###############################################################################
> diff --git a/arch/frv/kernel/head-uc-fr401.S b/arch/frv/kernel/head-uc-fr401.S
> index ee282be..438643c 100644
> --- a/arch/frv/kernel/head-uc-fr401.S
> +++ b/arch/frv/kernel/head-uc-fr401.S
> @@ -9,6 +9,7 @@
> * 2 of the License, or (at your option) any later version.
> */
>
> +#include <linux/init.h>
> #include <linux/threads.h>
> #include <linux/linkage.h>
> #include <asm/ptrace.h>
> @@ -30,7 +31,7 @@
> #define __400_LCR 0xfe000100
> #define __400_LSBR 0xfe000c00
>
> - .section .text.init,"ax"
> + __INIT
> .balign 4
>
> ###############################################################################
> diff --git a/arch/frv/kernel/head-uc-fr451.S b/arch/frv/kernel/head-uc-fr451.S
> index b10d9c8..b2a76c4 100644
> --- a/arch/frv/kernel/head-uc-fr451.S
> +++ b/arch/frv/kernel/head-uc-fr451.S
> @@ -9,6 +9,7 @@
> * 2 of the License, or (at your option) any later version.
> */
>
> +#include <linux/init.h>
> #include <linux/threads.h>
> #include <linux/linkage.h>
> #include <asm/ptrace.h>
> @@ -30,7 +31,7 @@
> #define __400_LCR 0xfe000100
> #define __400_LSBR 0xfe000c00
>
> - .section .text.init,"ax"
> + __INIT
> .balign 4
>
> ###############################################################################
> diff --git a/arch/frv/kernel/head-uc-fr555.S b/arch/frv/kernel/head-uc-fr555.S
> index 39937c1..5497aaf 100644
> --- a/arch/frv/kernel/head-uc-fr555.S
> +++ b/arch/frv/kernel/head-uc-fr555.S
> @@ -9,6 +9,7 @@
> * 2 of the License, or (at your option) any later version.
> */
>
> +#include <linux/init.h>
> #include <linux/threads.h>
> #include <linux/linkage.h>
> #include <asm/ptrace.h>
> @@ -29,7 +30,7 @@
> #define __551_LCR 0xfeff1100
> #define __551_LSBR 0xfeff1c00
>
> - .section .text.init,"ax"
> + __INIT
> .balign 4
>
> ###############################################################################
> --
> 1.6.2.1
>

2009-04-27 18:41:34

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 3/8] arm: Use __INIT macro instead of .text.init.

On Mon, Apr 27, 2009 at 02:02:22PM -0400, Tim Abbott wrote:
> arm is placing some code in the .text.init section, but it does not
> reference that section in its linker scripts.
>
> This change moves this code from the .text.init section to the
> .init.text section, which is presumably where it belongs.

It looks obviously correct.
But I tried and failed to follow the chain of usage.

So we need an ack from Russell on this one.

Sam

2009-04-27 18:42:44

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 4/8] powerpc: Use TEXT_TEXT macro in linker script.

On Mon, Apr 27, 2009 at 02:02:23PM -0400, Tim Abbott wrote:
> Rather than adding .ref.text to the powerpc linker script so that we
> can use __REF on the powerpc architecture, it seems simpler to switch
> to using the generic TEXT_TEXT macro.
>
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: Benjamin Herrenschmidt <[email protected]>
Acked-by: Sam Ravnborg <[email protected]>
> ---
> arch/powerpc/kernel/vmlinux.lds.S | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index d7425ff..433ae11 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -54,7 +54,8 @@ SECTIONS
> ALIGN_FUNCTION();
> HEAD_TEXT
> _text = .;
> - *(.text .fixup .text.init.refok .exit.text.refok __ftr_alt_*)
> + TEXT_TEXT
> + *(.fixup __ftr_alt_*)
> SCHED_TEXT
> LOCK_TEXT
> KPROBES_TEXT
> --
> 1.6.2.1
>

2009-04-27 18:42:59

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 5/8] powerpc: Use __REF macro instead of old .text.init.refok.

On Mon, Apr 27, 2009 at 02:02:24PM -0400, Tim Abbott wrote:
> The section .text.init.refok is deprecated and __REF (.ref.text)
> should be used in assembly files instead. This patch cleans up a few
> uses of .text.init.refok in the powerpc architecture.
>
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: Benjamin Herrenschmidt <[email protected]>
Acked-by: Sam Ravnborg <[email protected]>
> ---
> arch/powerpc/include/asm/ppc_asm.h | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
> index f59a666..384d90c 100644
> --- a/arch/powerpc/include/asm/ppc_asm.h
> +++ b/arch/powerpc/include/asm/ppc_asm.h
> @@ -4,6 +4,7 @@
> #ifndef _ASM_POWERPC_PPC_ASM_H
> #define _ASM_POWERPC_PPC_ASM_H
>
> +#include <linux/init.h>
> #include <linux/stringify.h>
> #include <asm/asm-compat.h>
> #include <asm/processor.h>
> @@ -189,7 +190,7 @@ name: \
> GLUE(.,name):
>
> #define _INIT_GLOBAL(name) \
> - .section ".text.init.refok"; \
> + __REF; \
> .align 2 ; \
> .globl name; \
> .globl GLUE(.,name); \
> @@ -229,7 +230,7 @@ name: \
> GLUE(.,name):
>
> #define _INIT_STATIC(name) \
> - .section ".text.init.refok"; \
> + __REF; \
> .align 2 ; \
> .section ".opd","aw"; \
> name: \
> --
> 1.6.2.1
>

2009-04-27 18:45:50

by Russell King

[permalink] [raw]
Subject: Re: [PATCH 3/8] arm: Use __INIT macro instead of .text.init.

On Mon, Apr 27, 2009 at 08:43:13PM +0200, Sam Ravnborg wrote:
> On Mon, Apr 27, 2009 at 02:02:22PM -0400, Tim Abbott wrote:
> > arm is placing some code in the .text.init section, but it does not
> > reference that section in its linker scripts.
> >
> > This change moves this code from the .text.init section to the
> > .init.text section, which is presumably where it belongs.
>
> It looks obviously correct.
> But I tried and failed to follow the chain of usage.

Yup, I did something similar with the other files some year ago, but
these new files got missed.

> So we need an ack from Russell on this one.

Acked-by: Russell King <[email protected]>

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:

2009-04-27 18:46:11

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 6/8] sh: Use __INIT macro instead of .text.init.

On Mon, Apr 27, 2009 at 02:02:25PM -0400, Tim Abbott wrote:
> The sh architecture has some code in the .text.init section, but it
> does not reference that section in its linker scripts.
>
> This change moves this code from the .text.init section to the
> .init.text section, which is presumably where it belongs.
>
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: Paul Mundt <[email protected]>
Acked-by: Sam Ravnborg <[email protected]>

> ---
> arch/sh/kernel/cpu/sh5/entry.S | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S
> index e640c63..7e49cb8 100644
> --- a/arch/sh/kernel/cpu/sh5/entry.S
> +++ b/arch/sh/kernel/cpu/sh5/entry.S
> @@ -10,6 +10,7 @@
> * for more details.
> */
> #include <linux/errno.h>
> +#include <linux/init.h>
> #include <linux/sys.h>
> #include <cpu/registers.h>
> #include <asm/processor.h>
> @@ -2058,10 +2059,10 @@ asm_uaccess_end:
>
>
> /*
> - * --- .text.init Section
> + * --- .init.text Section
> */
>
> - .section .text.init, "ax"
> + __INIT
>
> /*
> * void trap_init (void)
> --
> 1.6.2.1
>

2009-04-27 18:48:30

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 7/8] sparc: cleanup references to deprecated .text.init* sections.

On Mon, Apr 27, 2009 at 02:02:26PM -0400, Tim Abbott wrote:
> The section .text.init.refok is deprecated and __REF (.ref.text)
> should be used in assembly files instead. This patch cleans up a few
> uses of .text.init.refok in the sparc architecture.
>
> Also fix a reference to .text.init in a comment that wasn't updated to
> .init.text.
>
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: David S. Miller <[email protected]>
Acked-by: Sam Ravnborg <[email protected]>

> ---
> arch/sparc/kernel/head_32.S | 2 +-
> arch/sparc/kernel/head_64.S | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/sparc/kernel/head_32.S b/arch/sparc/kernel/head_32.S
> index e91f01a..6b4d8ac 100644
> --- a/arch/sparc/kernel/head_32.S
> +++ b/arch/sparc/kernel/head_32.S
> @@ -735,7 +735,7 @@ go_to_highmem:
> nop
>
> /* The code above should be at beginning and we have to take care about
> - * short jumps, as branching to .text.init section from .text is usually
> + * short jumps, as branching to .init.text section from .text is usually
> * impossible */
> __INIT
> /* Acquire boot time privileged register values, this will help debugging.
> diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
> index 3a1b7bf..91bf4c7 100644
> --- a/arch/sparc/kernel/head_64.S
> +++ b/arch/sparc/kernel/head_64.S
> @@ -467,7 +467,7 @@ jump_to_sun4u_init:
> jmpl %g2 + %g0, %g0
> nop
>
> - .section .text.init.refok
> + __REF
> sun4u_init:
> BRANCH_IF_SUN4V(g1, sun4v_init)
>
> --
> 1.6.2.1
>

2009-04-27 18:49:56

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 8/8] Remove unused support code for refok sections.

On Mon, Apr 27, 2009 at 02:02:27PM -0400, Tim Abbott wrote:
> The old refok sections
>
> .text.init.refok
> .data.init.refok
> .exit.text.refok
>
> have been deprecated since commit
> 312b1485fb509c9bc32eda28ad29537896658cb8. After the other patches in
> this patch series nothing is put in these sections, so clean things up
> by eliminating all the remaining references to them.
>
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: Sam Ravnborg <[email protected]>

I like this cleanup!
Acked-by: Sam Ravnborg <[email protected]>

> ---
> include/asm-generic/vmlinux.lds.h | 3 ---
> include/linux/init.h | 8 --------
> scripts/mod/modpost.c | 18 ------------------
> 3 files changed, 0 insertions(+), 29 deletions(-)
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index eaa06ef..89853bc 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -90,7 +90,6 @@
> /* .data section */
> #define DATA_DATA \
> *(.data) \
> - *(.data.init.refok) \
> *(.ref.data) \
> DEV_KEEP(init.data) \
> DEV_KEEP(exit.data) \
> @@ -289,8 +288,6 @@
> *(.text.hot) \
> *(.text) \
> *(.ref.text) \
> - *(.text.init.refok) \
> - *(.exit.text.refok) \
> DEV_KEEP(init.text) \
> DEV_KEEP(exit.text) \
> CPU_KEEP(init.text) \
> diff --git a/include/linux/init.h b/include/linux/init.h
> index 20a1334..0e06c17 100644
> --- a/include/linux/init.h
> +++ b/include/linux/init.h
> @@ -62,14 +62,6 @@
> #define __refdata __section(.ref.data)
> #define __refconst __section(.ref.rodata)
>
> -/* backward compatibility note
> - * A few places hardcode the old section names:
> - * .text.init.refok
> - * .data.init.refok
> - * .exit.text.refok
> - * They should be converted to use the defines from this file
> - */
> -
> /* compatibility defines */
> #define __init_refok __ref
> #define __initdata_refok __refdata
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index df6e628..8d46ea7 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -794,15 +794,6 @@ static const char *init_exit_sections[] =
> /* data section */
> static const char *data_sections[] = { DATA_SECTIONS, NULL };
>
> -/* sections that may refer to an init/exit section with no warning */
> -static const char *initref_sections[] =
> -{
> - ".text.init.refok*",
> - ".exit.text.refok*",
> - ".data.init.refok*",
> - NULL
> -};
> -
>
> /* symbols in .data that may refer to init/exit sections */
> static const char *symbol_white_list[] =
> @@ -915,11 +906,6 @@ static int section_mismatch(const char *fromsec, const char *tosec)
> /**
> * Whitelist to allow certain references to pass with no warning.
> *
> - * Pattern 0:
> - * Do not warn if funtion/data are marked with __init_refok/__initdata_refok.
> - * The pattern is identified by:
> - * fromsec = .text.init.refok* | .data.init.refok*
> - *
> * Pattern 1:
> * If a module parameter is declared __initdata and permissions=0
> * then this is legal despite the warning generated.
> @@ -958,10 +944,6 @@ static int section_mismatch(const char *fromsec, const char *tosec)
> static int secref_whitelist(const char *fromsec, const char *fromsym,
> const char *tosec, const char *tosym)
> {
> - /* Check for pattern 0 */
> - if (match(fromsec, initref_sections))
> - return 0;
> -
> /* Check for pattern 1 */
> if (match(tosec, init_data_sections) &&
> match(fromsec, data_sections) &&
> --
> 1.6.2.1
>

2009-04-27 22:00:31

by Paul Mundt

[permalink] [raw]
Subject: Re: [PATCH 6/8] sh: Use __INIT macro instead of .text.init.

On Mon, Apr 27, 2009 at 02:02:25PM -0400, Tim Abbott wrote:
> The sh architecture has some code in the .text.init section, but it
> does not reference that section in its linker scripts.
>
> This change moves this code from the .text.init section to the
> .init.text section, which is presumably where it belongs.
>
> Signed-off-by: Tim Abbott <[email protected]>
> Cc: Paul Mundt <[email protected]>

Acked-by: Paul Mundt <[email protected]>