diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2023-12-07 13:08:27 +0100 |
---|---|---|
committer | Ilya Leoshkevich <iii@linux.ibm.com> | 2024-01-05 12:24:01 +0100 |
commit | e66dc37b299cac4171b1c5b90cf6b54388bd5bc5 (patch) | |
tree | ff5a38a90075021d3262b0b4a536ba23b7665b33 /gcc/config | |
parent | c659dd8bfb55e02a1b97407c1c28f7a0e8f7f09b (diff) | |
download | gcc-e66dc37b299cac4171b1c5b90cf6b54388bd5bc5.zip gcc-e66dc37b299cac4171b1c5b90cf6b54388bd5bc5.tar.gz gcc-e66dc37b299cac4171b1c5b90cf6b54388bd5bc5.tar.bz2 |
asan: Align .LASANPC on function boundary
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.
Link: https://inbox.sourceware.org/gcc-patches/20240102194511.3171559-3-iii@linux.ibm.com/
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
gcc/ChangeLog:
* asan.cc (asan_function_start): Drop switch_to_section ().
(asan_emit_stack_protection): Set .LASANPC alignment.
* config/i386/i386.cc: Use assemble_function_label_raw ()
instead of ASM_OUTPUT_LABEL ().
* config/s390/s390.cc (s390_asm_output_function_label):
Likewise.
* defaults.h (ASM_OUTPUT_FUNCTION_LABEL): Likewise.
* final.cc (final_start_function_1): Drop
asan_function_start ().
* output.h (assemble_function_label_raw): New function.
* varasm.cc (assemble_function_label_raw): Likewise.
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/i386/i386.cc | 2 | ||||
-rw-r--r-- | gcc/config/s390/s390.cc | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index e3636e1..8010532 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -1640,7 +1640,7 @@ ix86_asm_output_function_label (FILE *out_file, const char *fname, SUBTARGET_ASM_UNWIND_INIT (out_file); #endif - ASM_OUTPUT_LABEL (out_file, fname); + assemble_function_label_raw (out_file, fname); /* Output magic byte marker, if hot-patch attribute is set. */ if (is_ms_hook) diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc index 116fdc6..748ad9c 100644 --- a/gcc/config/s390/s390.cc +++ b/gcc/config/s390/s390.cc @@ -8323,7 +8323,7 @@ s390_asm_output_function_label (FILE *out_file, const char *fname, asm_fprintf (out_file, "\t# fn:%s wd%d\n", fname, s390_warn_dynamicstack_p); } - ASM_OUTPUT_LABEL (out_file, fname); + assemble_function_label_raw (out_file, fname); if (hw_after > 0) asm_fprintf (out_file, "\t# post-label NOPs for hotpatch (%d halfwords)\n", |