summaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2007-03-28 14:42:28 +0000
committerRichard Sandiford <rsandifo@nildram.co.uk>2007-03-28 14:42:28 +0000
commitec38189f735f0e1230da031bb55ceaaf4fe844e6 (patch)
tree84473630ac16e072f6fe80297132b63aa71c8c3a /ld/lexsup.c
parentb6a851ef92781b07eaf5b8177cf38ce06aaa3018 (diff)
downloadbinutils-redhat-ec38189f735f0e1230da031bb55ceaaf4fe844e6.tar.gz
ld/
* ld.h (ld_config_type): Add rpath_separator. * ldmain.c (main): Initialize it. * lexsup.c (parse_args): Honor config.rpath_separator. * emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Likewise. (gld${EMULATION_NAME}_add_sysroot): Likewise. (gld${EMULATION_NAME}_parse_ld_so_conf): Use config.rpath_separator rather than ':' when building the path. * emultempl/vxworks.em (vxworks_before_parse): New function. Override config.rpath_separator. (LDEMUL_AFTER_OPEN): Do not change if EXTRA_EM_FILE has been set to gld${EMULATION_NAME}_after_open; #define that identifier to vxworks_foo instead. (LDEMUL_BEFORE_PARSE): Override in the same way as LDEMUL_AFTER_OPEN. ld/testsuite/ * ld-vxworks/rpath-1.s, ld-vxworks/rpath-1.d, * ld-vxworks/vxworks.exp: New files.
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 795ecc8896..287a46398b 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1045,17 +1045,14 @@ parse_args (unsigned argc, char **argv)
/* First see whether OPTARG is already in the path. */
do
{
- size_t idx = 0;
-
- while (optarg[idx] != '\0' && optarg[idx] == cp[idx])
- ++idx;
- if (optarg[idx] == '\0'
- && (cp[idx] == '\0' || cp[idx] == ':'))
+ if (strncmp (optarg, cp, optarg_len) == 0
+ && (cp[optarg_len] == 0
+ || cp[optarg_len] == config.rpath_separator))
/* We found it. */
break;
/* Not yet found. */
- cp = strchr (cp, ':');
+ cp = strchr (cp, config.rpath_separator);
if (cp != NULL)
++cp;
}
@@ -1064,7 +1061,8 @@ parse_args (unsigned argc, char **argv)
if (cp == NULL)
{
buf = xmalloc (rpath_len + optarg_len + 2);
- sprintf (buf, "%s:%s", command_line.rpath, optarg);
+ sprintf (buf, "%s%c%s", command_line.rpath,
+ config.rpath_separator, optarg);
free (command_line.rpath);
command_line.rpath = buf;
}
@@ -1080,7 +1078,8 @@ parse_args (unsigned argc, char **argv)
buf = xmalloc (strlen (command_line.rpath_link)
+ strlen (optarg)
+ 2);
- sprintf (buf, "%s:%s", command_line.rpath_link, optarg);
+ sprintf (buf, "%s%c%s", command_line.rpath_link,
+ config.rpath_separator, optarg);
free (command_line.rpath_link);
command_line.rpath_link = buf;
}