Merge "Fix assembler warnings." into main am: 5c73b4f984

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2701796

Change-Id: I3bde03ae52583706ec70bf87cb6a25647d9825e4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Elliott Hughes 2024-01-24 16:42:58 +00:00 committed by Automerger Merge Worker
commit eebbd1db0f
13 changed files with 90 additions and 105 deletions

View file

@ -47,7 +47,7 @@
.save {r0-r15}
.pad #32
nop
ENTRY_PRIVATE_NO_DWARF(__restore)
ENTRY_NO_DWARF_PRIVATE(__restore)
// This function must have exactly this instruction sequence.
mov r7, #__NR_sigreturn
swi #0
@ -57,7 +57,7 @@ END_NO_DWARF(__restore)
.save {r0-r15}
.pad #160
nop
ENTRY_PRIVATE_NO_DWARF(__restore_rt)
ENTRY_NO_DWARF_PRIVATE(__restore_rt)
// This function must have exactly this instruction sequence.
mov r7, #__NR_rt_sigreturn
swi #0

View file

@ -75,14 +75,12 @@
#define _JB_CORE_BASE (_JB_FLOAT_STATE+1)
#define _JB_CHECKSUM (_JB_CORE_BASE+10)
ENTRY(setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(setjmp)
mov r1, #1
b sigsetjmp
END(setjmp)
ENTRY(_setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(_setjmp)
mov r1, #0
b sigsetjmp
END(_setjmp)
@ -96,8 +94,7 @@ END(_setjmp)
.endm
// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(sigsetjmp)
stmfd sp!, {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
@ -187,8 +184,7 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
END(sigsetjmp)
// void siglongjmp(sigjmp_buf env, int value);
ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(siglongjmp)
stmfd sp!, {r0, r1, lr}
.cfi_def_cfa_offset 12
.cfi_rel_offset r0, 0
@ -269,7 +265,5 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
bx lr
END(siglongjmp)
ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(longjmp, siglongjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(_longjmp, siglongjmp)

View file

@ -29,8 +29,7 @@
#include <platform/bionic/tls_defines.h>
#include <private/bionic_asm.h>
ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(vfork)
// r3 = &__get_tls()[TLS_SLOT_THREAD_ID]
mrc p15, 0, r3, c13, c0, 3
ldr r3, [r3, #(TLS_SLOT_THREAD_ID * 4)]

View file

@ -95,21 +95,18 @@
m_mangle_registers \reg, sp_reg=\sp_reg
.endm
ENTRY(setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(setjmp)
mov w1, #1
b sigsetjmp
END(setjmp)
ENTRY(_setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(_setjmp)
mov w1, #0
b sigsetjmp
END(_setjmp)
// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(sigsetjmp)
paciasp
.cfi_negate_ra_state
stp x0, x30, [sp, #-16]!
@ -185,8 +182,7 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
END(sigsetjmp)
// void siglongjmp(sigjmp_buf env, int value);
ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(siglongjmp)
// Check the checksum before doing anything.
m_calculate_checksum x12, x0, x2
ldr x2, [x0, #(_JB_CHECKSUM * 8)]
@ -290,9 +286,7 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
ret
END(siglongjmp)
ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(longjmp, siglongjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(_longjmp, siglongjmp)
NOTE_GNU_PROPERTY()

View file

@ -32,8 +32,7 @@
#include <asm/signal.h>
#include <linux/sched.h>
ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(vfork)
// x9 = __get_tls()[TLS_SLOT_THREAD_ID]
mrs x9, tpidr_el0
ldr x9, [x9, #(TLS_SLOT_THREAD_ID * 8)]

View file

@ -107,21 +107,18 @@
m_mangle_registers \reg, sp_reg=\sp_reg
.endm
ENTRY(setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(setjmp)
li a1, 1
tail sigsetjmp
END(setjmp)
ENTRY(_setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(_setjmp)
li a1, 0
tail sigsetjmp
END(_setjmp)
// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(sigsetjmp)
addi sp, sp, -24
sd a0, 0(sp)
sd a1, 8(sp)
@ -204,8 +201,7 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
END(sigsetjmp)
// void siglongjmp(sigjmp_buf env, int value);
ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(siglongjmp)
// Check the checksum before doing anything.
m_calculate_checksum t0, a0, t1
ld t1, _JB_CHECKSUM(a0)
@ -298,7 +294,5 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
call __bionic_setjmp_checksum_mismatch
END(siglongjmp)
ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(longjmp, siglongjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(_longjmp, siglongjmp)

View file

@ -74,18 +74,18 @@
.cfi_signal_frame
RESTORE_GPRS(4)
nop // See comment in libc/arch-x86_64/bionic/__restore_rt.S about this nop.
ENTRY_PRIVATE_NO_DWARF(__restore)
ENTRY_NO_DWARF_PRIVATE(__restore)
popl %eax
RESTORE_GPRS(0)
movl $__NR_sigreturn, %eax
int $0x80
END(__restore)
END(__restore) // Not END_NO_DWARF because we _manually_ set up CFI.
.cfi_startproc
.cfi_signal_frame
RESTORE_GPRS(160)
nop // See comment in libc/arch-x86_64/bionic/__restore_rt.S about this nop.
ENTRY_PRIVATE_NO_DWARF(__restore_rt)
ENTRY_NO_DWARF_PRIVATE(__restore_rt)
movl $__NR_rt_sigreturn, %eax
int $0x80
END(__restore_rt)
END(__restore_rt) // Not END_NO_DWARF because we _manually_ set up CFI.

View file

@ -64,22 +64,19 @@
.endr
.endm
ENTRY(setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(setjmp)
movl 4(%esp),%ecx
mov $1,%eax
jmp .L_sigsetjmp
END(setjmp)
ENTRY(_setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(_setjmp)
movl 4(%esp),%ecx
movl $0,%eax
jmp .L_sigsetjmp
END(_setjmp)
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(sigsetjmp)
movl 4(%esp),%ecx
movl 8(%esp),%eax
@ -135,8 +132,7 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
ret
END(sigsetjmp)
ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(siglongjmp)
movl 4(%esp),%edx
// Check the checksum before doing anything.
@ -210,7 +206,5 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
call PIC_PLT(__bionic_setjmp_checksum_mismatch)
END(siglongjmp)
ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(longjmp, siglongjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(_longjmp, siglongjmp)

View file

@ -31,8 +31,7 @@
// This custom code preserves the return address across the system call.
ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(vfork)
popl %ecx // Grab the return address.
.cfi_adjust_cfa_offset 4
.cfi_rel_offset ecx, 0

View file

@ -109,7 +109,7 @@
// Restoring RSP is unnecessary as the unwinder simply uses the CFA value.
RESTORE_GPR(RIP)
nop
ENTRY_PRIVATE_NO_DWARF(__restore_rt)
ENTRY_NO_DWARF_PRIVATE(__restore_rt)
mov $__NR_rt_sigreturn, %rax
syscall
END(__restore_rt)

View file

@ -71,21 +71,18 @@
.endr
.endm
ENTRY(setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(setjmp)
movl $1,%esi
jmp PIC_PLT(sigsetjmp)
END(setjmp)
ENTRY(_setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(_setjmp)
movl $0,%esi
jmp PIC_PLT(sigsetjmp)
END(_setjmp)
// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(sigsetjmp)
pushq %rdi
movq %rsi,%rdi
call PIC_PLT(__bionic_setjmp_cookie_get)
@ -137,8 +134,7 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
END(sigsetjmp)
// void siglongjmp(sigjmp_buf env, int value);
ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(siglongjmp)
movq %rdi,%r12
pushq %rsi // Push 'value'.
@ -203,7 +199,5 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
call PIC_PLT(__bionic_setjmp_checksum_mismatch)
END(siglongjmp)
ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(longjmp, siglongjmp)
ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(_longjmp, siglongjmp)

View file

@ -31,8 +31,7 @@
// This custom code preserves the return address across the system call.
ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(vfork)
popq %rdi // Grab the return address.
// Set cached_pid_ to 0, vforked_ to 1, and stash the previous value.

View file

@ -51,44 +51,63 @@
#include <private/bionic_asm_x86_64.h>
#endif
#define ENTRY_NO_DWARF(f) \
.text; \
.globl f; \
.balign __bionic_asm_align; \
.type f, __bionic_asm_function_type; \
f: \
__bionic_asm_custom_entry(f); \
// Starts a normal assembler routine.
#define ENTRY(__f) __ENTRY_WITH_BINDING(__f, .globl)
#define ENTRY(f) \
ENTRY_NO_DWARF(f) \
.cfi_startproc \
// Starts an assembler routine with hidden visibility.
#define ENTRY_PRIVATE(__f) \
__ENTRY_WITH_BINDING(__f, .globl); \
.hidden __f;
#define END_NO_DWARF(f) \
.size f, .-f; \
__bionic_asm_custom_end(f) \
// Starts an assembler routine that's weak so native bridges can override it.
#define ENTRY_WEAK_FOR_NATIVE_BRIDGE(__f) __ENTRY_WITH_BINDING(__f, .weak)
#define END(f) \
.cfi_endproc; \
END_NO_DWARF(f) \
// Starts an assembler routine with hidden visibility and no DWARF information.
// Only used for internal functions passed via sa_restorer.
// TODO: can't we just delete all those and let the kernel do its thing?
#define ENTRY_NO_DWARF_PRIVATE(__f) \
__ENTRY_NO_DWARF(__f, .globl); \
.hidden __f;
/* Like ENTRY, but with hidden visibility. */
#define ENTRY_PRIVATE(f) \
ENTRY(f); \
.hidden f \
// (Implementation detail.)
#define __ENTRY_NO_DWARF(__f, __binding) \
.text; \
__binding __f; \
.balign __bionic_asm_align; \
.type __f, __bionic_asm_function_type; \
__f: \
__bionic_asm_custom_entry(__f);
/* Like ENTRY_NO_DWARF, but with hidden visibility. */
#define ENTRY_PRIVATE_NO_DWARF(f) \
ENTRY_NO_DWARF(f); \
.hidden f \
// (Implementation detail.)
#define __ENTRY_WITH_BINDING(__f, __binding) \
__ENTRY_NO_DWARF(__f, __binding); \
.cfi_startproc;
#define __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(f) \
.weak f; \
// Ends a normal assembler routine.
#define END(__f) \
.cfi_endproc; \
END_NO_DWARF(__f)
// Ends an assembler routine with no DWARF information.
// Only used for internal functions passed via sa_restorer.
// TODO: can't we just delete all those and let the kernel do its thing?
#define END_NO_DWARF(__f) \
.size __f, .- __f; \
__bionic_asm_custom_end(__f)
// Creates an alias `alias` for the symbol `original`.
#define ALIAS_SYMBOL(alias, original) \
.globl alias; \
.equ alias, original
.globl alias; \
.equ alias, original
#define NOTE_GNU_PROPERTY() \
__bionic_asm_custom_note_gnu_section()
// Creates an alias `alias` for the symbol `original` that's weak so it can be
// separately overridden by native bridges.
#define ALIAS_SYMBOL_WEAK_FOR_NATIVE_BRIDGE(alias, original) \
.weak alias; \
.equ alias, original
// Adds a GNU property ELF note. Important on arm64 to declare PAC/BTI support.
#define NOTE_GNU_PROPERTY() __bionic_asm_custom_note_gnu_section()
// Gives local labels a more convenient and readable syntax.
#define L(__label) .L##__label