From a880c7485ce602503bce7b5b9cd5970ad52e5725 Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Sun, 16 Jan 2005 09:18:35 +0000 Subject: [PATCH] * defilep.y (def_name, def_library): Combine into... (def_image_name): New function. Strip name to basename, with warning. --- ld/ChangeLog | 6 ++++++ ld/deffilep.y | 27 ++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index d072d91864c..c81d57dc8c4 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2005-01-16 Danny Smith + + * defilep.y (def_name, def_library): Combine into... + (def_image_name): New function. Strip name to basename, + with warning. + 2005-01-12 Mark Kettenis * configure.in: Be sure to invoke config.sub using the shell. diff --git a/ld/deffilep.y b/ld/deffilep.y index 80cf5487f57..5dc26c6cb39 100644 --- a/ld/deffilep.y +++ b/ld/deffilep.y @@ -83,8 +83,7 @@ static void def_exports (const char *, const char *, int, int); static void def_heapsize (int, int); static void def_import (const char *, const char *, const char *, const char *, int); -static void def_library (const char *, int); -static void def_name (const char *, int); +static void def_image_name (const char *, int, int); static void def_section (const char *, int); static void def_section_alt (const char *, const char *); static void def_stacksize (int, int); @@ -122,8 +121,8 @@ start: start command ; command: - NAME opt_name opt_base { def_name ($2, $3); } - | LIBRARY opt_name opt_base { def_library ($2, $3); } + NAME opt_name opt_base { def_image_name ($2, $3, 0); } + | LIBRARY opt_name opt_base { def_image_name ($2, $3, 1); } | DESCRIPTION ID { def_description ($2);} | STACKSIZE NUMBER opt_number { def_stacksize ($2, $3);} | HEAPSIZE NUMBER opt_number { def_heapsize ($2, $3);} @@ -647,23 +646,17 @@ def_file_add_directive (def_file *my_def, const char *param, int len) /* Parser Callbacks. */ static void -def_name (const char *name, int base) +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); - def->name = xstrdup (name); + def->name = xstrdup (image_name); def->base_address = base; - def->is_dll = 0; -} - -static void -def_library (const char *name, int base) -{ - if (def->name) - free (def->name); - def->name = xstrdup (name); - def->base_address = base; - def->is_dll = 1; + def->is_dll = is_dll; } static void -- 2.30.2