summaryrefslogtreecommitdiff
path: root/util/cbfstool/rmodule.h
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-03-07 15:11:53 -0600
committerAaron Durbin <adurbin@google.com>2014-03-20 21:34:39 +0100
commit4fde5a66b4a2b4117a45519ab0f63a9fd6bff835 (patch)
treefc69dd7a4833805f274d8a5ea89ac34065e3921d /util/cbfstool/rmodule.h
parent36be8135d74964fa2eb03af44079d845c199486b (diff)
util: add rmodtool for parsing ELF files to rmodules
The current implementation of creating rmodules relies on invoking the linker in a certain manner with the relocations overlaid on the BSS section. It's not really surprising that the linker doesn't always behave the way one wants depending on the linker used and the architecture. Instead, introduce rmodtool which takes an ELF file as an input, parses it, and creates a new ELF file in the format the rmodule loader expects. Change-Id: I31ac2d327d450ef841c3a7d9740b787278382bef Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/5378 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'util/cbfstool/rmodule.h')
-rw-r--r--util/cbfstool/rmodule.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/util/cbfstool/rmodule.h b/util/cbfstool/rmodule.h
new file mode 100644
index 0000000000..94f8f3d064
--- /dev/null
+++ b/util/cbfstool/rmodule.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2014 Google, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ */
+
+#ifndef TOOL_RMODULE_H
+#define TOOL_RMODULE_H
+
+#include "elf.h"
+#include "common.h"
+
+/*
+ * Parse an ELF file within the elfin buffer and fill in the elfout buffer
+ * with a created rmodule in ELF format. Return 0 on success, < 0 on error.
+ */
+int rmodule_create(const struct buffer *elfin, struct buffer *elfout);
+
+#endif /* TOOL_RMODULE_H */