+Fri Jan 8 14:39:07 1993 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ Fix support for NOLOAD, add INCLUDE
+ * ldfile.c (ldfile_open_command_file): pass file name to
+ lex_push_file.
+ * ldlex.l, ldgram.y: tidy up, parse INCLUDE and NOLOAD
+ * ldlang.c (wild_doit): make output sections inherit NEVER_LOAD
+ attribute.
+
+Thu Jan 7 10:22:19 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
+
+ * Makefile.in, config.h: no more default emulation. Make the lack
+ of emulation a compile time error
+
+Wed Jan 6 01:08:37 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
+
+ * configure.in: recognise all sparclite variants, not just 'sparclite'
+
Mon Dec 28 11:15:35 1992 Ian Lance Taylor (ian@cygnus.com)
* m68kcoff.sc-sh: define _end as well as end, for consistency with
extern boolean write_map;
extern boolean option_longmap;
boolean hex_mode;
-
+static int typebits;
strip_symbols_type strip_symbols=STRIP_NONE;
discard_locals_type discard_locals=DISCARD_NONE;
#ifdef __STDC__
void lang_add_data(int type, union etree_union *exp);
-void lang_enter_output_section_statement(char *output_section_statement_name, etree_type *address_exp, int flags, bfd_vma block_value);
+void lang_enter_output_section_statement(char *output_section_statement_name, etree_type *address_exp, int flags, bfd_vma block_value,etree_type*,etree_type*);
#else
}
-%type <etree> exp opt_exp mustbe_exp
-%type <integer> fill_opt opt_block opt_type
+%type <etree> exp opt_exp_with_type mustbe_exp
+%type <integer> fill_opt
%type <name> memspec_opt
%token <integer> INT
%token <name> NAME
%token '{' '}'
%token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH
%token SIZEOF_HEADERS
+%token INCLUDE
%token MEMORY DEFSYMEND
%token NOLOAD DSECT COPY INFO OVERLAY
%token NAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY
%token OPTION_v OPTION_V OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT
%token OPTION_Map
%token OPTION_n OPTION_r OPTION_o OPTION_b OPTION_R OPTION_relax
-%token <name> OPTION_l OPTION_L OPTION_T OPTION_Aarch OPTION_Tfile OPTION_Texp
+%token <name> OPTION_l OPTION_L OPTION_T OPTION_Aarch OPTION_Tfile OPTION_Texp
+%token <name> OPTION_y
%token OPTION_Ur
%token ORIGIN FILL OPTION_g
-%token LENGTH CREATE_OBJECT_SYMBOLS INPUT OUTPUT CONSTRUCTORS
+%token LENGTH CREATE_OBJECT_SYMBOLS INPUT OUTPUT CONSTRUCTORS
+%token OPTION_RETAIN_SYMBOLS_FILE ALIGNMOD
+
%type <token> assign_op
%type <name> filename
%token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD
-%token FORMAT PUBLIC DEFSYMEND BASE ALIAS
+%token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE
%{
ld_config_type config;
lang_section_start($1,exp_intop($3));
hex_mode = 0;
}
-
+ | OPTION_y
+ {
+ add_ysym($1);
+ }
| OPTION_Aarch
{
ldfile_add_arch($1);
| OPTION_T filename
{ ldfile_open_command_file($2); } script_file
-END { ldlex_command();}
+ END { ldlex_command();}
| OPTION_l
{
| OPTION_defsym { ldlex_defsym(); }
NAME '=' exp DEFSYMEND { ldlex_popstate();
lang_add_assignment(exp_assop($4,$3,$5));
- }
+ }
+ | OPTION_RETAIN_SYMBOLS_FILE filename
+ { lang_add_keepsyms_file ($2); }
| '-' NAME
{ info("%P%F Unrecognized option -%s\n", $2); }
{ mri_output_section($2, $3);}
| SECT NAME '=' exp
{ mri_output_section($2, $4);}
+ | ALIGN_K NAME '=' exp
+ { mri_align($2,$4); }
+ | ALIGNMOD NAME '=' exp
+ { mri_alignmod($2,$4); }
| ABSOLUTE mri_abs_name_list
| LOAD mri_load_name_list
| NAMEWORD NAME
{ mri_alias($2,0,$4);}
| BASE exp
{ mri_base($2); }
+ | TRUNCATE INT
+ { mri_truncate($2); }
|
;
| INPUT '(' input_list ')'
| MAP '(' filename ')'
{ lang_add_map($3); }
+ | INCLUDE filename
+ { ldfile_open_command_file($2); } ifile_list END
;
input_list:
section: NAME { ldlex_expression(); }
- opt_exp { ldlex_popstate(); }
- opt_type opt_block ':' opt_things'{'
+ opt_exp_with_type { ldlex_popstate(); }
+ '{'
{
- lang_enter_output_section_statement($1,$3,$5,$6);
+ lang_enter_output_section_statement($1,$3,typebits,0,0,0);
}
- statement '}' {ldlex_expression();} fill_opt memspec_opt
+ statement
+ '}' {ldlex_expression();} fill_opt memspec_opt
{
ldlex_popstate();
- lang_leave_output_section_statement($14, $15);
+ lang_leave_output_section_statement($10, $11);
}
opt_comma
;
-opt_type:
- NOLOAD { $$ = SEC_NEVER_LOAD; }
- | DSECT { $$ = 0; }
- | COPY { $$ = 0; }
- | INFO { $$ = 0; }
- | OVERLAY { $$ = 0; }
- | { $$ = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; }
+type:
+ NOLOAD { typebits = SEC_NEVER_LOAD; }
+ | DSECT { typebits = 0; }
+ | COPY { typebits = 0; }
+ | INFO { typebits = 0; }
+ | OVERLAY { typebits = 0; }
+ | { typebits = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; }
;
-opt_things:
- {
- };
-
-opt_exp:
- exp
- { $$ = $1; }
- | { $$= (etree_type *)NULL; }
+opt_exp_with_type:
+ exp ':' { $$ = $1; typebits =0;}
+ | exp '(' type ')' ':' { $$ = $1; }
+ | ':' { $$= (etree_type *)NULL; typebits = 0}
;
-opt_block:
- BLOCK '(' exp ')'
- { $$ = exp_get_value_int($3,
- 1L,
- "block",
- lang_first_phase_enum);
- }
- | { $$ = 1; }
- ;
-
memspec_opt:
'>' NAME
{ $$ = $2; }
#define YY_FATAL_ERROR ;
#define MAX_INCLUDE_DEPTH 10
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+char *file_name_stack[MAX_INCLUDE_DEPTH];
unsigned int include_stack_ptr = 0;
<BOTH,SCRIPT>"SEARCH_DIR" { RTOKEN(SEARCH_DIR);}
<BOTH,SCRIPT>"OUTPUT" { RTOKEN(OUTPUT);}
<BOTH,SCRIPT>"INPUT" { RTOKEN(INPUT);}
-<BOTH,SCRIPT>"DEFINED" { RTOKEN(DEFINED);}
+<EXPRESSION,BOTH,SCRIPT>"DEFINED" { RTOKEN(DEFINED);}
<BOTH,SCRIPT>"CREATE_OBJECT_SYMBOLS" { RTOKEN(CREATE_OBJECT_SYMBOLS);}
<BOTH,SCRIPT>"CONSTRUCTORS" { RTOKEN( CONSTRUCTORS);}
<BOTH,SCRIPT>"FORCE_COMMON_ALLOCATION" { RTOKEN(FORCE_COMMON_ALLOCATION);}
<BOTH,SCRIPT>"SHORT" { RTOKEN( SHORT);}
<BOTH,SCRIPT>"BYTE" { RTOKEN( BYTE);}
<BOTH,SCRIPT>"NOFLOAT" { RTOKEN(NOFLOAT);}
-<BOTH,SCRIPT>"NOLOAD" { RTOKEN(NOLOAD);}
+<EXPRESSION,BOTH,SCRIPT>"NOLOAD" { RTOKEN(NOLOAD);}
<BOTH,SCRIPT>"DSECT" { RTOKEN(DSECT);}
<BOTH,SCRIPT>"COPY" { RTOKEN(COPY);}
<BOTH,SCRIPT>"INFO" { RTOKEN(INFO);}
<BOTH,SCRIPT>"org" { RTOKEN(ORIGIN);}
<BOTH,SCRIPT>"l" { RTOKEN( LENGTH);}
<BOTH,SCRIPT>"len" { RTOKEN( LENGTH);}
+<BOTH,SCRIPT>"INCLUDE" { RTOKEN(INCLUDE);}
<MRI>"\n" { ++ lineno; RTOKEN(NEWLINE); }
<MRI>"*".* { /* Mri comment line */ }
<MRI>"END" { RTOKEN(ENDWORD); }
<MRI,COMMAND,BOTH,SCRIPT,EXPRESSION>[ \t]
<<EOF>> {
- include_stack_ptr--;
+ extern char *ldfile_input_filename;
+ include_stack_ptr--;
- if (include_stack_ptr == 0)
- {
- yyterminate();
- }
- else
- {
- yy_switch_to_buffer(include_stack[include_stack_ptr]);
- }
- BEGIN(COMMAND);
- return END;
+ if (include_stack_ptr == 0)
+ {
+ yyterminate();
+ }
+ else
+ {
+ yy_switch_to_buffer(include_stack[include_stack_ptr]);
+
+ }
+ if (include_stack_ptr==1)
+ {
+ BEGIN(COMMAND);
+ }
+ else
+ {
+ ldfile_input_filename = file_name_stack[include_stack_ptr-1];
}
+
+ return END;
+}
%%
void
-DEFUN(lex_push_file,(file),
- FILE *file)
+DEFUN(lex_push_file,(file,name),
+ FILE *file AND
+ char *name)
{
if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
{
einfo("%F:includes nested too deeply");
}
- include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
+ file_name_stack[include_stack_ptr] = name;
+ include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
+
+ include_stack_ptr++;
yyin = file;
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
YY_BUFFER_STATE tmp;
int len = strlen(string);
-yy_init = 0 ;
+ yy_init = 0 ;
if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
{
einfo("%F: macros nested too deeply");
}
- include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
-
+ file_name_stack[include_stack_ptr] = "redirect";
+ include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
+ include_stack_ptr++;
tmp = yy_create_string_buffer(string, len);
yy_switch_to_buffer(tmp);
BEGIN(COMMAND);
-yyout = stdout;
+ yyout = stdout;
}
int state_stack[20];
void
DEFUN_VOID(ldlex_script)
{
-*(state_stack_p)++ = yy_start;
+ *(state_stack_p)++ = yy_start;
-BEGIN(SCRIPT);
+ BEGIN(SCRIPT);
}
void
DEFUN_VOID(ldlex_mri_script)
{
-*(state_stack_p)++ = yy_start;
-BEGIN(MRI);
+ *(state_stack_p)++ = yy_start;
+ BEGIN(MRI);
}
void
DEFUN_VOID(ldlex_defsym)
{
-*(state_stack_p)++ = yy_start;
-BEGIN(DEFSYMEXP);
+ *(state_stack_p)++ = yy_start;
+ BEGIN(DEFSYMEXP);
}
void
DEFUN_VOID(ldlex_expression)
{
-*(state_stack_p)++ = yy_start;
-BEGIN(EXPRESSION);
+ *(state_stack_p)++ = yy_start;
+ BEGIN(EXPRESSION);
}
void
DEFUN_VOID(ldlex_both)
{
-*(state_stack_p)++ = yy_start;
-BEGIN(BOTH);
+ *(state_stack_p)++ = yy_start;
+ BEGIN(BOTH);
}
void
DEFUN_VOID(ldlex_command)
{
-*(state_stack_p)++ = yy_start;
-BEGIN(COMMAND);
+ *(state_stack_p)++ = yy_start;
+ BEGIN(COMMAND);
}
void
DEFUN_VOID(ldlex_popstate)
{
-yy_start = *(--state_stack_p);
+ yy_start = *(--state_stack_p);
}
yy_input(buf, result, max_size)