aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@kernel.org>2016-06-29 17:04:06 -0700
committerLuis R. Rodriguez <mcgrof@kernel.org>2016-06-29 17:29:05 -0700
commit81c47108597e52e1f4cd10786893ec9ba337b9c4 (patch)
treef459fbb74967ec5c4167d79c8bf33746222e45bb
parent31e11e2a3a34222eb781ef791e7d0515707e35bc (diff)
downloadlinker-tables-81c47108597e52e1f4cd10786893ec9ba337b9c4.tar.gz
asm-generic/sections.h: add assembler version of push_section_type()
This lets us match the style of using using push_section_type for asm volatile but for use in actual foo.S code. We keep the SECTION_TYPE() declaration as well since both tables.h and ranges.h use it for all code (C code, assembly, and assembler). We keep it as we'll also enable next extending the assembler version of push_section_type() with a flags option, SECTION_TYPE() on the assembler version can be used for when the flags is empty. While at it avoid requiring quotes for the level, this lets us match all uses of the levels for all code. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
-rw-r--r--drivers/synth/or.S10
-rw-r--r--include/asm-generic/sections.h21
-rw-r--r--include/linux/ranges.h3
-rw-r--r--include/linux/sections.h9
4 files changed, 30 insertions, 13 deletions
diff --git a/drivers/synth/or.S b/drivers/synth/or.S
index 3c6eb9f..6628007 100644
--- a/drivers/synth/or.S
+++ b/drivers/synth/or.S
@@ -2,7 +2,7 @@
DECLARE_SECTION_RANGE(SECTION_TEXT, synth_init_or)
- SECTION_RANGE(SECTION_TEXT, synth_init_or, "01")
+ push_section_rng(SECTION_TEXT, synth_init_or, 01)
/* err = 0; */
pushq %rbp
movq %rsp,%rbp
@@ -10,7 +10,7 @@
xorq %rbx,%rbx
.popsection
- SECTION_RANGE(SECTION_TEXT, synth_init_or, "99")
+ push_section_rng(SECTION_TEXT, synth_init_or, 99)
/* return err; */
movq %rbx,%rax
popq %rbx
@@ -18,21 +18,21 @@
retq
.popsection
- SECTION_RANGE(SECTION_TEXT, synth_init_or, "50")
+ push_section_rng(SECTION_TEXT, synth_init_or, 50)
/* err |= demo_or_1(1); */
movl $1,%edi
call demo_or_1
orq %rax,%rbx
.popsection
- SECTION_RANGE(SECTION_TEXT, synth_init_or, "50")
+ push_section_rng(SECTION_TEXT, synth_init_or, 50)
/* err |= demo_or_1(2); */
movl $2,%edi
call demo_or_1
orq %rax,%rbx
.popsection
- SECTION_RANGE(SECTION_TEXT, synth_init_or, "50")
+ push_section_rng(SECTION_TEXT, synth_init_or, 50)
/* err |= demo_or_2(); */
call demo_or_2
orq %rax,%rbx
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 4b042db..bd0d975 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -2,12 +2,31 @@
#define _ASM_GENERIC_SECTIONS_H_
#ifndef __ASSEMBLY__
+
#include <linux/sections.h>
+#ifdef __ASSEMBLER__
+
+#ifndef SECTION_TYPE
+#define SECTION_TYPE push_section_type
+#endif
+
+/* Used on foo.S for instance */
+#ifndef push_section_type
+#define push_section_type(section, type, name, level) \
+ .pushsection section.type.name.#level
+#endif
+
+#else /* __ASSEMBLER__ */
+
+/* Used in C code, for instance, on asm volatile() code. */
+
#ifndef __push_section_type
#define __push_section_type(section, type, name, level, flags) \
".pushsection " #section "." #type "." #name "." #level ", \"" #flags "\"\n"
-#endif
+
+#endif /* __ASSEMBLER__ */
+#endif /* __ASSEMBLY__ */
#ifndef push_section_type
#define push_section_type(section, type, name, level, flags) \
diff --git a/include/linux/ranges.h b/include/linux/ranges.h
index 6edc444..b35f1ba 100644
--- a/include/linux/ranges.h
+++ b/include/linux/ranges.h
@@ -18,6 +18,9 @@ name: ; \
SECTION_RANGE(section, name, ~) ; \
.popsection
+#define push_section_rng(section, name, level) \
+ push_section_type(section, SECTION_TYPE_RANGES, name, level)
+
#else
#ifndef __ASSEMBLY__
diff --git a/include/linux/sections.h b/include/linux/sections.h
index 36af3fa..3ba28ca 100644
--- a/include/linux/sections.h
+++ b/include/linux/sections.h
@@ -18,12 +18,7 @@
#define SECTION_REF_RODATA .ref.rodata
#define SECTION_SCHED .sched.text
-#ifdef __ASSEMBLER__
-
-#define SECTION_TYPE(section, type, name, level) \
- .pushsection section.type.name.level
-
-#else
+#ifndef __ASSEMBLER__
#define LINUX_SECTION_ALIGNMENT(name) __alignof__(*name)
#define LINUX_SECTION_SIZE(name) ((name##__end) - (name))
@@ -48,7 +43,7 @@
#define SECTION_ORDER_ANY any
-#endif /* __ASSEMBLY__ */
+#endif /* __ASSEMBLER__ */
/*
* This section is for use on linker scripts and helpers