2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-26 14:14:01 +08:00
linux-next/arch/s390/include/asm/dwarf.h
Hendrik Brueckner 7bceec4e58 s390/vdso: revise CFI annotations of vDSO functions
Revise and add CFI CFA and register rule annotations to the vDSO
functions for proper stack unwinding and debugging.

Because glibc might call the vDSO in special ways, the vDSO code
does not rely on a stack frame created by the caller.  The TOD clock
value can be therefore not stored in the pre-allocated stack area
and additional stack space is required.
To correctly annotate these situations with CFI, the .cfi_val_offset
directive is required to create relative offsets on the value of the
stack register %r15.  Because the .cfi_val_offset directive is
available with recent GNU assembler versions only, additional checks
are necessary.

Note that if the vDSO is assembled with an older assembler version,
stack unwinding and debugging from within the vDSO code might not
be possible.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2017-12-13 10:51:36 +01:00

38 lines
912 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_S390_DWARF_H
#define _ASM_S390_DWARF_H
#ifdef __ASSEMBLY__
#define CFI_STARTPROC .cfi_startproc
#define CFI_ENDPROC .cfi_endproc
#define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset
#define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset
#define CFI_RESTORE .cfi_restore
#ifdef CONFIG_AS_CFI_VAL_OFFSET
#define CFI_VAL_OFFSET .cfi_val_offset
#else
#define CFI_VAL_OFFSET #
#endif
#ifndef BUILD_VDSO
/*
* Emit CFI data in .debug_frame sections and not in .eh_frame
* sections. The .eh_frame CFI is used for runtime unwind
* information that is not being used. Hence, vmlinux.lds.S
* can discard the .eh_frame sections.
*/
.cfi_sections .debug_frame
#else
/*
* For vDSO, emit CFI data in both, .eh_frame and .debug_frame
* sections.
*/
.cfi_sections .eh_frame, .debug_frame
#endif
#endif /* __ASSEMBLY__ */
#endif /* _ASM_S390_DWARF_H */