Strange link script support

This commit is contained in:
Steve Chamberlain 1992-04-15 23:11:09 +00:00
parent 3d2b83ea49
commit 2e38b71d27
4 changed files with 73 additions and 14 deletions

View File

@ -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

View File

@ -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:

View File

@ -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); }

View File

@ -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);
}
}