aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-08-12 07:59:28 +0000
committerNick Clifton <nickc@redhat.com>2001-08-12 07:59:28 +0000
commitb9a8de1ea39d0e4fb34407388382f192f2304e80 (patch)
treed67bc37e72469440c1f145f88445709618c006f5
parent6ca173e32ce4933fec50f130d36dd07e20391af5 (diff)
downloadgdb-b9a8de1ea39d0e4fb34407388382f192f2304e80.zip
gdb-b9a8de1ea39d0e4fb34407388382f192f2304e80.tar.gz
gdb-b9a8de1ea39d0e4fb34407388382f192f2304e80.tar.bz2
Make --verbose always display linker script
-rw-r--r--ld/ChangeLog19
-rw-r--r--ld/ld.h2
-rw-r--r--ld/ld.texinfo2
-rw-r--r--ld/ldfile.c3
-rw-r--r--ld/ldgram.y2
-rw-r--r--ld/ldmain.c47
-rw-r--r--ld/lexsup.c6
7 files changed, 63 insertions, 18 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 94f54c5..f9974c3 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,22 @@
+2001-08-12 H.J. Lu <hjl@gnu.org>
+ Andrew Haley <aph@cambridge.redhat.com>
+ Nick Clifton <nickc@redhat.com>
+
+ * ldgram.y (had_script): Change name to saved_script_handle.
+ Change type to file handle.
+ * ld.h (had_script): Rename and retype.
+ * ldfile.c (ldfile_open_command_file): Save the file handle
+ used in saved_script_handle.
+ * lexsup.c (parse_args): Do not allow -c option to alter
+ saved_script_handle.
+ * ldmain.c (main): Print out the linker script used if
+ --verbose is given. Check saved_script_handle to obtain the
+ external linker script used, or if NULL, dump the builtin
+ script.
+ * ld.texinfo: Document that --verbose now dumps the linker
+ script used, regardless of whether it was an internal or an
+ external script.
+
2001-08-10 Andreas Jaeger <aj@suse.de>
* configure.in: Add -Wstrict-prototypes and -Wmissing-prototypes
diff --git a/ld/ld.h b/ld/ld.h
index 71ac5c9..fef40a5 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -221,7 +221,7 @@ typedef enum {
lang_final_phase_enum
} lang_phase_type;
-extern boolean had_script;
+extern FILE * saved_script_handle;
extern boolean force_make_executable;
/* Non-zero if we are processing a --defsym from the command line. */
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index a8778d9..82e7fc4 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -1339,7 +1339,7 @@ for compatibility with other linkers, you may omit the leading
@itemx --verbose
Display the version number for @code{ld} and list the linker emulations
supported. Display which input files can and cannot be opened. Display
-the linker script if using a default builtin script.
+the linker script being used by the linker.
@kindex --version-script=@var{version-scriptfile}
@cindex version script, symbol versions
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 0e4d0ec..001f71a 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -350,7 +350,8 @@ ldfile_open_command_file (name)
ldfile_input_filename = name;
lineno = 1;
- had_script = true;
+
+ saved_script_handle = ldlex_input_stack;
}
#ifdef GNU960
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 5e9fd62..f9c6058 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -50,7 +50,7 @@ static enum section_type sectype;
lang_memory_region_type *region;
boolean ldgram_want_filename = true;
-boolean had_script = false;
+FILE * saved_script_handle = false;
boolean force_make_executable = false;
boolean ldgram_in_script = false;
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 7a450e8..849e0ae 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -296,23 +296,17 @@ main (argc, argv)
the -L's in argv have been processed. */
set_scripts_dir ();
- if (had_script == false)
+ /* If we have not already opened and parsed a linker script
+ read the emulation's appropriate default script. */
+ if (saved_script_handle == false)
{
- /* Read the emulation's appropriate default script. */
int isfile;
- char *s = ldemul_get_script (&isfile);
+ char *s = ldemul_get_script (& isfile);
if (isfile)
ldfile_open_command_file (s);
else
- {
- if (trace_file_tries)
- {
- info_msg (_("using internal linker script:\n"));
- info_msg ("==================================================\n");
- info_msg (s);
- info_msg ("\n==================================================\n");
- }
+ {
lex_string = s;
lex_redirect (s);
}
@@ -321,6 +315,37 @@ main (argc, argv)
lex_string = NULL;
}
+ if (trace_file_tries)
+ {
+ info_msg (_("using %s linker script:\n"),
+ saved_script_handle ? "external" : "internal");
+ info_msg ("==================================================\n");
+
+ if (saved_script_handle)
+ {
+ const int BSIZE = 8192;
+ size_t n;
+ char *buf = xmalloc (BSIZE);
+
+ rewind (saved_script_handle);
+ while ((n = fread (buf, 1, BSIZE - 1, saved_script_handle)) > 0)
+ {
+ buf [n] = 0;
+ info_msg (buf);
+ }
+ rewind (saved_script_handle);
+ free (buf);
+ }
+ else
+ {
+ int isfile;
+
+ info_msg (ldemul_get_script (& isfile));
+ }
+
+ info_msg ("\n==================================================\n");
+ }
+
lang_final ();
if (lang_has_input_file == false)
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 91a1f1d..7e23a7d 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1017,11 +1017,11 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
version information. Read it, but don't assume that
we've seen a linker script. */
{
- boolean hold_had_script;
+ FILE * hold_script_handle;
- hold_had_script = had_script;
+ hold_script_handle = saved_script_handle;
ldfile_open_command_file (optarg);
- had_script = hold_had_script;
+ saved_script_handle = hold_script_handle;
parser_input = input_version_script;
yyparse ();
}