[coreboot-gerrit] Patch set updated for coreboot: acef34c rmodtool: Allow rmodules with 0 relocations
Furquan Shaikh (furquan@google.com)
gerrit at coreboot.org
Tue Sep 23 00:59:07 CEST 2014
Furquan Shaikh (furquan at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6774
-gerrit
commit acef34cbc5609c295aa8baf562b9b687dbd99887
Author: Furquan Shaikh <furquan at google.com>
Date: Tue Aug 26 14:59:36 2014 -0700
rmodtool: Allow rmodules with 0 relocations
Currently, rmodules with 0 relocations are not allowed. Fix this by skipping
addition of .rmodules section on 0 relocs.
Change-Id: I7a39cf409a5f2bc808967d2b5334a15891c4748e
Signed-off-by: Furquan Shaikh <furquan at google.com>
---
util/cbfstool/rmodule.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/util/cbfstool/rmodule.c b/util/cbfstool/rmodule.c
index 95aff54..168d71a 100644
--- a/util/cbfstool/rmodule.c
+++ b/util/cbfstool/rmodule.c
@@ -259,10 +259,8 @@ static int collect_relocations(struct rmod_context *ctx)
nrelocs = ctx->nrelocs;
INFO("%d relocations to be emitted.\n", nrelocs);
- if (!nrelocs) {
- ERROR("No valid relocations in file.\n");
- return -1;
- }
+ if (!nrelocs)
+ return 0;
/* Reset the counter for indexing into the array. */
ctx->nrelocs = 0;
@@ -536,10 +534,13 @@ write_elf(const struct rmod_context *ctx, const struct buffer *in,
goto out;
addr += ctx->phdr->p_filesz;
- ret = add_section(ew, &relocs, ".relocs", addr, buffer_size(&relocs));
- if (ret < 0)
- goto out;
- addr += buffer_size(&relocs);
+ if (ctx->nrelocs) {
+ ret = add_section(ew, &relocs, ".relocs", addr,
+ buffer_size(&relocs));
+ if (ret < 0)
+ goto out;
+ addr += buffer_size(&relocs);
+ }
if (total_size != addr) {
ret = add_section(ew, NULL, ".empty", addr, total_size - addr);
More information about the coreboot-gerrit
mailing list