diff --git a/common/command.c b/common/command.c index d9cc4a6..4984593 100644 --- a/common/command.c +++ b/common/command.c @@ -149,12 +149,12 @@ */ static int init_command_list(void) { - struct command *cmdtp; + struct command * const *cmdtp; - for (cmdtp = &__barebox_cmd_start; - cmdtp != &__barebox_cmd_end; + for (cmdtp = __barebox_cmd_start; + cmdtp != __barebox_cmd_end; cmdtp++) - register_command(cmdtp); + register_command(*cmdtp); return 0; } diff --git a/include/command.h b/include/command.h index 0afc5c7..7555d00 100644 --- a/include/command.h +++ b/include/command.h @@ -53,15 +53,10 @@ const char *help; /* Help message (long) */ void (*usage)(void); #endif -} -#ifdef __x86_64__ -/* This is required because the linker will put symbols on a 64 bit alignment */ -__attribute__((aligned(64))) -#endif -; +}; -extern struct command __barebox_cmd_start; -extern struct command __barebox_cmd_end; +extern struct command * const __barebox_cmd_start[]; +extern struct command * const __barebox_cmd_end[]; /* common/command.c */ @@ -89,10 +84,12 @@ #endif /* __ASSEMBLY__ */ -#define BAREBOX_CMD_START(_name) \ -extern const struct command __barebox_cmd_##_name; \ -const struct command __barebox_cmd_##_name \ - __attribute__ ((unused,section (".barebox_cmd_" __stringify(_name)))) = { \ +#define BAREBOX_CMD_START(_name) \ +static struct command __barebox_cmd_##_name; \ +const struct command *barebox_cmd_##_name \ + __attribute__ ((unused,section (".barebox_cmd_" __stringify(_name)))) \ + = &__barebox_cmd_##_name; \ +static struct command __barebox_cmd_##_name = { \ .name = #_name, #define BAREBOX_CMD_END \