Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/vdso: Define BUILD_VDSO while building and emit .eh_frame in asm

For the vDSO, user code wants runtime unwind info. Make sure
that, if we use .cfi directives, we generate it.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/16e29ad8855e6508197000d8c41f56adb00d7580.1444091584.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Andy Lutomirski and committed by
Ingo Molnar
f24f9108 7b956f03

+12 -5
+2 -2
arch/x86/entry/vdso/Makefile
··· 67 67 CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ 68 68 $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \ 69 69 -fno-omit-frame-pointer -foptimize-sibling-calls \ 70 - -DDISABLE_BRANCH_PROFILING 70 + -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO 71 71 72 72 $(vobjs): KBUILD_CFLAGS += $(CFL) 73 73 ··· 131 131 targets += vdso32/note.o vdso32/vclock_gettime.o vdso32/system_call.o 132 132 targets += vdso32/vclock_gettime.o 133 133 134 - KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) 134 + KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) -DBUILD_VDSO 135 135 $(obj)/vdso32.so.dbg: KBUILD_AFLAGS = $(KBUILD_AFLAGS_32) 136 136 $(obj)/vdso32.so.dbg: asflags-$(CONFIG_X86_64) += -m32 137 137
+10 -3
arch/x86/include/asm/dwarf2.h
··· 36 36 #endif 37 37 38 38 #if defined(CONFIG_AS_CFI_SECTIONS) && defined(__ASSEMBLY__) 39 + #ifndef BUILD_VDSO 39 40 /* 40 41 * Emit CFI data in .debug_frame sections, not .eh_frame sections. 41 42 * The latter we currently just discard since we don't do DWARF 42 43 * unwinding at runtime. So only the offline DWARF information is 43 - * useful to anyone. Note we should not use this directive if this 44 - * file is used in the vDSO assembly, or if vmlinux.lds.S gets 45 - * changed so it doesn't discard .eh_frame. 44 + * useful to anyone. Note we should not use this directive if 45 + * vmlinux.lds.S gets changed so it doesn't discard .eh_frame. 46 46 */ 47 47 .cfi_sections .debug_frame 48 + #else 49 + /* 50 + * For the vDSO, emit both runtime unwind information and debug 51 + * symbols for the .dbg file. 52 + */ 53 + .cfi_sections .eh_frame, .debug_frame 54 + #endif 48 55 #endif 49 56 50 57 #else