xref: /linux/tools/perf/util/libunwind/x86_32.c (revision e5c86679d5e864947a52fb31e45a425dea3e7fa9)
1 /*
2  * This file setups defines to compile arch specific binary from the
3  * generic one.
4  *
5  * The function 'LIBUNWIND__ARCH_REG_ID' name is set according to arch
6  * name and the defination of this function is included directly from
7  * 'arch/x86/util/unwind-libunwind.c', to make sure that this function
8  * is defined no matter what arch the host is.
9  *
10  * Finally, the arch specific unwind methods are exported which will
11  * be assigned to each x86 thread.
12  */
13 
14 #define REMOTE_UNWIND_LIBUNWIND
15 
16 /* Define arch specific functions & regs for libunwind, should be
17  * defined before including "unwind.h"
18  */
19 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__x86_reg_id(regnum)
20 #define LIBUNWIND__ARCH_REG_IP PERF_REG_X86_IP
21 #define LIBUNWIND__ARCH_REG_SP PERF_REG_X86_SP
22 
23 #include "unwind.h"
24 #include "debug.h"
25 #include "libunwind-x86.h"
26 #include <../../../../arch/x86/include/uapi/asm/perf_regs.h>
27 
28 /* HAVE_ARCH_X86_64_SUPPORT is used in'arch/x86/util/unwind-libunwind.c'
29  * for x86_32, we undef it to compile code for x86_32 only.
30  */
31 #undef HAVE_ARCH_X86_64_SUPPORT
32 #include "../../arch/x86/util/unwind-libunwind.c"
33 
34 /* Explicitly define NO_LIBUNWIND_DEBUG_FRAME, because non-ARM has no
35  * dwarf_find_debug_frame() function.
36  */
37 #ifndef NO_LIBUNWIND_DEBUG_FRAME
38 #define NO_LIBUNWIND_DEBUG_FRAME
39 #endif
40 #include "util/unwind-libunwind-local.c"
41 
42 struct unwind_libunwind_ops *
43 x86_32_unwind_libunwind_ops = &_unwind_libunwind_ops;
44