linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] macros for section name cleanup
@ 2009-04-30 19:54 Tim Abbott
  2009-04-30 19:54 ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Tim Abbott
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Waseem Daher, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller

(this patch series differs from v1 only in the CC list; some of the
architecture lists I sent the previous one to are moderated against
non-members; all replies should go to this version).

Here are the architecture-independent macro definitions needed for
to clean up the kernel's section names.  The overall diffstat from
this section name cleanup project is:

 96 files changed, 261 insertions(+), 503 deletions(-)

The decrease results from removing a lot of redundancy in the linker
scripts.

The long-term goal here is to add support for building the kernel with
-ffunction-sections -fdata-sections.  This requires renaming all the
magic section names in the kernel of the form .text.foo, .data.foo,
.bss.foo, and .rodata.foo to not have collisions with sections
generated for code like:

static int nosave = 0; /* -fdata-sections places in .data.nosave */
static void head(); /* -ffunction-sections places in .text.head */

Sam Ravnborg proposed that rather than just renaming all the sections
outright, we should start by first getting more control over the
section names used in the kernel so that we can later rename sections
without touching too many files.  These patch series implement that
cleanup.  Later, there will be another patch series to actually rename
the sections.

I'm hoping we can get just these macro definitions into 2.6.30 so that
the arch maintainers don't have to grab the macro definitions for
their trees while reviewing the patches for 2.6.31.

Shortly, I'm going to send one patch series for each of the
architectures updating those architectures to use these new macros
(and otherwise cleaning up section names on those architectures).

	-Tim Abbott

Tim Abbott (6):
  Add new macros for page-aligned data and bss sections.
  Add new NOSAVE_DATA linker script macro.
  Add new CACHELINE_ALIGNED_DATA linker script macro.
  Add new INIT_TASK_DATA() linker script macro.
  Add new READ_MOSTLY_DATA(align) linker script macro.
  Add support for __read_mostly to linux/cache.h

 include/asm-generic/vmlinux.lds.h |   27 +++++++++++++++++++++++++++
 include/linux/cache.h             |    6 ++++++
 include/linux/init_task.h         |    3 +++
 include/linux/linkage.h           |    9 +++++++++
 4 files changed, 45 insertions(+), 0 deletions(-)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
  2009-04-30 19:54 [PATCH v2 0/6] macros for section name cleanup Tim Abbott
@ 2009-04-30 19:54 ` Tim Abbott
  2009-04-30 19:54   ` [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro Tim Abbott
  2009-05-01  9:18   ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Sam Ravnborg
  2009-05-01  9:04 ` [PATCH v2 0/6] macros for section name cleanup Sam Ravnborg
  2009-05-01 14:21 ` Sam Ravnborg
  2 siblings, 2 replies; 18+ messages in thread
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
	Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller

This patch is preparation for replacing most uses of
".bss.page_aligned" and ".data.page_aligned" in the kernel with
macros, so that the section name can later be changed without having
to touch a lot of the kernel.

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.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: David Howells <dhowells@redhat.com>
---
 include/asm-generic/vmlinux.lds.h |    8 ++++++++
 include/linux/linkage.h           |    9 +++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 89853bc..3d88c87 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -116,6 +116,14 @@
 	FTRACE_EVENTS()							\
 	TRACE_SYSCALLS()
 
+#define PAGE_ALIGNED_DATA						\
+	. = ALIGN(PAGE_SIZE);						\
+	*(.data.page_aligned)
+
+#define PAGE_ALIGNED_BSS						\
+	. = ALIGN(PAGE_SIZE);						\
+	*(.bss.page_aligned)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index fee9e59..af051fc 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -22,6 +22,15 @@
 #define __page_aligned_bss	__section(.bss.page_aligned) __aligned(PAGE_SIZE)
 
 /*
+ * For assembly routines.
+ *
+ * Note when using these that you must specify the appropriate
+ * alignment directives yourself
+ */
+#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw", @progbits
+#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw", @nobits
+
+/*
  * This is used by architectures to keep arguments on the stack
  * untouched by the compiler by keeping them live until the end.
  * The argument stack may be owned by the assembly-language
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro.
  2009-04-30 19:54 ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Tim Abbott
@ 2009-04-30 19:54   ` Tim Abbott
  2009-04-30 19:54     ` [PATCH v2 3/6] Add new CACHELINE_ALIGNED_DATA " Tim Abbott
  2009-05-01  9:21     ` [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro Sam Ravnborg
  2009-05-01  9:18   ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Sam Ravnborg
  1 sibling, 2 replies; 18+ messages in thread
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
	Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller

This patch is preparation for replacing most ".data.nosave" in the
kernel with macros, so that the section name can later be changed
without having to touch a lot of the kernel.

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.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 3d88c87..f5ebd2b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -124,6 +124,13 @@
 	. = ALIGN(PAGE_SIZE);						\
 	*(.bss.page_aligned)
 
+#define NOSAVE_DATA							\
+	. = ALIGN(PAGE_SIZE);						\
+	__nosave_begin = .;						\
+	*(.data.nosave)							\
+	. = ALIGN(PAGE_SIZE);						\
+	__nosave_end = .;
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 3/6] Add new CACHELINE_ALIGNED_DATA linker script macro.
  2009-04-30 19:54   ` [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro Tim Abbott
@ 2009-04-30 19:54     ` Tim Abbott
  2009-04-30 19:54       ` [PATCH v2 4/6] Add new INIT_TASK_DATA() " Tim Abbott
  2009-05-01  9:21     ` [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro Sam Ravnborg
  1 sibling, 1 reply; 18+ messages in thread
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
	Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller

This patch is preparation for replacing most ".data.cacheline_aligned"
in the kernel with macros, so that the section name can later be
changed without having to touch a lot of the kernel.

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.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f5ebd2b..fa7801b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -131,6 +131,10 @@
 	. = ALIGN(PAGE_SIZE);						\
 	__nosave_end = .;
 
+#define CACHELINE_ALIGNED_DATA(alignment)				\
+	. = ALIGN(alignment);						\
+	*(.data.cacheline_aligned)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 4/6] Add new INIT_TASK_DATA() linker script macro.
  2009-04-30 19:54     ` [PATCH v2 3/6] Add new CACHELINE_ALIGNED_DATA " Tim Abbott
@ 2009-04-30 19:54       ` Tim Abbott
  2009-04-30 19:54         ` [PATCH v2 5/6] Add new READ_MOSTLY_DATA(align) " Tim Abbott
  0 siblings, 1 reply; 18+ messages in thread
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
	Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller

This patch is preparation for replacing most ".data.init_task" in the
kernel with macros, so that the section name can later be changed
without having to touch a lot of the kernel.

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.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    4 ++++
 include/linux/init_task.h         |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index fa7801b..4b020e8 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -135,6 +135,10 @@
 	. = ALIGN(alignment);						\
 	*(.data.cacheline_aligned)
 
+#define INIT_TASK_DATA(alignment)					\
+	. = ALIGN(alignment);						\
+	*(.data.init_task)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index d87247d..e555baa 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -184,5 +184,8 @@ extern struct cred init_cred;
 	LIST_HEAD_INIT(cpu_timers[2]),					\
 }
 
+/* Attach to the init_task data structure for proper alignment */
+#define __init_task_data __attribute__((__section__(".data.init_task")))
+
 
 #endif
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 5/6] Add new READ_MOSTLY_DATA(align) linker script macro.
  2009-04-30 19:54       ` [PATCH v2 4/6] Add new INIT_TASK_DATA() " Tim Abbott
@ 2009-04-30 19:54         ` Tim Abbott
  2009-04-30 19:54           ` [PATCH v2 6/6] Add support for __read_mostly to linux/cache.h Tim Abbott
  0 siblings, 1 reply; 18+ messages in thread
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Sam Ravnborg, Waseem Daher,
	linux-s390, Jesper Nilsson, Yoshinori Sato, Helge Deller,
	Ingo Molnar, Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller

This patch is preparation for replacing most ".data.read_mostly" in
the kernel with macros, so that the section name can later be changed
without having to touch a lot of the kernel.

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.  This requires renaming all magic sections with names
of the form ".data.foo".

Signed-off-by: Tim Abbott <tabbott@mit.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 include/asm-generic/vmlinux.lds.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 4b020e8..a4b4f4a 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -139,6 +139,10 @@
 	. = ALIGN(alignment);						\
 	*(.data.init_task)
 
+#define READ_MOSTLY_DATA(alignment)					\
+	. = ALIGN(alignment);						\
+	*(.data.read_mostly)
+
 #define RO_DATA(align)							\
 	. = ALIGN((align));						\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 6/6] Add support for __read_mostly to linux/cache.h
  2009-04-30 19:54         ` [PATCH v2 5/6] Add new READ_MOSTLY_DATA(align) " Tim Abbott
