aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorMartin Storsj <martin@martin.st>2022-01-11 15:43:59 +0000
committerNick Clifton <nickc@redhat.com>2022-01-11 15:43:59 +0000
commitc4a8df19ba0a82aa8dea88d9f72ed9e63cb1fa84 (patch)
treeb173da05b0a8815f2f3ca4fd6e046beea7950371 /binutils
parentd02f2788c34418483927d16db7e98a8a18fd508e (diff)
downloadgdb-c4a8df19ba0a82aa8dea88d9f72ed9e63cb1fa84.zip
gdb-c4a8df19ba0a82aa8dea88d9f72ed9e63cb1fa84.tar.gz
gdb-c4a8df19ba0a82aa8dea88d9f72ed9e63cb1fa84.tar.bz2
Fix multiple problems with DLL generation.
ld * pe-dll.c (make_head): Prefix the symbol name with the dll name. (make_tail, make_one, make_singleton_name_thunk): Likewise. (make_import_fixup_entry, make_runtime_pseudo_reloc): Likewise. (pe_create_runtime_relocator_reference): Likewise. (pe_dll_generate_implib): Set dll_symname_len. (pe_process_import_defs): Likewise. binutils * dlltool.c (main): If a prefix has not been provided, attempt to use a deterministic one based upon the dll name.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/dlltool.c20
2 files changed, 22 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index ff25db2..8e31f14 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-11 Martin Storsjö <martin@martin.st>
+
+ * dlltool.c (main): If a prefix has not been provided, attempt to
+ use a deterministic one based upon the dll name.
+
2022-01-07 Pavel Mayorov <pmayorov@cloudlinux.com>
PR 28718
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 8c1ddd6..a1e2b48 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -348,7 +348,7 @@ typedef struct iheadt
static iheadtype *import_list = NULL;
static char *as_name = NULL;
static char * as_flags = "";
-static char *tmp_prefix;
+static char *tmp_prefix = NULL;
static int no_idata4;
static int no_idata5;
static char *exp_name;
@@ -3930,8 +3930,22 @@ main (int ac, char **av)
}
}
- if (!tmp_prefix)
- tmp_prefix = prefix_encode ("d", getpid ());
+ if (tmp_prefix == NULL)
+ {
+ /* If possible use a deterministic prefix. */
+ if (dll_name)
+ {
+ tmp_prefix = xmalloc (strlen (dll_name) + 2);
+ sprintf (tmp_prefix, "%s_", dll_name);
+ for (i = 0; tmp_prefix[i]; i++)
+ if (!ISALNUM (tmp_prefix[i]))
+ tmp_prefix[i] = '_';
+ }
+ else
+ {
+ tmp_prefix = prefix_encode ("d", getpid ());
+ }
+ }
for (i = 0; mtable[i].type; i++)
if (strcmp (mtable[i].type, mname) == 0)