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/emultempl | |
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/emultempl')
-rw-r--r-- | ld/emultempl/elf32.em | 11 | ||||
-rw-r--r-- | ld/emultempl/vxworks.em | 32 |
2 files changed, 37 insertions, 6 deletions
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 |