* 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.
2007-03-28 Richard Sandiford <richard@codesourcery.com>
+
+ * 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.
+
+2007-03-28 Richard Sandiford <richard@codesourcery.com>
Phil Edwards <phil@codesourcery.com>
* ld.texinfo: Put the contents after the title page rather
{
char *filename, *sset;
- s = strchr (path, ':');
+ s = strchr (path, config.rpath_separator);
if (s == NULL)
s = path + strlen (path);
if [ "x${USE_LIBPATH}" = xyes ] ; then
cat >>e${EMULATION_NAME}.c <<EOF
-/* Add the sysroot to every entry in a colon-separated path. */
+/* Add the sysroot to every entry in a path separated by
+ config.rpath_separator. */
static char *
gld${EMULATION_NAME}_add_sysroot (const char *path)
colons = 0;
i = 0;
while (path[i])
- if (path[i++] == ':')
+ if (path[i++] == config.rpath_separator)
colons++;
if (path[i])
p = ret + strlen (ret);
i = 0;
while (path[i])
- if (path[i] == ':')
+ if (path[i] == config.rpath_separator)
{
*p++ = path[i++];
strcpy (p, ld_sysroot);
info->alloc += p - dir + 256;
info->path = xrealloc (info->path, info->alloc);
}
- info->path[info->len++] = ':';
+ info->path[info->len++] = config.rpath_separator;
}
memcpy (info->path + info->len, dir, p - dir);
info->len += p - dir;
static int force_dynamic;
static void
+vxworks_before_parse (void)
+{
+ ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse} ();
+ config.rpath_separator = ';';
+}
+
+static void
vxworks_after_open (void)
{
${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open} ();
break;
'
-LDEMUL_AFTER_OPEN=vxworks_after_open
+# Hook in our routines above. There are three possibilities:
+#
+# (1) VXWORKS_BASE_EM_FILE did not set the hook's LDEMUL_FOO variable.
+# We want to define LDEMUL_FOO to vxworks_foo in that case,
+#
+# (2) VXWORKS_BASE_EM_FILE set the hook's LDEMUL_FOO variable to
+# gld${EMULATION_NAME}_foo. This means that the file has
+# replaced elf32.em's default definition, so we simply #define
+# the current value of LDEMUL_FOO to vxworks_foo.
+#
+# (3) VXWORKS_BASE_EM_FILE set the hook's LDEMUL_FOO variable to
+# something other than gld${EMULATION_NAME}_foo. We handle
+# this case in the same way as (1).
+for override in before_parse after_open; do
+ var="LDEMUL_`echo ${override} | tr a-z A-Z`"
+ eval value=\$${var}
+ if test "${value}" = "gld${EMULATION_NAME}_${override}"; then
+ cat >>e${EMULATION_NAME}.c <<EOF
+#define ${value} vxworks_${override}
+EOF
+ else
+ eval $var=vxworks_${override}
+ fi
+done
unsigned int split_by_reloc;
bfd_size_type split_by_file;
+ /* The rpath separation character. Usually ':'. */
+ char rpath_separator;
+
/* If set, only search library directories explicitly selected
on the command line. */
bfd_boolean only_cmd_line_lib_dirs;
config.build_constructors = TRUE;
config.dynamic_link = FALSE;
config.has_shared = FALSE;
+ config.rpath_separator = ':';
config.split_by_reloc = (unsigned) -1;
config.split_by_file = (bfd_size_type) -1;
config.hash_table_size = 0;
/* 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;
}
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;
}
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;
}
+2007-03-28 Richard Sandiford <richard@codesourcery.com>
+
+ * ld-vxworks/rpath-1.s, ld-vxworks/rpath-1.d,
+ * ld-vxworks/vxworks.exp: New files.
+
2007-03-27 Alan Modra <amodra@bigpond.net.au>
* ld-elf/note-1.s: Increase .foo size.
--- /dev/null
+# source: rpath-1.s
+# ld: --entry foo --rpath /dir1 --rpath /dir2 --rpath net:/dir4 --rpath /dir2 --rpath /dir1 --rpath /dir3 --force-dynamic -q
+# readelf: -d
+#...
+ 0x0+f \(RPATH\).*Library rpath: \[/dir1;/dir2;net:/dir4;/dir3\]
+#pass
--- /dev/null
+ .global foo
+foo:
--- /dev/null
+# Expect script for VxWorks tests
+# Copyright 2007 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+if { [istarget *-*-vxworks*] } {
+ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.d]] {
+ if { [runtest_file_p $runtests $test] } {
+ run_dump_test [file rootname $test]
+ }
+ }
+}