summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2014-09-05 18:18:11 +1000
committerChris Johns <chrisj@rtems.org>2014-09-05 18:18:11 +1000
commitb05190cff6d524195fd045295ca84819f45b0cbb (patch)
tree6b80c0a820cc736246c97d7c993869bd3964164b
parent5679661069a8b9acaec26d61c8da797f0726506b (diff)
Remove march/mcpu and add RTEMS BSP and cflags support.
-rw-r--r--rtems-ld.cpp23
-rw-r--r--rtems-tld.cpp29
-rw-r--r--wscript6
3 files changed, 49 insertions, 9 deletions
diff --git a/rtems-ld.cpp b/rtems-ld.cpp
index 302dc50..189e699 100644
--- a/rtems-ld.cpp
+++ b/rtems-ld.cpp
@@ -42,6 +42,7 @@
#include <rld-outputter.h>
#include <rld-process.h>
#include <rld-resolver.h>
+#include <rld-rtems.h>
#ifndef HAVE_KILL
#define kill(p,s) raise(s)
@@ -73,6 +74,8 @@ static struct option rld_opts[] = {
{ "rpath", required_argument, NULL, 'R' },
{ "runtime-lib", required_argument, NULL, 'P' },
{ "one-file", no_argument, NULL, 's' },
+ { "rtems", required_argument, NULL, 'r' },
+ { "rtems-bsp", required_argument, NULL, 'B' },
{ NULL, 0, NULL, 0 }
};
@@ -117,6 +120,8 @@ usage (int exit_code)
<< " -P : place objects from archives (also --runtime-lib)" << std::endl
<< " -s : Include archive elf object files (also --one-file)" << std::endl
<< " -Wl,opts : link compatible flags, ignored" << std::endl
+ << " -r path : RTEMS path (also --rtems)" << std::endl
+ << " -B bsp : RTEMS arch/bsp (also --rtems-bsp)" << std::endl
<< "Output Formats:" << std::endl
<< " rap - RTEMS application (LZ77, single image)" << std::endl
<< " elf - ELF application (script, ELF files)" << std::endl
@@ -192,12 +197,13 @@ main (int argc, char* argv[])
bool map = false;
bool warnings = false;
bool one_file = false;
+ bool arch_bsp_load = false;
libpaths.push_back (".");
while (true)
{
- int opt = ::getopt_long (argc, argv, "hvwVMnsSb:E:o:O:L:l:c:e:d:u:C:W:R:P:", rld_opts, NULL);
+ int opt = ::getopt_long (argc, argv, "hvwVMnsSb:E:o:O:L:l:c:e:d:u:C:W:R:P:r:B:", rld_opts, NULL);
if (opt < 0)
break;
@@ -305,6 +311,15 @@ main (int argc, char* argv[])
/* ignore linker compatiable flags */
break;
+ case 'r':
+ rld::rtems::path = optarg;
+ break;
+
+ case 'B':
+ rld::rtems::arch_bsp = optarg;
+ arch_bsp_load = true;
+ break;
+
case '?':
usage (3);
break;
@@ -337,6 +352,12 @@ main (int argc, char* argv[])
throw rld::error ("invalid output format", "options");
/*
+ * Load the arch/bsp value if provided.
+ */
+ if (arch_bsp_load)
+ rld::rtems::load_cc ();
+
+ /*
* Load the remaining command line arguments into the cache as object
* files.
*/
diff --git a/rtems-tld.cpp b/rtems-tld.cpp
index 2ab292a..05be0be 100644
--- a/rtems-tld.cpp
+++ b/rtems-tld.cpp
@@ -45,6 +45,7 @@
#include <rld-cc.h>
#include <rld-config.h>
#include <rld-process.h>
+#include <rld-rtems.h>
#ifndef HAVE_KILL
#define kill(p,s) raise(s)
@@ -737,8 +738,9 @@ static struct option rld_opts[] = {
{ "warn", no_argument, NULL, 'w' },
{ "keep", no_argument, NULL, 'k' },
{ "exec-prefix", required_argument, NULL, 'E' },
- { "march", required_argument, NULL, 'a' },
- { "mcpu", required_argument, NULL, 'c' },
+ { "cflags", required_argument, NULL, 'c' },
+ { "rtems", required_argument, NULL, 'r' },
+ { "rtems-bsp", required_argument, NULL, 'B' },
{ "config", required_argument, NULL, 'C' },
{ NULL, 0, NULL, 0 }
};
@@ -756,6 +758,8 @@ usage (int exit_code)
<< " -k : keep temporary files (also --keep)" << std::endl
<< " -E prefix : the RTEMS tool prefix (also --exec-prefix)" << std::endl
<< " -c cflags : C compiler flags (also --cflags)" << std::endl
+ << " -r path : RTEMS path (also --rtems)" << std::endl
+ << " -B bsp : RTEMS arch/bsp (also --rtems-bsp)" << std::endl
<< " -C ini : user configuration INI file (also --config)" << std::endl;
::exit (exit_code);
}
@@ -808,13 +812,11 @@ main (int argc, char* argv[])
std::string configuration;
std::string trace = "tracer";
bool exec_prefix_set = false;
-#if HAVE_WARNINGS
- bool warnings = false;
-#endif
+ bool arch_bsp_load = false;
while (true)
{
- int opt = ::getopt_long (argc, argv, "hvwkVE:c:C:", rld_opts, NULL);
+ int opt = ::getopt_long (argc, argv, "hvwkVE:c:C:r:B:", rld_opts, NULL);
if (opt < 0)
break;
@@ -849,6 +851,15 @@ main (int argc, char* argv[])
rld::cc::cflags = optarg;
break;
+ case 'r':
+ rld::rtems::path = optarg;
+ break;
+
+ case 'B':
+ rld::rtems::arch_bsp = optarg;
+ arch_bsp_load = true;
+ break;
+
case 'C':
configuration = optarg;
break;
@@ -870,6 +881,12 @@ main (int argc, char* argv[])
std::cout << "RTEMS Trace Linker " << rld::version () << std::endl;
/*
+ * Load the arch/bsp value if provided.
+ */
+ if (arch_bsp_load)
+ rld::rtems::load_cc ();
+
+ /*
* Load the remaining command line arguments into the linker command line.
*/
while (argc--)
diff --git a/wscript b/wscript
index e6a3fbe..7540566 100644
--- a/wscript
+++ b/wscript
@@ -94,6 +94,7 @@ def build(bld):
# RLD source.
#
rld_source = ['ConvertUTF.c',
+ 'pkgconfig.cpp',
'rld-config.cpp',
'rld-elf.cpp',
'rld-files.cpp',
@@ -103,6 +104,7 @@ def build(bld):
'rld-path.cpp',
'rld-process.cpp',
'rld-resolver.cpp',
+ 'rld-rtems.cpp',
'rld-symbols.cpp',
'rld-rap.cpp',
'rld.cpp']
@@ -132,7 +134,7 @@ def build(bld):
# Build the linker.
#
bld.program(target = 'rtems-ld',
- source = ['rtems-ld.cpp', 'pkgconfig.cpp'],
+ source = ['rtems-ld.cpp'],
defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
includes = ['.'] + bld.includes,
cflags = bld.cflags + bld.warningflags,
@@ -144,7 +146,7 @@ def build(bld):
# Build the ra linker.
#
bld.program(target = 'rtems-ra',
- source = ['rtems-ra.cpp', 'pkgconfig.cpp'],
+ source = ['rtems-ra.cpp'],
defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
includes = ['.'] + bld.includes,
cflags = bld.cflags + bld.warningflags,