summaryrefslogtreecommitdiff
path: root/ld/deffilep.y
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2006-04-01 04:51:23 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2006-04-01 04:51:23 +0000
commitb4fa427331e7d9d235009f70cf4a754dc6731e06 (patch)
tree90171663109e389a756812891777ca092ffdadd9 /ld/deffilep.y
parente0101069972318694ab690f80c1d791f0a1c51cf (diff)
downloadbinutils-redhat-b4fa427331e7d9d235009f70cf4a754dc6731e06.tar.gz
* 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
Diffstat (limited to 'ld/deffilep.y')
-rw-r--r--ld/deffilep.y40
1 files changed, 24 insertions, 16 deletions
diff --git a/ld/deffilep.y b/ld/deffilep.y
index 78da27a1d9..5c699f394f 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;
}