Commit c80d471a authored by Tim Abbott's avatar Tim Abbott Committed by Linus Torvalds

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: default avatarTim Abbott <tabbott@mit.edu>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0c8454f5
#include <linux/section-names.h>
#ifndef LOAD_OFFSET #ifndef LOAD_OFFSET
#define LOAD_OFFSET 0 #define LOAD_OFFSET 0
#endif #endif
...@@ -331,7 +333,7 @@ ...@@ -331,7 +333,7 @@
#endif #endif
/* Section used for early init (in .S files) */ /* Section used for early init (in .S files) */
#define HEAD_TEXT *(.head.text) #define HEAD_TEXT *(HEAD_TEXT_SECTION)
/* init and exit section handling */ /* init and exit section handling */
#define INIT_DATA \ #define INIT_DATA \
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#define _LINUX_INIT_H #define _LINUX_INIT_H
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/section-names.h>
#include <linux/stringify.h>
/* These macros are used to mark some functions or /* These macros are used to mark some functions or
* initialized data (doesn't apply to uninitialized data) * initialized data (doesn't apply to uninitialized data)
...@@ -107,7 +109,7 @@ ...@@ -107,7 +109,7 @@
#define __memexitconst __section(.memexit.rodata) #define __memexitconst __section(.memexit.rodata)
/* For assembly routines */ /* For assembly routines */
#define __HEAD .section ".head.text","ax" #define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax"
#define __INIT .section ".init.text","ax" #define __INIT .section ".init.text","ax"
#define __FINIT .previous #define __FINIT .previous
......
#ifndef __LINUX_SECTION_NAMES_H
#define __LINUX_SECTION_NAMES_H
#define HEAD_TEXT_SECTION .head.text
#endif /* !__LINUX_SECTION_NAMES_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment