[linker] align all the special sections on 8 byte boundaries, remove x86-64 hack

A bit overkill for 32bit machines, but aligning all the special data structures
on 8 byte boundaries removes any special case for 64bit machines.
This commit is contained in:
Travis Geiselbrecht
2015-10-26 17:01:34 -07:00
parent 0e1ce411ba
commit 114a350e55
8 changed files with 7 additions and 30 deletions

View File

@@ -1,8 +1,8 @@
SECTIONS {
.apps ALIGN(8) : {
.apps : ALIGN(8) {
__apps_start = .;
KEEP (*(.apps))
__apps_end = .;
}
}
INSERT AFTER .data;
INSERT AFTER .rodata;

View File

@@ -1,5 +1,5 @@
SECTIONS {
.devices ALIGN(8) : {
.devices : ALIGN(8) {
__devices = .;
KEEP (*(.devices))
__devices_end = .;

View File

@@ -1,5 +1,5 @@
SECTIONS {
.drivers : {
.drivers : ALIGN(8) {
__drivers = .;
KEEP (*(.drivers))
__drivers_end = .;

View File

@@ -49,11 +49,7 @@ struct app_descriptor {
size_t stack_size;
};
#ifdef ARCH_X86_64
#define APP_START(appname) struct app_descriptor _app_##appname __ALIGNED(8) __SECTION(".apps") = { .name = #appname,
#else
#define APP_START(appname) struct app_descriptor _app_##appname __SECTION(".apps") = { .name = #appname,
#endif
#define APP_START(appname) const struct app_descriptor _app_##appname __SECTION(".apps") = { .name = #appname,
#define APP_END };

View File

@@ -67,19 +67,11 @@ typedef struct _cmd_block {
#define STATIC_COMMAND_START static const cmd _cmd_list[] = {
#ifdef ARCH_X86_64
#define STATIC_COMMAND_END(name) }; const cmd_block _cmd_block_##name __ALIGNED(8) __SECTION(".commands")= { NULL, sizeof(_cmd_list) / sizeof(_cmd_list[0]), _cmd_list }
#else
#define STATIC_COMMAND_END(name) }; const cmd_block _cmd_block_##name __SECTION(".commands")= { NULL, sizeof(_cmd_list) / sizeof(_cmd_list[0]), _cmd_list }
#endif
#define STATIC_COMMAND_START_NAMED(name) static const cmd _cmd_list_##name[] = {
#ifdef ARCH_X86_64
#define STATIC_COMMAND_END_NAMED(name) }; const cmd_block _cmd_block_##name __ALIGNED(8) __SECTION(".commands")= { NULL, sizeof(_cmd_list_##name) / sizeof(_cmd_list_##name[0]), _cmd_list_##name }
#else
#define STATIC_COMMAND_END_NAMED(name) }; const cmd_block _cmd_block_##name __SECTION(".commands")= { NULL, sizeof(_cmd_list_##name) / sizeof(_cmd_list_##name[0]), _cmd_list_##name }
#endif
#define STATIC_COMMAND(command_str, help_str, func) { command_str, help_str, func, CMD_AVAIL_NORMAL },
#define STATIC_COMMAND_MASKED(command_str, help_str, func, availability_mask) { command_str, help_str, func, availability_mask },

View File

@@ -74,15 +74,6 @@ struct lk_init_struct {
const char *name;
};
#ifdef ARCH_X86_64
#define LK_INIT_HOOK_FLAGS(_name, _hook, _level, _flags) \
const struct lk_init_struct _init_struct_##_name __ALIGNED(8) __SECTION(".lk_init") = { \
.level = _level, \
.flags = _flags, \
.hook = _hook, \
.name = #_name, \
};
#else
#define LK_INIT_HOOK_FLAGS(_name, _hook, _level, _flags) \
const struct lk_init_struct _init_struct_##_name __SECTION(".lk_init") = { \
.level = _level, \
@@ -90,7 +81,6 @@ struct lk_init_struct {
.hook = _hook, \
.name = #_name, \
};
#endif
#define LK_INIT_HOOK(_name, _hook, _level) \
LK_INIT_HOOK_FLAGS(_name, _hook, _level, LK_INIT_FLAG_PRIMARY_CPU)

View File

@@ -1,5 +1,5 @@
SECTIONS {
.commands ALIGN(8) : {
.commands : ALIGN(8) {
__commands_start = .;
KEEP (*(.commands))
__commands_end = .;

View File

@@ -1,6 +1,5 @@
SECTIONS {
.init ALIGN(8) : {
. = ALIGN(8);
.lk_init : ALIGN(8) {
__lk_init = .;
KEEP (*(.lk_init))
__lk_init_end = .;