]> xenbits.xensource.com Git - people/julieng/xen-unstable.git/commitdiff
x86: generate labels at the beginning of unlikely sub-sections
authorJan Beulich <jbeulich@suse.com>
Tue, 15 Dec 2015 13:15:43 +0000 (14:15 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Dec 2015 13:15:43 +0000 (14:15 +0100)
This is to limit symbol table growth, which would be quite a bit worse
if we went with the "label every unlikely sub-section contribution"
approach proposed previously.

Older gas doesn't support quoted symbols, yet the result looks quite
bit better that way. Hence two variants get introduced, one using
proper path names (including slashes and dashes) and one using path
names after converting them to valid symbol names (slashes and dashes
replaced).

As a secondary adjustment also change the section name used with Clang.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper@citrix.com>
xen/arch/x86/Rules.mk
xen/include/asm-x86/asm_defns.h

index 5b8eaedb91166ce22df3fb05d3c44919215c6fa4..637d25276bb09feb5af67c7b878d121e81c41763 100644 (file)
@@ -20,6 +20,7 @@ xenoprof := y
 CFLAGS += -I$(BASEDIR)/include 
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
+CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))'
 
 # Prevent floating-point variables from creeping into Xen.
 CFLAGS += -msoft-float
@@ -29,6 +30,9 @@ $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-insn-check,CFLAGS,CC,"vmcall",-DHAVE_GAS_VMX)
 $(call as-insn-check,CFLAGS,CC,"invept (%rax)$$(comma)%rax",-DHAVE_GAS_EPT)
 $(call as-insn-check,CFLAGS,CC,"rdfsbase %rax",-DHAVE_GAS_FSGSBASE)
+$(call as-insn-check,CFLAGS,CC,".equ \"x\"$$(comma)1", \
+                     -U__OBJECT_LABEL__ -DHAVE_GAS_QUOTED_SYM \
+                     '-D__OBJECT_LABEL__=$(subst $(BASEDIR)/,,$(CURDIR))/$$@')
 
 x86 := y
 x86_32 := n
index 95ea21debebec39a7c0a0cdf4e3ddd08baef8686..7cf440846dec559247f00aac6a2270cf0c7cd621 100644 (file)
@@ -93,10 +93,24 @@ void ret_from_intr(void);
 
 #ifdef __ASSEMBLY__
 
+#ifdef HAVE_GAS_QUOTED_SYM
+#define SUBSECTION_LBL(tag)                        \
+        .ifndef .L.tag;                            \
+        .equ .L.tag, 1;                            \
+        .equ __stringify(__OBJECT_LABEL__.tag), .; \
+        .endif
+#else
+#define SUBSECTION_LBL(tag)                        \
+        .ifndef __OBJECT_LABEL__.tag;              \
+        __OBJECT_LABEL__.tag:;                     \
+        .endif
+#endif
+
 #define UNLIKELY_START(cond, tag) \
         .Ldispatch.tag:           \
         j##cond .Lunlikely.tag;   \
         .subsection 1;            \
+        SUBSECTION_LBL(unlikely); \
         .Lunlikely.tag:
 
 #define UNLIKELY_DISPATCH_LABEL(tag) \
@@ -141,9 +155,22 @@ void ret_from_intr(void);
 
 #else
 
+#ifdef HAVE_GAS_QUOTED_SYM
+#define SUBSECTION_LBL(tag)                                          \
+        ".ifndef .L." #tag "\n\t"                                    \
+        ".equ .L." #tag ", 1\n\t"                                    \
+        ".equ \"" __stringify(__OBJECT_LABEL__) "." #tag "\", .\n\t" \
+        ".endif"
+#else
+#define SUBSECTION_LBL(tag)                                          \
+        ".ifndef " __stringify(__OBJECT_LABEL__) "." #tag "\n\t"     \
+        __stringify(__OBJECT_LABEL__) "." #tag ":\n\t"               \
+        ".endif"
+#endif
+
 #ifdef __clang__ /* clang's builtin assember can't do .subsection */
 
-#define UNLIKELY_START_SECTION ".pushsection .fixup,\"ax\""
+#define UNLIKELY_START_SECTION ".pushsection .text.unlikely,\"ax\""
 #define UNLIKELY_END_SECTION   ".popsection"
 
 #else
@@ -155,7 +182,8 @@ void ret_from_intr(void);
 
 #define UNLIKELY_START(cond, tag)          \
         "j" #cond " .Lunlikely%=.tag;\n\t" \
-        UNLIKELY_START_SECTION "\n"        \
+        UNLIKELY_START_SECTION "\n\t"      \
+        SUBSECTION_LBL(unlikely) "\n"      \
         ".Lunlikely%=.tag:"
 
 #define UNLIKELY_END(tag)                  \