summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2012-11-21 11:07:12 +1100
committerChris Johns <chrisj@rtems.org>2012-11-21 11:07:12 +1100
commiteb3481120687bc6dbf86eebb8f269da6802ff64b (patch)
treeb0144066820c271aaca755e4653fd5e291817db8
parenta1d49302836ad78c9c64b6d9bf35a6155aa8e7c5 (diff)
Output application format files.
Added support for an RTEMS RAP format application file. The format is: <header> <LZ77> <Application Script> <[1..n] ELF Object files> </LZ77> Where the header is a text string of fields delimited by ',' and terminated with a line feed (\n). It is variable length: RTEMS-APP,0000000,01.00.00,LZ77,00000000\n\0 where: RTEMS-APP : file tag for quick acceptance and rejection Length : the length of the application in bytes including the : header Version : Version of the application format. Compress : The compression format. Checksum : CCITT CRC32 checksum. Following the header is a nul ('\0') character then an LZ77 container with the application loader script followed by the ELF object files. Note, the script format will be documented else where. Note, the final version may add a 32bit length field before each part in the compressed container to delimit the size of the file to be read. This is currently not in this version.
-rw-r--r--linkers/rld-outputter.h26
-rw-r--r--linkers/rtems-ld.cpp22
2 files changed, 41 insertions, 7 deletions
diff --git a/linkers/rld-outputter.h b/linkers/rld-outputter.h
index a5e03c8..fa3ebb4 100644
--- a/linkers/rld-outputter.h
+++ b/linkers/rld-outputter.h
@@ -32,6 +32,16 @@ namespace rld
namespace outputter
{
/**
+ * The types of output.
+ */
+ enum type
+ {
+ ot_script,
+ ot_archive,
+ ot_application
+ };
+
+ /**
* Output the object file list as a string.
*
* @param dependents The list of dependent object files
@@ -42,7 +52,8 @@ namespace rld
std::string script_text (rld::files::object_list& dependents,
rld::files::cache& cache);
/**
- * Output the object file list as a script.
+ * Output the object files as an archive format file with the metadata as
+ * the first ELF file.
*
* @param name The name of the archive.
* @param dependents The list of dependent object files
@@ -64,6 +75,19 @@ namespace rld
void script (const std::string& name,
rld::files::object_list& dependents,
rld::files::cache& cache);
+
+ /**
+ * Output the object files as a compressed list of files.
+ *
+ * @param name The name of the script.
+ * @param dependents The list of dependent object files
+ * @param cache The file cache for the link. Includes the object list
+ * the user requested.
+ */
+ void application (const std::string& name,
+ files::object_list& dependents,
+ files::cache& cache);
+
}
}
diff --git a/linkers/rtems-ld.cpp b/linkers/rtems-ld.cpp
index 54e9987..66ac235 100644
--- a/linkers/rtems-ld.cpp
+++ b/linkers/rtems-ld.cpp
@@ -170,7 +170,7 @@ main (int argc, char* argv[])
std::string output = "a.out";
std::string base_name;
std::string cc_name;
- bool script = false;
+ rld::outputter::type output_type = rld::outputter::ot_application;
bool standard_libs = true;
bool exec_prefix_set = false;
bool map = false;
@@ -211,7 +211,7 @@ main (int argc, char* argv[])
break;
case 'S':
- script = true;
+ output_type = rld::outputter::ot_script;
break;
case 'l':
@@ -385,10 +385,20 @@ main (int argc, char* argv[])
/**
* Output the file.
*/
- if (script)
- rld::outputter::script (output, dependents, cache);
- else
- rld::outputter::archive (output, dependents, cache);
+ switch (output_type)
+ {
+ case rld::outputter::ot_script:
+ rld::outputter::script (output, dependents, cache);
+ break;
+ case rld::outputter::ot_archive:
+ rld::outputter::archive (output, dependents, cache);
+ break;
+ case rld::outputter::ot_application:
+ rld::outputter::application (output, dependents, cache);
+ break;
+ default:
+ throw rld::error ("invalid output type", "output");
+ }
/**
* Check for warnings.