aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-06-15 20:46:43 +0000
committerIan Lance Taylor <ian@airs.com>1994-06-15 20:46:43 +0000
commit7fb9ca5fc27e521d28d5ef74bfd73b0b8bab8da6 (patch)
tree7ba9f19d65ccbfa55579fd36b4c05e827c77aa1d /ld/emultempl
parent57569ce8d17b939e41d9af72237207fe3e3ede89 (diff)
downloadgdb-7fb9ca5fc27e521d28d5ef74bfd73b0b8bab8da6.zip
gdb-7fb9ca5fc27e521d28d5ef74bfd73b0b8bab8da6.tar.gz
gdb-7fb9ca5fc27e521d28d5ef74bfd73b0b8bab8da6.tar.bz2
Let the user change the dynamic linker used by ELF code.
* ld.h (args_type): Add new field interpreter. * lexsup.c (parse_args): Add dynamic-linker to longopts, and handle it. * ldmain.c (main): Initialize command_line.interpreter to NULL. * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Get the ELF backend to return the .interp section. If command_line.interpreter is not NULL, set the contents of .interp to it. * ld.texinfo: Mention -dynamic-linker.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/elf32.em13
1 files changed, 12 insertions, 1 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 1ce59dd..7585f41 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -59,6 +59,8 @@ gld${EMULATION_NAME}_before_parse()
static void
gld${EMULATION_NAME}_before_allocation ()
{
+ asection *sinterp;
+
/* If we are going to make any variable assignments, we need to let
the ELF backend know about them in case the variables are
referred to by dynamic objects. */
@@ -66,8 +68,17 @@ gld${EMULATION_NAME}_before_allocation ()
/* Let the ELF backend work out the sizes of any sections required
by dynamic linking. */
- if (! bfd_elf32_size_dynamic_sections (output_bfd, &link_info))
+ if (! bfd_elf32_size_dynamic_sections (output_bfd, &link_info,
+ &sinterp))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
+
+ /* Let the user override the dynamic linker we are using. */
+ if (command_line.interpreter != NULL
+ && sinterp != NULL)
+ {
+ sinterp->contents = (bfd_byte *) command_line.interpreter;
+ sinterp->_raw_size = strlen (command_line.interpreter) + 1;
+ }
}
/* This is called by the before_allocation routine via