Remove superfluous RET instructions

This commit is contained in:
Justine Tunney 2023-06-06 19:46:56 -07:00
parent b6182db813
commit 9793d3524f
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
3 changed files with 9 additions and 11 deletions

View file

@ -23,9 +23,8 @@ ftrace_hook:
#ifdef __x86_64__
cmp $0,__ftrace(%rip)
jg 1f
ret
1: push %rbp
jle 1f
push %rbp
mov %rsp,%rbp
push %rax
push %rax
@ -45,16 +44,15 @@ ftrace_hook:
pop %rax
pop %rax
pop %rbp
ret
1: ret
#elif defined(__aarch64__)
adrp x9,__ftrace
ldr w9,[x9,#:lo12:__ftrace]
cmp w9,1
bge 1f
ret
1: stp x29,x30,[sp,-96]!
cmp w9,0
ble 1f
stp x29,x30,[sp,-96]!
mov x29,sp
stp x0,x1,[sp,16]
stp x2,x3,[sp,32]
@ -68,7 +66,7 @@ ftrace_hook:
ldp x2,x3,[sp,32]
ldp x0,x1,[sp,16]
ldp x29,x30,[sp],96
ret
1: ret
#endif /* __x86_64__ */
.endfn ftrace_hook,globl

View file

@ -48,9 +48,7 @@
.section .initprologue,"ax",@progbits
.type _init,@function
.globl _init
.ftrace1
_init:
.ftrace2
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp

View file

@ -68,6 +68,7 @@
"__builtin_ctzl"
"__builtin_ctzll"
"__builtin_expect"
"__builtin_memcpy"
"__builtin_expect_with_probability"
"__builtin_extract_return_addr"
"__builtin_isnan"
@ -97,6 +98,7 @@
"__builtin_trap"
"__builtin_types_compatible_p"
"__builtin_unreachable"
"__builtin_ia32_movntdq"
"__has_attribute"
"__has_builtin"
"__has_cpp_attribute"