aboutsummaryrefslogtreecommitdiff
path: root/ld/deffilep.y
diff options
context:
space:
mode:
Diffstat (limited to 'ld/deffilep.y')
-rw-r--r--ld/deffilep.y11
1 files changed, 10 insertions, 1 deletions
diff --git a/ld/deffilep.y b/ld/deffilep.y
index d349537..78da27a 100644
--- a/ld/deffilep.y
+++ b/ld/deffilep.y
@@ -654,7 +654,16 @@ def_image_name (const char *name, int base, int is_dll)
def_filename, linenumber, is_dll ? "LIBRARY" : "NAME", name);
if (def->name)
free (def->name);
- def->name = xstrdup (image_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);
def->base_address = base;
def->is_dll = is_dll;
}