This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2
- From: Christian Bruel <christian dot bruel at st dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>, <kyrylo dot tkachov at arm dot com>, <kyrylo dot tkachov at arm dot com>, <richard dot earnshaw at arm dot com>
- Date: Tue, 29 Sep 2015 15:24:02 +0200
- Subject: [PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2
- Authentication-results: sourceware.org; auth=none
This patch uses FUNCTION_BOUNDARY instead of DECL_ALIGN to check the max
align when optimizing for size in assemble_start_function.
This is necessary for ARM that can switch the max code alignment
directives between modes.
No regressions for ARM
Testing on-going for x86
Christian
2015-09-29 Christian Bruel <christian.bruel@st.com>
PR target/67745
* gcc/varasm.c (assemble_start_function): Use current's function align.
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c (revision 228229)
+++ gcc/varasm.c (working copy)
@@ -1729,7 +1729,7 @@ assemble_start_function (tree decl, cons
if (CONSTANT_POOL_BEFORE_FUNCTION)
output_constant_pool (fnname, decl);
- align = symtab_node::get (decl)->definition_alignment ();
+ align = FUNCTION_BOUNDARY;
/* Make sure the not and cold text (code) sections are properly
aligned. This is necessary here in the case where the function
@@ -1774,12 +1774,15 @@ assemble_start_function (tree decl, cons
ASM_OUTPUT_ALIGN (asm_out_file, align);
}
+ /* align_functions_log cannot exceed current function's ABI when
+ optimizing for size */
+ if (optimize_function_for_size_p (cfun))
+ align_functions_log = MIN (align_functions_log, align);
+
/* Handle a user-specified function alignment.
Note that we still need to align to DECL_ALIGN, as above,
because ASM_OUTPUT_MAX_SKIP_ALIGN might not do any alignment at all. */
- if (! DECL_USER_ALIGN (decl)
- && align_functions_log > align
- && optimize_function_for_speed_p (cfun))
+ if (! DECL_USER_ALIGN (decl) && align_functions_log > align)
{
#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file,