function align (-falign-functions) didn't work properly in combination with -mpoke-function-name

Bug #1777281 reported by jdobry on 2018-06-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Undecided
Unassigned

Bug Description

function align (-falign-functions) didn't work properly in combination with -mpoke-function-name
In this case linker align beginning of function name not function itself.

Here is commented example of disassembled result (-falign-functions=8 -mpoke-function-name)

  102eb0: bdf8 pop {r3, r4, r5, r6, r7, pc} # end of previous code
  102eb2: bf00 nop # align
  102eb4: f3af 8000 nop.w # align
  102eb8: 6b707269 .word 0x6b707269 # function name string aligned to 8 bytes / 64 bits
  102ebc: 6e744865 .word 0x6e744865
  102ec0: 78553332 .word 0x78553332
  102ec4: 00 .byte 0x00 # string termination char
  102ec5: 00 .byte 0x00 # 32 bit align first part
  102ec6: bf00 nop # 32 bit align second part
  102ec8: ff000010 .word 0xff000010 # 32 bit aligned function name offset

00102ecc <kprintHexU32>: # !!! 32bit aligned function, but I request 64 bit aligment !!!

Reason why we need align source is minor speedup of code.
Current high frequency MCU running from flash have bottleneck on flash access. It is compensated by wide flash bus (in my case 64 bits). First instructions of function could be executed without additional wait states only when it could be loaded together. This is reason, why we need it aligned to 8 bytes (64 bits). Difference is not big, only 0.5% - 1% performance impact. But any performance improvement could be significant.

Used compiler is ARM GCC 7-2017q4-major with Cortex-R(4 or 5). But it is not significant. Relevant function is gcc-arm-none-eabi-7-2017-q4-major/src/gcc/gcc/config/arm/arm.c function arm_poke_function_name.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers