Re: [PATCH v2 06/11] x86/unwind/orc: Convert global variables to static

From: Steven Rostedt
Date: Mon Mar 18 2024 - 11:55:51 EST


On Wed, 28 Feb 2024 16:42:52 -0800
Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:

> > I'm guessing because we don't have the full dwarf info?
>
> DWARF isn't needed for that. Even the symbol table has it (as does
> System.map). For both globals and statics.

It is in System.map, but I guess the real issue is that the compiler can
optimize it out. That is, the number is never set as it is static and the
compiler doesn't need to do anything to make it valid. To the compiler, the
number is just a local variable. I'm not exactly sure how it does that, as
it sets the value in one function and uses it in another. But clang appears
to not be setting it when it is static.

Either removing static or making it volatile makes it work again.

Thoughts?

-- Steve