+ /* Make sure the not and cold text (code) sections are properly
+ aligned. This is necessary here in the case where the function
+ has both hot and cold sections, because we don't want to re-set
+ the alignment when the section switch happens mid-function. */
+
+ if (flag_reorder_blocks_and_partition)
+ {
+ unlikely_text_section ();
+ assemble_align (FUNCTION_BOUNDARY);
+ ASM_OUTPUT_LABEL (asm_out_file, cfun->cold_section_label);
+ if (BB_PARTITION (ENTRY_BLOCK_PTR->next_bb) == BB_COLD_PARTITION)
+ {
+ /* Since the function starts with a cold section, we need to
+ explicitly align the hot section and write out the hot
+ section label. */
+ text_section ();
+ assemble_align (FUNCTION_BOUNDARY);
+ ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_label);
+ hot_label_written = true;
+ first_function_block_is_cold = true;
+ }
+ }
+ else if (DECL_SECTION_NAME (decl))
+ {
+ /* Calls to function_section rely on first_function_block_is_cold
+ being accurate. The first block may be cold even if we aren't
+ doing partitioning, if the entire function was decided by
+ choose_function_section (predict.c) to be cold. */
+
+ int i;
+ int len;
+ char *s;
+
+ initialize_cold_section_name ();
+
+ /* The following is necessary, because 'strcmp
+ (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)), blah)' always
+ fails, presumably because TREE_STRING_POINTER is declared to
+ be an array of size 1 of char. */
+
+ len = TREE_STRING_LENGTH (DECL_SECTION_NAME (decl));
+ s = (char *) xmalloc (len + 1);
+
+ for (i = 0; i < len; i ++)
+ s[i] = (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)))[i];
+ s[len] = '\0';
+
+ if (cfun->unlikely_text_section_name
+ && (strcmp (s, cfun->unlikely_text_section_name) == 0))
+ first_function_block_is_cold = true;
+ }
+
+ last_text_section = no_section;