From: Steve Chamberlain Date: Wed, 15 Apr 1992 23:11:09 +0000 (+0000) Subject: Strange link script support X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e38b71d27d48f7a1698560a71decb528422174c;p=binutils-gdb.git Strange link script support --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 4dbb78eedb6..ed5a8a651ad 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 d6a48300a6d..9c882f781d2 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -126,7 +126,7 @@ struct sec *section; /*%token '+' '-' '*' '/' '%'*/ %right UNARY -%token END +%token END %left '(' %token ALIGN_K BLOCK LONG SHORT BYTE %token SECTIONS @@ -152,7 +152,7 @@ struct sec *section; %type 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: diff --git a/ld/ldlex.l b/ld/ldlex.l index c2eb5ea6a20..f4ffc4ce635 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -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]+ "org" { RTOKEN(ORIGIN);} "l" { RTOKEN( LENGTH);} "len" { RTOKEN( LENGTH);} - +"\n" { ++ lineno; RTOKEN(NEWLINE); } ^"*".* { /* Mri comment line */ } -\n { ++ lineno; } +"END" { RTOKEN(ENDWORD); } "CHIP" { RTOKEN(CHIP); } "LOAD" { RTOKEN(LOAD); } -"LIST".*\n { RTOKEN(LIST); /* LIST and ignore to end of line */ } +"ORDER" { RTOKEN(ORDER); } +"NAME" { RTOKEN(NAMEWORD); } +"FORMAT" { RTOKEN(FORMAT); } +"LIST".* { RTOKEN(LIST); /* LIST and ignore to end of line */ } "SECT" { RTOKEN(SECT); } "ABSOLUTE" { RTOKEN(ABSOLUTE); } diff --git a/ld/mri.c b/ld/mri.c index fd2edcf14bc..04ee9d29b3f 100644 --- a/ld/mri.c +++ b/ld/mri.c @@ -47,15 +47,19 @@ DEFUN(mri_output_section, (name, vma), os->flags = 0; os->block_value = 0; - } +} /* if any ABSOLUTE 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); + } +}