command: Use array of pointers to commands
We used to store the commands as a linker array. One problem with this
is that on X86_64 for unknown reasons the linker uses a different struct
alignment than the compiler, so when we use the linker to compose the
array and the compiler to iterate over it we have to play tricks with
manually adjusting the alignment. The other problem is that we declare
the commands as const (and also put it in .rodata), but in fact we do
not treat it as const: we put the commands onto a list which modifies
the struct list_head list member of struct command.

With this patch we no longer put the command themselves into an array,
but instead create an array of pointers to the commands. This inherently
solves the second issue as well.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 5952390 commit 1e4a948673d709a2f8fcb9229b3cca77f3a25d51
@Sascha Hauer Sascha Hauer authored on 14 Oct 2019
Showing 2 changed files
View
common/command.c
View
include/command.h