[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/30957] New: aarch64: unnecessary bti veneer
From: |
nsz at gcc dot gnu.org |
Subject: |
[Bug ld/30957] New: aarch64: unnecessary bti veneer |
Date: |
Tue, 10 Oct 2023 14:02:09 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=30957
Bug ID: 30957
Summary: aarch64: unnecessary bti veneer
Product: binutils
Version: 2.41
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: nsz at gcc dot gnu.org
Target Milestone: ---
bti veneer is only needed if the target instruction is not bti (or
paciasp,...), but bfd ld sometimes emits the veneer unnecessarily. (gnu
property is for BTI marking)
(introduced by the fix for bug 30076 and causes large number of bti veneers in
large executables that uncovered other veneer issues see bug 30930 )
$ cat a.s
.section .a.text,"ax",@progbits
.align 2
.global a_func
.type a_func, %function
a_func:
hint 34 // bti c
b b_func
.section .note.gnu.property,"a"
.align 3
.word 4
.word 16
.word 5
.string "GNU"
.word 3221225472
.word 4
.word 1
.align 3
$ cat b.s
.section .b.text,"ax",@progbits
.align 2
.global b_func
.type b_func, %function
nop // offset the function so it is not at section start
b_func:
hint 34 // bti c
ret
.global _start
.type _start, %function
_start:
b a_func
.section .note.gnu.property,"a"
.align 3
.word 4
.word 16
.word 5
.string "GNU"
.word 3221225472
.word 4
.word 1
.align 3
$ as -o a.o a.s
$ as -o b.o b.s
$ ld --section-start=.a.text=0x00040000 --section-start=.b.text=0x08041000 a.o
b.o
$ objdump -d a.out
a.out: file format elf64-littleaarch64
Disassembly of section .a.text:
0000000000040000 <a_func>:
40000: d503245f bti c
40004: 14000005 b 40018 <__b_func_veneer>
40008: 1400000a b 40030 <__b_func_veneer+0x18>
4000c: d503201f nop
0000000000040010 <__a_func_bti_veneer>:
40010: d503245f bti c
40014: 17fffffb b 40000 <a_func>
0000000000040018 <__b_func_veneer>:
40018: b0040010 adrp x16, 8041000 <__bss_end__+0x7c30e88>
4001c: 9100c210 add x16, x16, #0x30
40020: d61f0200 br x16
...
Disassembly of section .b.text:
0000000008041000 <b_func-0x4>:
8041000: d503201f nop
0000000008041004 <b_func>:
8041004: d503245f bti c
8041008: d65f03c0 ret
000000000804100c <_start>:
804100c: 14000003 b 8041018 <__a_func_veneer>
8041010: 1400000a b 8041038 <__b_func_bti_veneer+0x8>
8041014: d503201f nop
0000000008041018 <__a_func_veneer>:
8041018: f0fbfff0 adrp x16, 40000 <a_func>
804101c: 91004210 add x16, x16, #0x10
8041020: d61f0200 br x16
...
0000000008041030 <__b_func_bti_veneer>:
8041030: d503245f bti c
8041034: 17fffff4 b 8041004 <b_func>
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/30957] New: aarch64: unnecessary bti veneer,
nsz at gcc dot gnu.org <=