aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Abbott <tabbott@MIT.EDU>2009-04-25 22:10:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-26 12:20:38 -0400
commitc80d471a476b6d6fe0bc1fd25293c24c66b7aaaf (patch)
treee7e6cf35915186c614728dadbd95c5197bff0075
parent0c8454f56623505a99463405fd7d5664adfbb094 (diff)
Add new HEAD_TEXT_SECTION macro.
This patch is preparation for replacing all uses of ".head.text" or ".text.head" in the kernel with macros, so that the section name can later be changed without having to touch a lot of the kernel. Since some linker scripts do more complex things than referencing HEAD_TEXT, we add a HEAD_TEXT_SECTION macro that just contains the actual name. I've defined HEAD_TEXT_SECTION in a new header, include/linux/section-names.h, so that this section name only needs to appear in one place. I anticipate creating similar macro structures for a number of other section names. 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 ".text.foo". Signed-off-by: Tim Abbott <tabbott@mit.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/asm-generic/vmlinux.lds.h4
-rw-r--r--include/linux/init.h4
-rw-r--r--include/linux/section-names.h6
3 files changed, 12 insertions, 2 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 7fa660fd449c..eaa06ef6f7d9 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -1,3 +1,5 @@
1#include <linux/section-names.h>
2
1#ifndef LOAD_OFFSET 3#ifndef LOAD_OFFSET
2#define LOAD_OFFSET 0 4#define LOAD_OFFSET 0
3#endif 5#endif
@@ -331,7 +333,7 @@
331#endif 333#endif
332 334
333/* Section used for early init (in .S files) */ 335/* Section used for early init (in .S files) */
334#define HEAD_TEXT *(.head.text) 336#define HEAD_TEXT *(HEAD_TEXT_SECTION)
335 337
336/* init and exit section handling */ 338/* init and exit section handling */
337#define INIT_DATA \ 339#define INIT_DATA \
diff --git a/include/linux/init.h b/include/linux/init.h
index f121a7a10c3d..20a1334e34e9 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -2,6 +2,8 @@
2#define _LINUX_INIT_H 2#define _LINUX_INIT_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/section-names.h>
6#include <linux/stringify.h>
5 7
6/* These macros are used to mark some functions or 8/* These macros are used to mark some functions or
7 * initialized data (doesn't apply to uninitialized data) 9 * initialized data (doesn't apply to uninitialized data)
@@ -107,7 +109,7 @@
107#define __memexitconst __section(.memexit.rodata) 109#define __memexitconst __section(.memexit.rodata)
108 110
109/* For assembly routines */ 111/* For assembly routines */
110#define __HEAD .section ".head.text","ax" 112#define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax"
111#define __INIT .section ".init.text","ax" 113#define __INIT .section ".init.text","ax"
112#define __FINIT .previous 114#define __FINIT .previous
113 115
diff --git a/include/linux/section-names.h b/include/linux/section-names.h
new file mode 100644
index 000000000000..c956f4eb2adf
--- /dev/null
+++ b/include/linux/section-names.h
@@ -0,0 +1,6 @@
1#ifndef __LINUX_SECTION_NAMES_H
2#define __LINUX_SECTION_NAMES_H
3
4#define HEAD_TEXT_SECTION .head.text
5
6#endif /* !__LINUX_SECTION_NAMES_H */