aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-06-18 02:23:56 +0000
committerAlan Modra <amodra@gmail.com>2007-06-18 02:23:56 +0000
commit628e8859461e0af7dcae8357032b19ccfe611ff6 (patch)
tree1a40f3fc9f7728602eb52dad7aa94489df67251b
parentdbdca70b82b81c3262b697fcf5c8d8378b2f905a (diff)
downloadgdb-628e8859461e0af7dcae8357032b19ccfe611ff6.zip
gdb-628e8859461e0af7dcae8357032b19ccfe611ff6.tar.gz
gdb-628e8859461e0af7dcae8357032b19ccfe611ff6.tar.bz2
* emultempl/spuelf.em (embedded_spu_file): Deduce embedspu program
name prefix from that of ld.
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/emultempl/spuelf.em25
2 files changed, 29 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a4a3d17..aaf35f5 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-18 Alan Modra <amodra@bigpond.net.au>
+
+ * emultempl/spuelf.em (embedded_spu_file): Deduce embedspu program
+ name prefix from that of ld.
+
2007-06-14 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.am (ACLOCAL_AMFLAGS): Add -I ../config -I ../bfd.
diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
index db0542f..3266f65 100644
--- a/ld/emultempl/spuelf.em
+++ b/ld/emultempl/spuelf.em
@@ -306,6 +306,8 @@ embedded_spu_file (lang_input_statement_type *entry, const char *flags)
union lang_statement_union **old_file_tail;
union lang_statement_union *new_ent;
lang_input_statement_type *search;
+ const char *prefix;
+ size_t prefix_len;
if (entry->the_bfd->format != bfd_object
|| strcmp (entry->the_bfd->xvec->name, "elf32-spu") != 0
@@ -360,7 +362,23 @@ embedded_spu_file (lang_input_statement_type *entry, const char *flags)
/* Use fork() and exec() rather than system() so that we don't
need to worry about quoting args. */
- cmd[0] = "embedspu";
+ prefix = base_name (program_name);
+ prefix_len = strlen (prefix);
+ if (prefix_len > 2
+ && (prefix[prefix_len - 2] == 'l'
+ || prefix[prefix_len - 2] == 'L')
+ && (prefix[prefix_len - 1] == 'd'
+ || prefix[prefix_len - 1] == 'D'))
+ {
+ cmd[0] = xmalloc (prefix_len + 7);
+ memcpy (cmd[0], prefix, prefix_len - 2);
+ memcpy (cmd[0] + prefix_len - 2, "embedspu", 9);
+ }
+ else
+ {
+ prefix_len = 0;
+ cmd[0] = "embedspu";
+ }
cmd[1] = flags;
cmd[2] = handle;
cmd[3] = entry->the_bfd->filename;
@@ -379,6 +397,11 @@ embedded_spu_file (lang_input_statement_type *entry, const char *flags)
if (pid == 0)
{
execvp (cmd[0], (char *const *) cmd);
+ if (prefix_len != 0)
+ {
+ cmd[0] = "embedspu";
+ execvp (cmd[0], (char *const *) cmd);
+ }
perror (cmd[0]);
_exit (127);
}