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

From: Nick Desaulniers
Date: Mon Feb 24 2020 - 16:58:50 EST


On Mon, Feb 24, 2020 at 1:33 PM Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
>
> 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"?

Yeah that should be good. Maybe these cleanups could be a separate
patch, if you prefer?

>
> 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.

arch/x86/Makefile:
184 # do binutils support CFI?
185 cfi := $(call as-instr,.cfi_startproc\n.cfi_rel_offset
$(sp-y)$(comma)0\n.cfi_endproc,-DCONFIG_AS_CFI=1)
186 # is .cfi_signal_frame supported too?
187 cfi-sigframe := $(call
as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1)
188 cfi-sections := $(call as-instr,.cfi_sections
.debug_frame,-DCONFIG_AS_CFI_SECTIONS=1)

2.18? Oh, yeah, we can clean that up to.
Documentation/process/changes.rst list binutils 2.21 as the minimum
supported version. Then I assume that code that uses those -D flags
can go, too.
--
Thanks,
~Nick Desaulniers