Re: [PATCH 2/2] arch/x86: Drop unneeded linker script discard of .eh_frame

From: Arvind Sankar
Date: Mon Feb 24 2020 - 16:33:23 EST


On Mon, Feb 24, 2020 at 12:45:51PM -0800, Nick Desaulniers wrote:
>
> grepping for eh_frame in arch/x86/ there's a comment in
> arch/x86/include/asm/dwarf2.h:
> 40 #ifndef BUILD_VDSO
> 41 /*
> 42 * Emit CFI data in .debug_frame sections, not .eh_frame
> sections.
> 43 * The latter we currently just discard since we don't do DWARF
> 44 * unwinding at runtime. So only the offline DWARF information is
> 45 * useful to anyone. Note we should not use this directive if
> 46 * vmlinux.lds.S gets changed so it doesn't discard .eh_frame.
> 47 */
> 48 .cfi_sections .debug_frame
>
> add via:
> commit 7b956f035a9ef ("x86/asm: Re-add parts of the manual CFI infrastructure")
>
> https://sourceware.org/binutils/docs/as/CFI-directives.html#g_t_002ecfi_005fsections-section_005flist
> is the manual's section on .cfi_sections directives, and states `The
> default if this directive is not used is .cfi_sections .eh_frame.`.
> So the comment is slightly stale since we're no longer explicitly
> discarding .eh_frame in arch/x86/kernel/vmlinux.lds.S, rather
> preventing the generation via -fno-asynchronous-unwind-tables in
> KBUILD_CFLAGS (across a few different Makefiles). Would you mind also
> updating the comment in arch/x86/include/asm/dwarf2.h in a V2? The
> rest of this patch LGTM.
>

i.e. just replace that last sentence with "Note ... if we decide to use
runtime DWARF unwinding again"?

The whole ifdef-ery machinery there is obsolete, all the directives its
checking support for have been there since binutils-2.18, so should
probably also clean it up to just unconditionally define them.