Re: Problems with static variables and GNU map files

Marti Bolivar <marti.bolivar@...>

Why not just #define static SOMETHING_ELSE as needed?

On 19 October 2017 at 15:08, Paul Sokolovsky <paul.sokolovsky@...> wrote:

A usecase (one of many): I want to see what network interface structures
go into my Zephyr binary. Of course, I look at the linker map file,
and ... see nothing:

net_if          0x000000000041fa80      0x2a0 load address 0x00000000000150bc
                0x000000000041fa80                __net_if_start = .
 *(.net_if.*)   0x000000000041fa80      0x2a0 drivers/built-in.o
                0x000000000041fd20                __net_if_end = .

That's because netif structures are defined as static, and GNU linker
takes that as an incentive to conceal them from the map file. This
issue was reported few years ago as with no
feedback, so apparently nothing is going to happen.


Let's have

#define STATIC static

And use STATIC everywhere a static var is defined. This way, it can be
redefined in one place to produce a relevant map file (let's also have
unique names for all variables, yeah).

Best Regards,
Paul | Open source software for ARM SoCs
Follow Linaro:!/linaroorg -
Zephyr-devel mailing list

Join to automatically receive all group messages.