From ec38189f735f0e1230da031bb55ceaaf4fe844e6 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 28 Mar 2007 14:42:28 +0000 Subject: 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. --- ld/lexsup.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'ld/lexsup.c') 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; } -- cgit v1.2.1