[PATCH 07/10] linkage: introduce ALIASes

From: Jiri Slaby
Date: Fri Feb 17 2017 - 05:49:43 EST


Sometimes we see in the assembly:
===
.align 4
_key_expansion_128:
ENTRY_LOCAL(_key_expansion_256a)
...
ENDPROC(_key_expansion_256a)
ENDPROC(_key_expansion_128)
=== or ===
ENTRY(__memcpy)
ENTRY(memcpy)
...
ENDPROC(memcpy)
ENDPROC(__memcpy)
===

In the former, the outer "function" (alias) _key_expansion_128 is marked
as function by ENDPROC, but there is no corresponding ENTRY for that. In
the latter, there are nested ENTRYs and ENDPROCs. And since we want them
to emit some debuginfo, the nesting makes it impossible.

Hence introduce ENTRY_ALIAS/END_ALIAS to differentiate this case --
ENTRY will emit debuginfo, ENTRY_ALIAS will not.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
include/linux/linkage.h | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index ca5d5c01009b..fe5bbdac719b 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -78,17 +78,35 @@
#define ALIGN __ALIGN
#define ALIGN_STR __ALIGN_STR

-#ifndef ENTRY_LOCAL
-#define ENTRY_LOCAL(name) \
+#ifndef ENTRY_LOCAL_ALIAS
+#define ENTRY_LOCAL_ALIAS(name) \
ALIGN ASM_NL \
name:
#endif

+#ifndef ENTRY_ALIAS
+#define ENTRY_ALIAS(name) \
+ .globl name ASM_NL \
+ ENTRY_LOCAL_ALIAS(name)
+#endif
+
+#ifndef ENTRY_LOCAL
+#define ENTRY_LOCAL(name) \
+ ENTRY_LOCAL_ALIAS(name)
+#endif
+
#ifndef ENTRY
#define ENTRY(name) \
.globl name ASM_NL \
ENTRY_LOCAL(name)
#endif
+
+#ifndef END_ALIAS
+#define END_ALIAS(name) \
+ .type name, @function ASM_NL \
+ END(name)
+#endif
+
#endif /* LINKER_SCRIPT */

#ifndef WEAK
@@ -108,8 +126,7 @@
*/
#ifndef ENDPROC
#define ENDPROC(name) \
- .type name, @function ASM_NL \
- END(name)
+ END_ALIAS(name)
#endif

#endif
--
2.11.1