diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2007-03-28 14:42:28 +0000 |
---|---|---|
committer | Richard Sandiford <rdsandiford@googlemail.com> | 2007-03-28 14:42:28 +0000 |
commit | c76308d222c1144f80f5cd36e8c69952a2594d0a (patch) | |
tree | 131b7cfc38bd928088b81fae819fa183ccc61088 /ld | |
parent | 39817122fc9818f3bb36e89b35d5b9c472f6d87f (diff) | |
download | gdb-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')
-rw-r--r-- | ld/ChangeLog | 16 | ||||
-rw-r--r-- | ld/emultempl/elf32.em | 11 | ||||
-rw-r--r-- | ld/emultempl/vxworks.em | 32 | ||||
-rw-r--r-- | ld/ld.h | 3 | ||||
-rw-r--r-- | ld/ldmain.c | 1 | ||||
-rw-r--r-- | ld/lexsup.c | 17 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-vxworks/rpath-1.d | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-vxworks/rpath-1.s | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-vxworks/vxworks.exp | 24 |
10 files changed, 102 insertions, 15 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 5c0b392..372a5d2 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,4 +1,20 @@ 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 diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 1646d2e..e7ed2bd 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -459,7 +459,7 @@ gld${EMULATION_NAME}_search_needed (const char *path, { char *filename, *sset; - s = strchr (path, ':'); + s = strchr (path, config.rpath_separator); if (s == NULL) s = path + strlen (path); @@ -492,7 +492,8 @@ EOF 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) @@ -504,7 +505,7 @@ 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]) @@ -516,7 +517,7 @@ gld${EMULATION_NAME}_add_sysroot (const char *path) 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); @@ -745,7 +746,7 @@ gld${EMULATION_NAME}_parse_ld_so_conf 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; diff --git a/ld/emultempl/vxworks.em b/ld/emultempl/vxworks.em index 349fa54..b03419f 100644 --- a/ld/emultempl/vxworks.em +++ b/ld/emultempl/vxworks.em @@ -7,6 +7,13 @@ cat >>e${EMULATION_NAME}.c <<EOF 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} (); @@ -48,4 +55,27 @@ PARSE_AND_LIST_ARGS_CASES=$PARSE_AND_LIST_ARGS_CASES' 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 @@ -277,6 +277,9 @@ typedef struct { 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; diff --git a/ld/ldmain.c b/ld/ldmain.c index f47758f..5d43076 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -247,6 +247,7 @@ main (int argc, char **argv) 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; 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; } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index b8922d1..b57388a 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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. diff --git a/ld/testsuite/ld-vxworks/rpath-1.d b/ld/testsuite/ld-vxworks/rpath-1.d new file mode 100644 index 0000000..df67a03 --- /dev/null +++ b/ld/testsuite/ld-vxworks/rpath-1.d @@ -0,0 +1,6 @@ +# 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 diff --git a/ld/testsuite/ld-vxworks/rpath-1.s b/ld/testsuite/ld-vxworks/rpath-1.s new file mode 100644 index 0000000..6218588 --- /dev/null +++ b/ld/testsuite/ld-vxworks/rpath-1.s @@ -0,0 +1,2 @@ + .global foo +foo: diff --git a/ld/testsuite/ld-vxworks/vxworks.exp b/ld/testsuite/ld-vxworks/vxworks.exp new file mode 100644 index 0000000..e33e761 --- /dev/null +++ b/ld/testsuite/ld-vxworks/vxworks.exp @@ -0,0 +1,24 @@ +# 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] + } + } +} |