@ 2009-04-30 19:54           ` Tim Abbott
  0 siblings, 0 replies; 18+ messages in thread
From: Tim Abbott @ 2009-04-30 19:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Waseem Daher, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Tim Abbott, Cyrill Gorcunov, Michal Simek,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, Thomas Gleixner, linux-alpha,
	Martin Schwidefsky, uclinux-dist-devel, Linus Torvalds,
	David S. Miller

Signed-off-by: Tim Abbott <tabbott@mit.edu>
---
 include/linux/cache.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/cache.h b/include/linux/cache.h
index 97e2488..99d8a6f 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,7 +13,13 @@
 #endif
 
 #ifndef __read_mostly
+#ifdef CONFIG_HAVE_READ_MOSTLY_DATA
+#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __READ_MOSTLY .section ".data.read_mostly", "aw"
+#else
 #define __read_mostly
+#define __READ_MOSTLY
+#endif /* CONFIG_HAVE_READ_MOSTLY_DATA */
 #endif
 
 #ifndef ____cacheline_aligned
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/6] macros for section name cleanup
  2009-04-30 19:54 [PATCH v2 0/6] macros for section name cleanup Tim Abbott
  2009-04-30 19:54 ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Tim Abbott
@ 2009-05-01  9:04 ` Sam Ravnborg
  2009-05-01 14:21 ` Sam Ravnborg
  2 siblings, 0 replies; 18+ messages in thread
From: Sam Ravnborg @ 2009-05-01  9:04 UTC (permalink / raw)
  To: Tim Abbott
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Waseem Daher, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, Tony Luck, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Linux kernel mailing list,
	Ralf Baechle, Anders Kaseorg, Kyle McMartin, Paul Mundt,
	Thomas Gleixner, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

On Thu, Apr 30, 2009 at 03:54:07PM -0400, Tim Abbott wrote:
> (this patch series differs from v1 only in the CC list; some of the
> architecture lists I sent the previous one to are moderated against
> non-members; all replies should go to this version).
> 
> Here are the architecture-independent macro definitions needed for
> to clean up the kernel's section names.  The overall diffstat from
> this section name cleanup project is:
> 
>  96 files changed, 261 insertions(+), 503 deletions(-)
> 
> The decrease results from removing a lot of redundancy in the linker
> scripts.
> 
> The long-term goal here is to add support for building the kernel with
> -ffunction-sections -fdata-sections.  This requires renaming all the
> magic section names in the kernel of the form .text.foo, .data.foo,
> .bss.foo, and .rodata.foo to not have collisions with sections
> generated for code like:
> 
> static int nosave = 0; /* -fdata-sections places in .data.nosave */
> static void head(); /* -ffunction-sections places in .text.head */
> 
> Sam Ravnborg proposed that rather than just renaming all the sections
> outright, we should start by first getting more control over the
> section names used in the kernel so that we can later rename sections
> without touching too many files.  These patch series implement that
> cleanup.  Later, there will be another patch series to actually rename
> the sections.
> 
> I'm hoping we can get just these macro definitions into 2.6.30 so that
> the arch maintainers don't have to grab the macro definitions for
> their trees while reviewing the patches for 2.6.31.
> 
> Shortly, I'm going to send one patch series for each of the
> architectures updating those architectures to use these new macros
> (and otherwise cleaning up section names on those architectures).

Hi Tim.

We agreed to get the common stuff and one architecture done before
proceeding with the rest.
Please stick to that plan so we avoid patch-bombing lkml + maintainers.

When we have this ready it will be a simple one-patch-per-arch to cover
the rest.

I will comment on your common patches for now.

	Sam

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
  2009-04-30 19:54 ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Tim Abbott
  2009-04-30 19:54   ` [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro Tim Abbott
@ 2009-05-01  9:18   ` Sam Ravnborg
  2009-05-01 13:54     ` Tim Abbott
  1 sibling, 1 reply; 18+ messages in thread
From: Sam Ravnborg @ 2009-05-01  9:18 UTC (permalink / raw)
  To: Tim Abbott
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Waseem Daher, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, Tony Luck, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Linux kernel mailing list,
	Ralf Baechle, Anders Kaseorg, Kyle McMartin, Paul Mundt,
	Thomas Gleixner, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

On Thu, Apr 30, 2009 at 03:54:08PM -0400, Tim Abbott wrote:
> This patch is preparation for replacing most uses of
> ".bss.page_aligned" and ".data.page_aligned" in the kernel with
> macros, so that the section name can later be changed without having
> to touch a lot of the kernel.
> 
> 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.  This requires renaming all magic sections with names
> of the form ".data.foo".
> 
> Signed-off-by: Tim Abbott <tabbott@mit.edu>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: David Howells <dhowells@redhat.com>
> ---
>  include/asm-generic/vmlinux.lds.h |    8 ++++++++
>  include/linux/linkage.h           |    9 +++++++++
>  2 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 89853bc..3d88c87 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -116,6 +116,14 @@
>  	FTRACE_EVENTS()							\
>  	TRACE_SYSCALLS()
>  
> +#define PAGE_ALIGNED_DATA						\
> +	. = ALIGN(PAGE_SIZE);						\
> +	*(.data.page_aligned)
> +
> +#define PAGE_ALIGNED_BSS						\
> +	. = ALIGN(PAGE_SIZE);						\
> +	*(.bss.page_aligned)
> +
>  #define RO_DATA(align)							\
>  	. = ALIGN((align));						\
>  	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
> diff --git a/include/linux/linkage.h b/include/linux/linkage.h
> index fee9e59..af051fc 100644
> --- a/include/linux/linkage.h
> +++ b/include/linux/linkage.h
> @@ -22,6 +22,15 @@
>  #define __page_aligned_bss	__section(.bss.page_aligned) __aligned(PAGE_SIZE)
>  
>  /*
> + * For assembly routines.
> + *
> + * Note when using these that you must specify the appropriate
> + * alignment directives yourself
> + */
> +#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw", @progbits
> +#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw", @nobits

The above will work on most architectures but fails (silently?) on arm.
arm uses %{progbits,nobits} where all other uses @{nobits,progbits}.

I know we do not use page_aligned in arm assembler code for now,
but if we do then it should work.
It is my understanding that the linker will automatically
assume nobits for section names starting with .bss and likewise
progbits for section names starting with .data - so we can leave them out?


	Sam

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro.
  2009-04-30 19:54   ` [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro Tim Abbott
  2009-04-30 19:54     ` [PATCH v2 3/6] Add new CACHELINE_ALIGNED_DATA " Tim Abbott
@ 2009-05-01  9:21     ` Sam Ravnborg
  1 sibling, 0 replies; 18+ messages in thread
From: Sam Ravnborg @ 2009-05-01  9:21 UTC (permalink / raw)
  To: Tim Abbott
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Waseem Daher, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, Tony Luck, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Linux kernel mailing list,
	Ralf Baechle, Anders Kaseorg, Kyle McMartin, Paul Mundt,
	Thomas Gleixner, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

On Thu, Apr 30, 2009 at 03:54:09PM -0400, Tim Abbott wrote:
> This patch is preparation for replacing most ".data.nosave" in the
> kernel with macros, so that the section name can later be changed
> without having to touch a lot of the kernel.
> 
> 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.  This requires renaming all magic sections with names
> of the form ".data.foo".
> 
> Signed-off-by: Tim Abbott <tabbott@mit.edu>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---
>  include/asm-generic/vmlinux.lds.h |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 3d88c87..f5ebd2b 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -124,6 +124,13 @@
>  	. = ALIGN(PAGE_SIZE);						\
>  	*(.bss.page_aligned)
>  
> +#define NOSAVE_DATA							\
> +	. = ALIGN(PAGE_SIZE);						\
> +	__nosave_begin = .;						\
> +	*(.data.nosave)							\
> +	. = ALIGN(PAGE_SIZE);						\
> +	__nosave_end = .;
> +

You need to use:
	VMLINUX_SYMBOL(__nosave_begin) = .;

Otherwise architectures such as m68k wil break as they
add a leading underscore.

See other symbols that is defined inside vmlinux.lds.h

	Sam

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
  2009-05-01  9:18   ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Sam Ravnborg
@ 2009-05-01 13:54     ` Tim Abbott
  2009-05-01 16:33       ` H. Peter Anvin
  0 siblings, 1 reply; 18+ messages in thread
From: Tim Abbott @ 2009-05-01 13:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Waseem Daher, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, Tony Luck, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Linux kernel mailing list,
	Ralf Baechle, Anders Kaseorg, Kyle McMartin, Paul Mundt,
	Thomas Gleixner, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

On Fri, 1 May 2009, Sam Ravnborg wrote:

> On Thu, Apr 30, 2009 at 03:54:08PM -0400, Tim Abbott wrote:
> > +#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw", @progbits
> > +#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw", @nobits
> 
> It is my understanding that the linker will automatically
> assume nobits for section names starting with .bss and likewise
> progbits for section names starting with .data - so we can leave them out?

I believe that is correct.

	-Tim Abbott

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/6] macros for section name cleanup
  2009-04-30 19:54 [PATCH v2 0/6] macros for section name cleanup Tim Abbott
  2009-04-30 19:54 ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Tim Abbott
  2009-05-01  9:04 ` [PATCH v2 0/6] macros for section name cleanup Sam Ravnborg
@ 2009-05-01 14:21 ` Sam Ravnborg
  2 siblings, 0 replies; 18+ messages in thread
From: Sam Ravnborg @ 2009-05-01 14:21 UTC (permalink / raw)
  To: Tim Abbott
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Greg Ungerer, Jeff Arnold, linuxppc-dev, Paul Mackerras,
	H. Peter Anvin, sparclinux, Waseem Daher, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, microblaze-uclinux, Russell King,
	user-mode-linux-devel, Heiko Carstens, Jeff Dike, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Richard Henderson,
	Chris Zankel, Bryan Wu, Tony Luck, linux-parisc,
	Haavard Skinnemoen, Hirokazu Takata, Linux kernel mailing list,
	Ralf Baechle, Anders Kaseorg, Kyle McMartin, Paul Mundt,
	Thomas Gleixner, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

On Thu, Apr 30, 2009 at 03:54:07PM -0400, Tim Abbott wrote:
> (this patch series differs from v1 only in the CC list; some of the
> architecture lists I sent the previous one to are moderated against
> non-members; all replies should go to this version).
> 
> Here are the architecture-independent macro definitions needed for
> to clean up the kernel's section names.  The overall diffstat from
> this section name cleanup project is:
> 
>  96 files changed, 261 insertions(+), 503 deletions(-)
> 
> The decrease results from removing a lot of redundancy in the linker
> scripts.
> 
> The long-term goal here is to add support for building the kernel with
> -ffunction-sections -fdata-sections.  This requires renaming all the
> magic section names in the kernel of the form .text.foo, .data.foo,
> .bss.foo, and .rodata.foo to not have collisions with sections
> generated for code like:
> 
> static int nosave = 0; /* -fdata-sections places in .data.nosave */
> static void head(); /* -ffunction-sections places in .text.head */
> 
> Sam Ravnborg proposed that rather than just renaming all the sections
> outright, we should start by first getting more control over the
> section names used in the kernel so that we can later rename sections
> without touching too many files.  These patch series implement that
> cleanup.  Later, there will be another patch series to actually rename
> the sections.
> 
> I'm hoping we can get just these macro definitions into 2.6.30 so that
> the arch maintainers don't have to grab the macro definitions for
> their trees while reviewing the patches for 2.6.31.
> 
> Shortly, I'm going to send one patch series for each of the
> architectures updating those architectures to use these new macros
> (and otherwise cleaning up section names on those architectures).
> 
> 	-Tim Abbott
> 
> Tim Abbott (6):
>   Add new macros for page-aligned data and bss sections.
>   Add new NOSAVE_DATA linker script macro.
>   Add new CACHELINE_ALIGNED_DATA linker script macro.
>   Add new INIT_TASK_DATA() linker script macro.
>   Add new READ_MOSTLY_DATA(align) linker script macro.

I am about to apply this part of your patches.
I am doing some additional modifications and
will most likely apply them as one patch.

Will post to linux-arch for review when it is ready.

	Sam

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
  2009-05-01 13:54     ` Tim Abbott
@ 2009-05-01 16:33       ` H. Peter Anvin
  2009-05-01 17:17         ` Sam Ravnborg
  0 siblings, 1 reply; 18+ messages in thread
From: H. Peter Anvin @ 2009-05-01 16:33 UTC (permalink / raw)
  To: Tim Abbott
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Heiko Carstens, linuxppc-dev, Paul Mackerras, Greg Ungerer,
	sparclinux, Sam Ravnborg, Thomas Gleixner, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, Russell King, user-mode-linux-devel,
	microblaze-uclinux, Jeff Dike, Jeff Arnold, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Waseem Daher,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

Tim Abbott wrote:
> On Fri, 1 May 2009, Sam Ravnborg wrote:
> 
>> On Thu, Apr 30, 2009 at 03:54:08PM -0400, Tim Abbott wrote:
>>> +#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw", @progbits
>>> +#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw", @nobits
>> It is my understanding that the linker will automatically
>> assume nobits for section names starting with .bss and likewise
>> progbits for section names starting with .data - so we can leave them out?
> 
> I believe that is correct.
> 

... but that doesn't mean it's the right thing to do.

It's better to be fully explicit when macroizing this kind of stuff.
This is part of why macroizing it is good: it means we end up with *one*
place that determines this stuff, not some magic heuristics in the linker.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
  2009-05-01 16:33       ` H. Peter Anvin
@ 2009-05-01 17:17         ` Sam Ravnborg
  2009-05-01 17:18           ` H. Peter Anvin
  0 siblings, 1 reply; 18+ messages in thread
From: Sam Ravnborg @ 2009-05-01 17:17 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Tim Abbott, Heiko Carstens, linuxppc-dev, Paul Mackerras,
	Greg Ungerer, sparclinux, Thomas Gleixner, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, Russell King, user-mode-linux-devel,
	microblaze-uclinux, Jeff Dike, Jeff Arnold, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Waseem Daher,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

On Fri, May 01, 2009 at 09:33:13AM -0700, H. Peter Anvin wrote:
> Tim Abbott wrote:
> > On Fri, 1 May 2009, Sam Ravnborg wrote:
> > 
> >> On Thu, Apr 30, 2009 at 03:54:08PM -0400, Tim Abbott wrote:
> >>> +#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw", @progbits
> >>> +#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw", @nobits
> >> It is my understanding that the linker will automatically
> >> assume nobits for section names starting with .bss and likewise
> >> progbits for section names starting with .data - so we can leave them out?
> > 
> > I believe that is correct.
> > 
> 
> ... but that doesn't mean it's the right thing to do.
> 
> It's better to be fully explicit when macroizing this kind of stuff.
> This is part of why macroizing it is good: it means we end up with *one*
> place that determines this stuff, not some magic heuristics in the linker.

Do you know if we can use % in place of @?
I could see that gas supports both - at least in trunk in cvs.

	Sam

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
  2009-05-01 17:17         ` Sam Ravnborg
@ 2009-05-01 17:18           ` H. Peter Anvin
  2009-05-01 17:44             ` Sam Ravnborg
  0 siblings, 1 reply; 18+ messages in thread
From: H. Peter Anvin @ 2009-05-01 17:18 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Tim Abbott, Heiko Carstens, linuxppc-dev, Paul Mackerras,
	Greg Ungerer, sparclinux, Thomas Gleixner, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, Russell King, user-mode-linux-devel,
	microblaze-uclinux, Jeff Dike, Jeff Arnold, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Waseem Daher,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

Sam Ravnborg wrote:
> On Fri, May 01, 2009 at 09:33:13AM -0700, H. Peter Anvin wrote:
>> Tim Abbott wrote:
>>> On Fri, 1 May 2009, Sam Ravnborg wrote:
>>>
>>>> On Thu, Apr 30, 2009 at 03:54:08PM -0400, Tim Abbott wrote:
>>>>> +#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw", @progbits
>>>>> +#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw", @nobits
>>>> It is my understanding that the linker will automatically
>>>> assume nobits for section names starting with .bss and likewise
>>>> progbits for section names starting with .data - so we can leave them out?
>>> I believe that is correct.
>>>
>> ... but that doesn't mean it's the right thing to do.
>>
>> It's better to be fully explicit when macroizing this kind of stuff.
>> This is part of why macroizing it is good: it means we end up with *one*
>> place that determines this stuff, not some magic heuristics in the linker.
> 
> Do you know if we can use % in place of @?
> I could see that gas supports both - at least in trunk in cvs.
> 

I think it might depend on the architecture(!)... but it would
definitely have to be an issue with testing a bunch of different versions.

What's wrong with @?

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
  2009-05-01 17:18           ` H. Peter Anvin
@ 2009-05-01 17:44             ` Sam Ravnborg
  2009-05-01 17:47               ` H. Peter Anvin
  0 siblings, 1 reply; 18+ messages in thread
From: Sam Ravnborg @ 2009-05-01 17:44 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Tim Abbott, Heiko Carstens, linuxppc-dev, Paul Mackerras,
	Greg Ungerer, sparclinux, Thomas Gleixner, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, Russell King, user-mode-linux-devel,
	microblaze-uclinux, Jeff Dike, Jeff Arnold, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Waseem Daher,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

On Fri, May 01, 2009 at 10:18:20AM -0700, H. Peter Anvin wrote:
> Sam Ravnborg wrote:
> > On Fri, May 01, 2009 at 09:33:13AM -0700, H. Peter Anvin wrote:
> >> Tim Abbott wrote:
> >>> On Fri, 1 May 2009, Sam Ravnborg wrote:
> >>>
> >>>> On Thu, Apr 30, 2009 at 03:54:08PM -0400, Tim Abbott wrote:
> >>>>> +#define __PAGE_ALIGNED_DATA	.section ".data.page_aligned", "aw", @progbits
> >>>>> +#define __PAGE_ALIGNED_BSS	.section ".bss.page_aligned", "aw", @nobits
> >>>> It is my understanding that the linker will automatically
> >>>> assume nobits for section names starting with .bss and likewise
> >>>> progbits for section names starting with .data - so we can leave them out?
> >>> I believe that is correct.
> >>>
> >> ... but that doesn't mean it's the right thing to do.
> >>
> >> It's better to be fully explicit when macroizing this kind of stuff.
> >> This is part of why macroizing it is good: it means we end up with *one*
> >> place that determines this stuff, not some magic heuristics in the linker.
> > 
> > Do you know if we can use % in place of @?
> > I could see that gas supports both - at least in trunk in cvs.
> > 
> 
> I think it might depend on the architecture(!)... but it would
> definitely have to be an issue with testing a bunch of different versions.
> 
> What's wrong with @?
arm does not support it :-(
I recall it denote a comment in arm assembler.

I could do some magic to detect the ARM case but I'm reluctant to do so.
I could also ignore the arm issue for now as it is not used by arm,
but that strikes me as the wrong approach.


	Sam

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
  2009-05-01 17:44             ` Sam Ravnborg
@ 2009-05-01 17:47               ` H. Peter Anvin
  2009-05-01 23:02                 ` Andreas Schwab
  0 siblings, 1 reply; 18+ messages in thread
From: H. Peter Anvin @ 2009-05-01 17:47 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Tim Abbott, Heiko Carstens, linuxppc-dev, Paul Mackerras,
	Greg Ungerer, sparclinux, Thomas Gleixner, linux-s390,
	Jesper Nilsson, Yoshinori Sato, Helge Deller, Ingo Molnar,
	Geert Uytterhoeven, Russell King, user-mode-linux-devel,
	microblaze-uclinux, Jeff Dike, Jeff Arnold, dev-etrax,
	Mikael Starvik, Cyrill Gorcunov, Michal Simek, Waseem Daher,
	Richard Henderson, Chris Zankel, Bryan Wu, Tony Luck,
	linux-parisc, Haavard Skinnemoen, Hirokazu Takata,
	Linux kernel mailing list, Ralf Baechle, Anders Kaseorg,
	Kyle McMartin, Paul Mundt, linux-alpha, Martin Schwidefsky,
	uclinux-dist-devel, Linus Torvalds, David S. Miller

Sam Ravnborg wrote:
>>
>> What's wrong with @?
> arm does not support it :-(
> I recall it denote a comment in arm assembler.
> 
> I could do some magic to detect the ARM case but I'm reluctant to do so.
> I could also ignore the arm issue for now as it is not used by arm,
> but that strikes me as the wrong approach.
> 

If we really have to use different tokens, I would say:

#ifdef __ARM__
# define _PROGBITS %progbits	/* or whatever */
# define _NOBITS   %nobits
#else
# define _PROGBITS @progbits
# define _NOBITS   @nobits
#endif

Otherwise we probably need to ask the binutils people...

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] Add new macros for page-aligned data and bss sections.
  2009-05-01 17:47               ` H. Peter Anvin
@ 2009-05-01 23:02                 ` Andreas Schwab
  0 siblings, 0 replies; 18+ messages in thread
From: Andreas Schwab @ 2009-05-01 23:02 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-mips, linux-m68k, linux-ia64, linux-sh, Denys Vlasenko,
	Tim Abbott, Heiko Carstens, linuxppc-dev, Waseem, Paul Mackerras,
	Greg Ungerer, sparclinux, Sam Ravnborg, Bryan Wu, linux-s390,
	Jesper Nilsson, Yoshinori Sato, David S. Miller, Helge Deller,
	Ingo Molnar, Geert Uytterhoeven, Russell King,
	user-mode-linux-devel, microblaze-uclinux, Jeff Dike, Jeff Arnold,
	Michal Simek, Mikael Starvik, Cyrill Gorcunov, Thomas Gleixner,
	Daher, Richard Henderson, Chris Zankel, dev-etrax, Tony Luck,
	Haavard Skinnemoen, linux-parisc, Linux kernel mailing list,
	Ralf Baechle, Anders Kaseorg, Kyle McMartin, Paul Mundt,
	linux-alpha, Martin Schwidefsky, uclinux-dist-devel,
	Linus Torvalds, Hirokazu Takata

"H. Peter Anvin" <hpa@zytor.com> writes:

> Sam Ravnborg wrote:
>>>
>>> What's wrong with @?
>> arm does not support it :-(
>> I recall it denote a comment in arm assembler.
>> 
>> I could do some magic to detect the ARM case but I'm reluctant to do so.
>> I could also ignore the arm issue for now as it is not used by arm,
>> but that strikes me as the wrong approach.
>> 
>
> If we really have to use different tokens, I would say:
>
> #ifdef __ARM__
> # define _PROGBITS %progbits	/* or whatever */
> # define _NOBITS   %nobits
> #else
> # define _PROGBITS @progbits
> # define _NOBITS   @nobits
> #endif

GAS has always supported both '@' and '%', so '%' can be used
everywhere.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2009-05-01 23:02 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-30 19:54 [PATCH v2 0/6] macros for section name cleanup Tim Abbott
2009-04-30 19:54 ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Tim Abbott
2009-04-30 19:54   ` [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro Tim Abbott
2009-04-30 19:54     ` [PATCH v2 3/6] Add new CACHELINE_ALIGNED_DATA " Tim Abbott
2009-04-30 19:54       ` [PATCH v2 4/6] Add new INIT_TASK_DATA() " Tim Abbott
2009-04-30 19:54         ` [PATCH v2 5/6] Add new READ_MOSTLY_DATA(align) " Tim Abbott
2009-04-30 19:54           ` [PATCH v2 6/6] Add support for __read_mostly to linux/cache.h Tim Abbott
2009-05-01  9:21     ` [PATCH v2 2/6] Add new NOSAVE_DATA linker script macro Sam Ravnborg
2009-05-01  9:18   ` [PATCH v2 1/6] Add new macros for page-aligned data and bss sections Sam Ravnborg
2009-05-01 13:54     ` Tim Abbott
2009-05-01 16:33       ` H. Peter Anvin
2009-05-01 17:17         ` Sam Ravnborg
2009-05-01 17:18           ` H. Peter Anvin
2009-05-01 17:44             ` Sam Ravnborg
2009-05-01 17:47               ` H. Peter Anvin
2009-05-01 23:02                 ` Andreas Schwab
2009-05-01  9:04 ` [PATCH v2 0/6] macros for section name cleanup Sam Ravnborg
2009-05-01 14:21 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).