On 1/2/24 12:41, Ilya Leoshkevich wrote:
GCC can emit code between the function label and the .LASANPC label,
making the latter unaligned.  Some architectures cannot load unaligned
labels directly and require literal pool entries, which is inefficient.

Move the invocation of asan_function_start to
ASM_OUTPUT_FUNCTION_LABEL, which guarantees that no additional code is
emitted.  This allows setting the .LASANPC label alignment to the
respective function alignment.
---
  gcc/asan.cc             |  6 ++----
  gcc/config/i386/i386.cc |  2 +-
  gcc/config/s390/s390.cc |  2 +-
  gcc/defaults.h          |  2 +-
  gcc/final.cc            |  3 ---
  gcc/output.h            |  4 ++++
  gcc/varasm.cc           | 14 ++++++++++++++
  7 files changed, 23 insertions(+), 10 deletions(-)
So this needs a ChangeLog obviously. I assume you've tested on s390[x]. It should also be tested on x86 since it's the only other platform that redefined ASM_OUTPUT_FUNCTION_LABEL.

Assuming those tests pass without regression, then this is fine for the trunk.

Thanks,
Jeff

Reply via email to