Re: [PATCH] Only add -fno-var-tracking-assignments workaround for old GCC versions.

From: Andi Kleen
Date: Wed Oct 14 2020 - 11:17:07 EST


On Wed, Oct 14, 2020 at 01:01:32PM +0200, Mark Wielaard wrote:
> Some old GCC versions between 4.5.0 and 4.9.1 might miscompile code
> with -fvar-tracking-assingments (which is enabled by default with -g -O2).
> commit 2062afb4f added -fno-var-tracking-assignments unconditionally to
> work around this. But newer versions of GCC no longer have this bug, so
> only add it for versions of GCC before 5.0.

Add

... This allows various tools such as a perf probe or gdb debuggers
or systemtap to resolve variable locations using dwarf locations in
more code.
>
> Signed-off-by: Mark Wielaard <mark@xxxxxxxxx>
> Acked-by: Ian Rogers <irogers@xxxxxxxxxx>
> Cc: linux-toolchains@xxxxxxxxxxxxxxx
> Cc: Andi Kleen <andi@xxxxxxxxxxxxxx>
> Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> Cc: Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx>
> Cc: Florian Weimer <fw@xxxxxxxxxxxxx>

Reviewed-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>

-Andi