diff options
author | Steve Chamberlain <sac@cygnus> | 1992-04-15 23:11:09 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1992-04-15 23:11:09 +0000 |
commit | 2e38b71d27d48f7a1698560a71decb528422174c (patch) | |
tree | a0fdb76b896ab62af0655e78238a2c5585dc251b | |
parent | 3d2b83ea49dc76204b0b068a56d8c9c37075b0d5 (diff) | |
download | gdb-2e38b71d27d48f7a1698560a71decb528422174c.zip gdb-2e38b71d27d48f7a1698560a71decb528422174c.tar.gz gdb-2e38b71d27d48f7a1698560a71decb528422174c.tar.bz2 |
Strange link script support
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/ldgram.y | 28 | ||||
-rw-r--r-- | ld/ldlex.l | 11 | ||||
-rw-r--r-- | ld/mri.c | 43 |
4 files changed, 73 insertions, 14 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 4dbb78e..ed5a8a6 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +Wed Apr 15 16:09:33 1992 Steve Chamberlain (sac@thepub.cygnus.com) + + * mri.c, ldgram.y, ldlex.l: added support for minimal strange link + scripts. + Thu Apr 9 05:52:02 1992 Ken Raeburn (Raeburn@Cygnus.COM) * Makefile.in (install): Install second copy in $(tooldir)/bin diff --git a/ld/ldgram.y b/ld/ldgram.y index d6a4830..9c882f7 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -126,7 +126,7 @@ struct sec *section; /*%token <token> '+' '-' '*' '/' '%'*/ %right UNARY -%token END +%token END %left <token> '(' %token <token> ALIGN_K BLOCK LONG SHORT BYTE %token SECTIONS @@ -152,7 +152,7 @@ struct sec *section; %type <name> filename -%token CHIP LIST SECT ABSOLUTE LOAD +%token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD FORMAT %{ ld_config_type config; @@ -345,22 +345,25 @@ mri_script_file: ; mri_script_lines: - mri_script_lines mri_script_line - | + mri_script_lines mri_script_command NEWLINE + | ; -mri_script_line: +mri_script_command: CHIP exp | CHIP exp ',' exp | NAME { - einfo("%P%F: unrecognised keyword in MRI style script '%s'\n", - $1); + einfo("%P%F: unrecognised keyword in MRI style script '%s'\n",$1); } | LIST { write_map = true; config.map_filename = "-"; } - | SECT NAME ',' exp + | ORDER ordernamelist + | ENDWORD + | FORMAT NAME + { mri_format($2); } + | SECT NAME ',' exp { mri_output_section($2, $4);} | SECT NAME exp { mri_output_section($2, $3);} @@ -368,6 +371,15 @@ mri_script_line: { mri_output_section($2, $4);} | ABSOLUTE mri_abs_name_list | LOAD mri_load_name_list + | NAMEWORD NAME + { mri_name($2); } + | + ; + +ordernamelist: + ordernamelist ',' NAME { mri_order($3); } + | ordernamelist NAME { mri_order($2); } + | ; mri_load_name_list: @@ -65,7 +65,7 @@ unsigned int include_stack_ptr = 0; %a 4000 %o 5000 FILENAMECHAR1 [_a-zA-Z\/\.\\] -FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\] +FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\] FILENAME {FILENAMECHAR}+ WHITE [ \t\n]+ @@ -277,12 +277,15 @@ WHITE [ \t\n]+ <BOTH,SCRIPT>"org" { RTOKEN(ORIGIN);} <BOTH,SCRIPT>"l" { RTOKEN( LENGTH);} <BOTH,SCRIPT>"len" { RTOKEN( LENGTH);} - +<MRI>"\n" { ++ lineno; RTOKEN(NEWLINE); } <MRI>^"*".* { /* Mri comment line */ } -<MRI>\n { ++ lineno; } +<MRI>"END" { RTOKEN(ENDWORD); } <MRI>"CHIP" { RTOKEN(CHIP); } <MRI>"LOAD" { RTOKEN(LOAD); } -<MRI>"LIST".*\n { RTOKEN(LIST); /* LIST and ignore to end of line */ } +<MRI>"ORDER" { RTOKEN(ORDER); } +<MRI>"NAME" { RTOKEN(NAMEWORD); } +<MRI>"FORMAT" { RTOKEN(FORMAT); } +<MRI>"LIST".* { RTOKEN(LIST); /* LIST and ignore to end of line */ } <MRI>"SECT" { RTOKEN(SECT); } <MRI>"ABSOLUTE" { RTOKEN(ABSOLUTE); } @@ -47,15 +47,19 @@ DEFUN(mri_output_section, (name, vma), os->flags = 0; os->block_value = 0; - } +} /* if any ABSOLUTE <name> are in the script, only load those files marked thus */ void DEFUN(mri_only_load,(name), CONST char *name) - { +{ + lang_output_section_statement_type *os; + os = lang_output_section_statement_lookup(name); + os->flags = 0; + os->block_value = 0; } @@ -67,3 +71,38 @@ DEFUN(mri_load,(name), lang_add_input_file(name, lang_input_file_is_file_enum, (char *)NULL); } + + +void +DEFUN(mri_order,(name), + CONST char *name) +{ +einfo("Ignoring ORDER %s for the moment\n", name); + +} + +void +DEFUN(mri_name,(name), + CONST char *name) +{ + lang_add_output(name); + +} + + +void +DEFUN(mri_format,(name), + CONST char *name) +{ + if (strcmp(name, "S") == 0) + { + lang_add_output_format("srec"); + } + else if (strcmp(name, "IEEE") == 0) + { + lang_add_output_format("ieee"); + } + else { + einfo("%P%F: unknown format type %s\n", name); + } +} |