On Wed, Apr 29, 2015 at 7:47 PM, Uros Bizjak <ubiz...@gmail.com> wrote:
> On Wed, Apr 29, 2015 at 7:38 PM, Caroline Tice <cmt...@google.com> wrote:
>> The attached patch can revert the previous patch, if that is the way
>> we should proceed on this.  If you want me to apply the reversion,
>> please let me know.
>>
>> I would be happy to fix to the problem, rather than just reverting the
>> patch, but I do not have expertise in assembly language on other
>> platforms, so I would need some help, if anyone would be interested in
>> helping me?
>
> How about adding ASM_DECLARE_COLD_FUNCTION_NAME and
> ASM_DECLARE_COLD_FUNCTION_SIZE? If these are defined, they can be used
> instead, and targets are free to define them in any way.

Something like the attached prototype RFC patch. Using this patch,
readelf -sW returns:

Symbol table '.symtab' contains 18 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    3
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4
     4: 0000000000000000     0 SECTION LOCAL  DEFAULT    5
     5: 0000000000000000     0 SECTION LOCAL  DEFAULT    6
     6: 0000000000000000     0 SECTION LOCAL  DEFAULT    8
     7: 0000000000000000     8 FUNC    LOCAL  DEFAULT    6 main.cold.0
     8: 0000000000000000     0 SECTION LOCAL  DEFAULT   10
     9: 0000000000000000     0 SECTION LOCAL  DEFAULT   13
    10: 0000000000000000     0 SECTION LOCAL  DEFAULT   12
    11: 0000000000000000   312 FUNC    GLOBAL DEFAULT [<other>: 88]     8 main
    12: 0000000000000008   160 OBJECT  GLOBAL DEFAULT  COM buf
    13: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND memset
    14: 0000000000000000    44 FUNC    GLOBAL DEFAULT [<other>: 88]     1 sub2
    15: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND strcmp
    16: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND exit
    17: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND abort

Uros.
Index: config/elfos.h
===================================================================
--- config/elfos.h      (revision 222585)
+++ config/elfos.h      (working copy)
@@ -284,6 +284,17 @@ see the files COPYING3 and COPYING.RUNTIME respect
   while (0)
 #endif
 
+#ifndef ASM_DECLARE_COLD_FUNCTION_NAME
+#define ASM_DECLARE_COLD_FUNCTION_NAME(FILE, NAME, DECL)       \
+  do                                                           \
+    {                                                          \
+      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");      \
+      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));           \
+      ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL);            \
+    }                                                          \
+  while (0)
+#endif
+
 /* Write the extra assembler code needed to declare an object properly.  */
 
 #ifdef HAVE_GAS_GNU_UNIQUE_OBJECT
@@ -358,6 +369,16 @@ see the files COPYING3 and COPYING.RUNTIME respect
   while (0)
 #endif
 
+#ifndef ASM_DECLARE_COLD_FUNCTION_SIZE
+#define ASM_DECLARE_COLD_FUNCTION_SIZE(FILE, FNAME, DECL)      \
+  do                                                           \
+    {                                                          \
+      if (!flag_inhibit_size_directive)                                \
+       ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);                 \
+    }                                                          \
+  while (0)
+#endif
+
 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
    ASM_OUTPUT_LIMITED_STRING macros.  Each byte in the table
    corresponds to a particular byte value [0..255].  For any
Index: final.c
===================================================================
--- final.c     (revision 222585)
+++ final.c     (working copy)
@@ -2235,10 +2235,10 @@ final_scan_insn (rtx_insn *insn, FILE *file, int o
            {
              cold_function_name
                = clone_function_name (current_function_decl, "cold");
-#ifdef ASM_DECLARE_FUNCTION_NAME
-             ASM_DECLARE_FUNCTION_NAME (asm_out_file,
-                                        IDENTIFIER_POINTER 
(cold_function_name),
-                                        current_function_decl);
+#ifdef ASM_DECLARE_COLD_FUNCTION_NAME
+             ASM_DECLARE_COLD_FUNCTION_NAME
+               (asm_out_file, IDENTIFIER_POINTER (cold_function_name),
+                current_function_decl);
 #else
              ASM_OUTPUT_LABEL (asm_out_file,
                                IDENTIFIER_POINTER (cold_function_name));
Index: varasm.c
===================================================================
--- varasm.c    (revision 222585)
+++ varasm.c    (working copy)
@@ -1864,11 +1864,10 @@ assemble_end_function (tree decl, const char *fnna
 
       save_text_section = in_section;
       switch_to_section (unlikely_text_section ());
-#ifdef ASM_DECLARE_FUNCTION_SIZE
+#ifdef ASM_DECLARE_COLD_FUNCTION_SIZE
       if (cold_function_name != NULL_TREE)
-       ASM_DECLARE_FUNCTION_SIZE (asm_out_file,
-                                  IDENTIFIER_POINTER (cold_function_name),
-                                  decl);
+       ASM_DECLARE_COLD_FUNCTION_SIZE
+         (asm_out_file, IDENTIFIER_POINTER (cold_function_name), decl);
 #endif
       ASM_OUTPUT_LABEL (asm_out_file, 
crtl->subsections.cold_section_end_label);
       if (first_function_block_is_cold)

Reply via email to