https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88345
--- Comment #11 from Mark Rutland <mark at kernel dot org> ---
Further, at `-O1` and above GCC seems to silently drop the alignment of any
implementation of abort(), apparently implicitly marking it as cold.
I assume that may be true for other special functions.
For example:
[mark@lakrids:/mnt/data/tests/gcc-alignment]% cat abort.c
void abort(void)
{
__builtin_trap();
}
[mark@lakrids:/mnt/data/tests/gcc-alignment]% usekorg 12.1.0 aarch64-linux-gcc
-falign-functions=16 -c abort.c -O2
[mark@lakrids:/mnt/data/tests/gcc-alignment]% usekorg 12.1.0
aarch64-linux-objdump -d abort.o
abort.o: file format elf64-littleaarch64
Disassembly of section .text.unlikely:
0000000000000000 <abort>:
0: d4207d00 brk #0x3e8
[mark@lakrids:/mnt/data/tests/gcc-alignment]% usekorg 12.1.0
aarch64-linux-objdump -h abort.o
abort.o: file format elf64-littleaarch64
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000000 0000000000000000 0000000000000000 00000040 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 0000000000000000 0000000000000000 00000040 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 0000000000000000 0000000000000000 00000040 2**0
ALLOC
3 .text.unlikely 00000004 0000000000000000 0000000000000000 00000040 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 .comment 00000013 0000000000000000 0000000000000000 00000044 2**0
CONTENTS, READONLY
5 .note.GNU-stack 00000000 0000000000000000 0000000000000000 00000057
2**0
CONTENTS, READONLY
6 .eh_frame 00000028 0000000000000000 0000000000000000 00000058 2**3
CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA