diff options
author | Jiaying Song <jiaying.song.cn@windriver.com> | 2024-08-13 10:31:21 +0800 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-08-28 22:29:40 +0930 |
commit | a253bea8995323201b016fe477280c1782688ab4 (patch) | |
tree | cd17e5da833bda5f589f2e019039568491b7636c | |
parent | c9652a062fe1a44ed1dd7eae53e847a85b8911e5 (diff) | |
download | gdb-a253bea8995323201b016fe477280c1782688ab4.zip gdb-a253bea8995323201b016fe477280c1782688ab4.tar.gz gdb-a253bea8995323201b016fe477280c1782688ab4.tar.bz2 |
dlltool: file name too long
During the execution of the command: i686-w64-mingw32-dlltool
--input-def $def_filepath --output-delaylib $filepath --dllname qemu.exe
An error occurred:
i686-w64-mingw32-dlltool: failed to open temporary head file: ..._w64_mingw32_nativesdk_qemu_8_2_2_build_plugins_libqemu_plugin_api_a_h.s
Due to the path length exceeding the Linux system's file name length
limit (NAME_MAX=255), the temporary file name generated by the
i686-w64-mingw32-dlltool command becomes too long to open. To address
this, a new temporary file name prefix is generated using tmp_prefix =
prefix_encode ("d", getpid()), ensuring that the file name does not
exceed the system's length limit.
Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
Reviewed-by: Alan Modra <amodra@gmail.com>
-rw-r--r-- | binutils/dlltool.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/binutils/dlltool.c b/binutils/dlltool.c index d75a99d..6dc16a9 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -4068,9 +4068,9 @@ main (int ac, char **av) if (tmp_prefix == NULL) { /* If possible use a deterministic prefix. */ - if (imp_name || delayimp_name) + const char *input = imp_name ? imp_name : delayimp_name; + if (input && strlen (input) + 2 <= NAME_MAX) { - const char *input = imp_name ? imp_name : delayimp_name; tmp_prefix = xmalloc (strlen (input) + 2); sprintf (tmp_prefix, "%s_", input); for (i = 0; tmp_prefix[i]; i++) @@ -4078,9 +4078,7 @@ main (int ac, char **av) tmp_prefix[i] = '_'; } else - { - tmp_prefix = prefix_encode ("d", getpid ()); - } + tmp_prefix = prefix_encode ("d", getpid ()); } mangle_defs (); |