From a287798505606f72576811279a3d9825475f6225 Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Sat, 1 Apr 2006 04:51:23 +0000 Subject: [PATCH] * deffilep.y (def_image_name): If LIBRARY or NAME statement specifies an empty string, retain the name specified on command line. * ld.texinfo: Document above --- ld/ChangeLog | 7 +++++++ ld/deffilep.y | 40 ++++++++++++++++++++++++---------------- ld/ld.texinfo | 3 ++- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 1eba0438336..1835d115548 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2006-04-01 Danny Smith + + * deffilep.y (def_image_name): If LIBRARY or NAME statement + specifies an empty string, retain the name specified on command + line. + * ld.texinfo: Document above. + 2006-03-31 Jakub Jelinek * ldmisc.c (vfinfo): Revert 2005-10-05 changes. If diff --git a/ld/deffilep.y b/ld/deffilep.y index 78da27a1d97..5c699f394f8 100644 --- a/ld/deffilep.y +++ b/ld/deffilep.y @@ -648,22 +648,30 @@ def_file_add_directive (def_file *my_def, const char *param, int len) static void def_image_name (const char *name, int base, int is_dll) { - const char* image_name = lbasename (name); - if (image_name != name) - einfo ("%s:%d: Warning: path components stripped from %s, '%s'\n", - def_filename, linenumber, is_dll ? "LIBRARY" : "NAME", name); - if (def->name) - free (def->name); - /* Append the default suffix, if none specified. */ - if (strchr (image_name, '.') == 0) - { - const char * suffix = is_dll ? ".dll" : ".exe"; - - def->name = xmalloc (strlen (image_name) + strlen (suffix) + 1); - sprintf (def->name, "%s%s", image_name, suffix); - } - else - def->name = xstrdup (image_name); + /* If a LIBRARY or NAME statement is specified without a name, there is nothing + to do here. We retain the output filename specified on command line. */ + if (*name) + { + const char* image_name = lbasename (name); + if (image_name != name) + einfo ("%s:%d: Warning: path components stripped from %s, '%s'\n", + def_filename, linenumber, is_dll ? "LIBRARY" : "NAME", + name); + if (def->name) + free (def->name); + /* Append the default suffix, if none specified. */ + if (strchr (image_name, '.') == 0) + { + const char * suffix = is_dll ? ".dll" : ".exe"; + + def->name = xmalloc (strlen (image_name) + strlen (suffix) + 1); + sprintf (def->name, "%s%s", image_name, suffix); + } + else + def->name = xstrdup (image_name); + } + + /* Honor a BASE address statement, even if LIBRARY string is empty. */ def->base_address = base; def->is_dll = is_dll; } diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 1e3b3e873a6..55eb893c22f 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -5618,7 +5618,8 @@ specification @code{BASE = } may be used to specify a non-default base address for the image. If neither @code{LIBRARY } nor @code{NAME } is specified, -the internal name is the same as the filename specified on the command line. +or they specify an empty string, the internal name is the same as the +filename specified on the command line. The complete specification of an export symbol is: -- 2.30.2