aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2007-03-28 14:42:28 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2007-03-28 14:42:28 +0000
commitc76308d222c1144f80f5cd36e8c69952a2594d0a (patch)
tree131b7cfc38bd928088b81fae819fa183ccc61088 /ld/lexsup.c
parent39817122fc9818f3bb36e89b35d5b9c472f6d87f (diff)
downloadgdb-c76308d222c1144f80f5cd36e8c69952a2594d0a.zip
gdb-c76308d222c1144f80f5cd36e8c69952a2594d0a.tar.gz
gdb-c76308d222c1144f80f5cd36e8c69952a2594d0a.tar.bz2
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 795ecc8..287a463 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;
}