diff options
author | Luis R. Rodriguez <mcgrof@kernel.org> | 2016-06-27 17:56:30 -0700 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@kernel.org> | 2016-06-27 17:52:55 -0700 |
commit | 3adf023d2a05a89f4851bd49fd6a3be78bb7f77f (patch) | |
tree | 60fc5f26475cad2ac9f447fc0ae0de6be79c92fb | |
parent | f92e448b26b107890a5e6fa956c8c57530128b91 (diff) | |
download | linker-tables-3adf023d2a05a89f4851bd49fd6a3be78bb7f77f.tar.gz |
ranges.h: add asm version of DECLARE_SECTION_RANGE()
This adds an asm version of DECLARE_SECTION_RANGE().
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
-rw-r--r-- | drivers/synth/or.S | 20 | ||||
-rw-r--r-- | include/linux/ranges.h | 14 | ||||
-rw-r--r-- | include/linux/sections.h | 6 |
3 files changed, 25 insertions, 15 deletions
diff --git a/drivers/synth/or.S b/drivers/synth/or.S index 5a80526..3c6eb9f 100644 --- a/drivers/synth/or.S +++ b/drivers/synth/or.S @@ -1,9 +1,8 @@ - .pushsection .init.text.rng.synth_init_or. - .globl synth_init_or -synth_init_or: - .popsection +#include <linux/ranges.h> + + DECLARE_SECTION_RANGE(SECTION_TEXT, synth_init_or) - .pushsection .init.text.rng.synth_init_or.01 + SECTION_RANGE(SECTION_TEXT, synth_init_or, "01") /* err = 0; */ pushq %rbp movq %rsp,%rbp @@ -11,10 +10,7 @@ synth_init_or: xorq %rbx,%rbx .popsection - .pushsection .init.text.rng.synth_init_or.~ - .popsection - - .pushsection .init.text.rng.synth_init_or.99 + SECTION_RANGE(SECTION_TEXT, synth_init_or, "99") /* return err; */ movq %rbx,%rax popq %rbx @@ -22,21 +18,21 @@ synth_init_or: retq .popsection - .pushsection .init.text.rng.synth_init_or.50 + SECTION_RANGE(SECTION_TEXT, synth_init_or, "50") /* err |= demo_or_1(1); */ movl $1,%edi call demo_or_1 orq %rax,%rbx .popsection - .pushsection .init.text.rng.synth_init_or.50 + SECTION_RANGE(SECTION_TEXT, synth_init_or, "50") /* err |= demo_or_1(2); */ movl $2,%edi call demo_or_1 orq %rax,%rbx .popsection - .pushsection .init.text.rng.synth_init_or.50 + SECTION_RANGE(SECTION_TEXT, synth_init_or, "50") /* err |= demo_or_2(); */ call demo_or_2 orq %rax,%rbx diff --git a/include/linux/ranges.h b/include/linux/ranges.h index 418b50e..976541e 100644 --- a/include/linux/ranges.h +++ b/include/linux/ranges.h @@ -8,6 +8,18 @@ #define SECTION_RANGE(section, name, level) \ SECTION_TYPE(section, SECTION_TYPE_RANGES, name, level) +#ifdef __ASSEMBLER__ +#define DECLARE_SECTION_RANGE(section, name) \ + SECTION_RANGE(section, name,) ; \ + .globl name ; \ +name: ; \ + .popsection \ + \ + SECTION_RANGE(section, name, ~) ; \ + .popsection + +#else + #ifndef __ASSEMBLY__ /* Linker tables shalt not use this */ @@ -47,8 +59,10 @@ __section__(SECTION_RANGE(section, name, level)))) #endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #define SECTION_RANGE_ALL(section) \ SECTION_TYPE_ALL(section,SECTION_TYPE_RANGES) + #endif /* _LINUX_RANGES_H */ diff --git a/include/linux/sections.h b/include/linux/sections.h index 1af8af1..f738844 100644 --- a/include/linux/sections.h +++ b/include/linux/sections.h @@ -16,10 +16,10 @@ #define SECTION_REF_RODATA .ref.rodata #define SECTION_SCHED .sched.text -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__ -#define SECTION_TYPE(section, type, name, level) \ - .pushsection section ## . ## type ## . ## name ## . ## level +#define SECTION_TYPE(section, type, name, level) \ + .pushsection section.type.name.level #else |