rmodtool: make rmodule parameter section optional
There are currently 2 uses for rmodule programs: stand alone programs that are separate from the coreboot stages and a relocatable ramstage. For the ramstage usage there's no reason to require a rmodule parameter section. Therefore make this optional. BUG=chrome-os-partner:44827 BRANCH=None TEST=Built ramstage w/ normal linking (w/o a rmodule parameter section). No error. Change-Id: I5f8a415e86510be9409a28068e3d3a4d0ba8733e Signed-off-by: Aaron Durbin <adubin@chromium.org> Reviewed-on: http://review.coreboot.org/11523 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
parent
d4dd44cc2b
commit
c9b053d07d
|
@ -344,7 +344,7 @@ static int collect_relocations(struct rmod_context *ctx)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
populate_sym(struct rmod_context *ctx, const char *sym_name, Elf64_Addr *addr,
|
populate_sym(struct rmod_context *ctx, const char *sym_name, Elf64_Addr *addr,
|
||||||
int nsyms, const char *strtab)
|
int nsyms, const char *strtab, int optional)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Elf64_Sym *syms;
|
Elf64_Sym *syms;
|
||||||
|
@ -360,6 +360,13 @@ populate_sym(struct rmod_context *ctx, const char *sym_name, Elf64_Addr *addr,
|
||||||
*addr = syms[i].st_value;
|
*addr = syms[i].st_value;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (optional) {
|
||||||
|
DEBUG("optional symbol '%s' not found.\n", sym_name);
|
||||||
|
*addr = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ERROR("symbol '%s' not found.\n", sym_name);
|
ERROR("symbol '%s' not found.\n", sym_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -403,17 +410,17 @@ static int populate_program_info(struct rmod_context *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (populate_sym(ctx, "_rmodule_params", &ctx->parameters_begin,
|
if (populate_sym(ctx, "_rmodule_params", &ctx->parameters_begin,
|
||||||
nsyms, strtab))
|
nsyms, strtab, 1))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (populate_sym(ctx, "_ermodule_params", &ctx->parameters_end,
|
if (populate_sym(ctx, "_ermodule_params", &ctx->parameters_end,
|
||||||
nsyms, strtab))
|
nsyms, strtab, 1))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (populate_sym(ctx, "_bss", &ctx->bss_begin, nsyms, strtab))
|
if (populate_sym(ctx, "_bss", &ctx->bss_begin, nsyms, strtab, 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (populate_sym(ctx, "_ebss", &ctx->bss_end, nsyms, strtab))
|
if (populate_sym(ctx, "_ebss", &ctx->bss_end, nsyms, strtab, 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Honor the entry point within the ELF header. */
|
/* Honor the entry point within the ELF header. */
|
||||||
|
|
Loading…
Reference in New Issue