aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-10-20 13:49:00 +0000
committerAlan Modra <amodra@gmail.com>2001-10-20 13:49:00 +0000
commitb47c42085628603e890a783b8d2a612d19f66396 (patch)
tree8ce3bd00189f2d2b7172db7735c5f7587b9e1fb9
parentfd521b4750cb0df1c841700637de89a7b25cccf3 (diff)
downloadfsf-binutils-gdb-b47c42085628603e890a783b8d2a612d19f66396.zip
fsf-binutils-gdb-b47c42085628603e890a783b8d2a612d19f66396.tar.gz
fsf-binutils-gdb-b47c42085628603e890a783b8d2a612d19f66396.tar.bz2
* ldgram.y (mri_script_command): Surround processing of INCLUDE
with ldlex_script, ldlex_popstate. (ifile_p1): Likewise. * ldlex.l (EOF): Don't BEGIN(SCRIPT). Restore lineno from the correct slot. (lex_push_file): Save current lineno to lineno_stack. Set lineno to 1. Don't BEGIN(SCRIPT). (lex_redirect): Similarly. * ldmain.c (main): Set yydebug non-zero if YYDEBUG.
-rw-r--r--ld/ChangeLog12
-rw-r--r--ld/ldgram.y8
-rw-r--r--ld/ldlex.l13
-rw-r--r--ld/ldmain.c7
4 files changed, 31 insertions, 9 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 1ff2d26..50816d0 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,15 @@
+2001-10-20 Alan Modra <amodra@bigpond.net.au>
+
+ * ldgram.y (mri_script_command): Surround processing of INCLUDE
+ with ldlex_script, ldlex_popstate.
+ (ifile_p1): Likewise.
+ * ldlex.l (EOF): Don't BEGIN(SCRIPT). Restore lineno from the
+ correct slot.
+ (lex_push_file): Save current lineno to lineno_stack. Set lineno
+ to 1. Don't BEGIN(SCRIPT).
+ (lex_redirect): Similarly.
+ * ldmain.c (main): Set yydebug non-zero if YYDEBUG.
+
2001-10-20 Nick Clifton <nickc@cambridge.redhat.com>
* scripttempl/armcoff.sc: Define __EH_FRAME_BEGIN__ and
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 25d8d09..c57ad15 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -238,7 +238,9 @@ mri_script_command:
| CASE casesymlist
| EXTERN extern_name_list
| INCLUDE filename
- { ldfile_open_command_file ($2); } mri_script_lines END
+ { ldlex_script (); ldfile_open_command_file($2); }
+ mri_script_lines END
+ { ldlex_popstate (); }
| START NAME
{ lang_add_entry ($2, false); }
|
@@ -332,7 +334,9 @@ ifile_p1:
| MAP '(' filename ')'
{ lang_add_map($3); }
| INCLUDE filename
- { ldfile_open_command_file($2); } ifile_list END
+ { ldlex_script (); ldfile_open_command_file($2); }
+ ifile_list END
+ { ldlex_popstate (); }
| NOCROSSREFS '(' nocrossref_list ')'
{
lang_add_nocrossref ($3);
diff --git a/ld/ldlex.l b/ld/ldlex.l
index b43cfa3..95a31f5 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -418,11 +418,10 @@ V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
else
{
yy_switch_to_buffer(include_stack[include_stack_ptr]);
-
}
- BEGIN(SCRIPT);
+
ldfile_input_filename = file_name_stack[include_stack_ptr - 1];
- lineno = lineno_stack[include_stack_ptr - 1];
+ lineno = lineno_stack[include_stack_ptr];
return END;
}
@@ -446,13 +445,13 @@ lex_push_file (file, name)
einfo("%F:includes nested too deeply\n");
}
file_name_stack[include_stack_ptr] = name;
- lineno_stack[include_stack_ptr] = 1;
+ lineno_stack[include_stack_ptr] = lineno;
include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
include_stack_ptr++;
+ lineno = 1;
yyin = file;
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
- BEGIN (SCRIPT);
}
/* Return a newly created flex input buffer containing STRING,
@@ -512,12 +511,12 @@ lex_redirect (string)
einfo("%F: macros nested too deeply\n");
}
file_name_stack[include_stack_ptr] = "redirect";
- lineno_stack[include_stack_ptr] = 0;
+ lineno_stack[include_stack_ptr] = lineno;
include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
include_stack_ptr++;
+ lineno = 1;
tmp = yy_create_string_buffer (string, strlen (string));
yy_switch_to_buffer (tmp);
- BEGIN (SCRIPT);
}
/* Functions to switch to a different flex start condition,
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 578e34f..462e16a 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -196,6 +196,13 @@ main (argc, argv)
xexit (1);
}
+#if YYDEBUG
+ {
+ extern int yydebug;
+ yydebug = 1;
+ }
+#endif
+
/* Initialize the data about options. */
trace_files = trace_file_tries = version_printed = false;
whole_archive = false;