#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
-#include "ld.h"
+#include "ld.h"
#include "ldexp.h"
#include "ldver.h"
#include "ldlang.h"
%type <name> memspec_at_opt
%type <cname> wildcard_name
%type <wildcard> wildcard_spec
-%token <bigint> INT
+%token <bigint> INT
%token <name> NAME LNAME
%type <integer> length
%type <phdr> phdr_qualifiers
%type <section_phdr> phdr_opt
%type <integer> opt_nocrossrefs
-%right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ
+%right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ
%right <token> '?' ':'
%left <token> OROR
%left <token> ANDAND
%left <token> '*' '/' '%'
%right UNARY
-%token END
+%token END
%left <token> '('
%token <token> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE
%token SECTIONS PHDRS SORT DATA_SEGMENT_ALIGN DATA_SEGMENT_END
%%
-file:
+file:
INPUT_SCRIPT script_file
| INPUT_MRI_SCRIPT mri_script_file
| INPUT_VERSION_SCRIPT version_script_file
}
;
-/* SYNTAX WITHIN AN MRI SCRIPT FILE */
+/* SYNTAX WITHIN AN MRI SCRIPT FILE */
mri_script_file:
{
ldlex_mri_script ();
;
mri_script_command:
- CHIP exp
+ CHIP exp
| CHIP exp ',' exp
| NAME {
einfo(_("%P%F: unrecognised keyword in MRI style script '%s'\n"),$1);
config.map_filename = "-";
}
| ORDER ordernamelist
- | ENDWORD
+ | ENDWORD
| PUBLIC NAME '=' exp
{ mri_public($2, $4); }
| PUBLIC NAME ',' exp
{ mri_public($2, $4); }
- | PUBLIC NAME exp
+ | PUBLIC NAME exp
{ mri_public($2, $3); }
| FORMAT NAME
{ mri_format($2); }
{ mri_alignmod($2,$4); }
| ABSOLUTE mri_abs_name_list
| LOAD mri_load_name_list
- | NAMEWORD NAME
- { mri_name($2); }
+ | NAMEWORD NAME
+ { mri_name($2); }
| ALIAS NAME ',' NAME
{ mri_alias($2,$4,0);}
| ALIAS NAME ',' INT
{ lang_leave_group (); }
| MAP '(' filename ')'
{ lang_add_map($3); }
- | INCLUDE filename
+ | INCLUDE filename
{ ldlex_script (); ldfile_open_command_file($2); }
ifile_list END
{ ldlex_popstate (); }
tmp = (struct name_list *) xmalloc (sizeof *tmp);
tmp->name = $2;
tmp->next = $1;
- $$ = tmp;
+ $$ = tmp;
}
|
wildcard_name
assignment end
| CREATE_OBJECT_SYMBOLS
{
- lang_add_attribute(lang_object_symbols_statement_enum);
+ lang_add_attribute(lang_object_symbols_statement_enum);
}
| ';'
| CONSTRUCTORS
{
-
- lang_add_attribute(lang_constructors_statement_enum);
+
+ lang_add_attribute(lang_constructors_statement_enum);
}
| SORT '(' CONSTRUCTORS ')'
{
{
lang_add_data ((int) $1, $3);
}
-
+
| FILL '(' fill_exp ')'
{
lang_add_fill ($3);
statement_list statement
| statement
;
-
+
statement_list_opt:
/* empty */
| statement_list
| NOFLOAT
{ lang_float(FALSE); }
;
-
+
nocrossref_list:
/* empty */
{
;
section: NAME { ldlex_expression(); }
- opt_exp_with_type
+ opt_exp_with_type
opt_at { ldlex_popstate (); ldlex_script (); }
'{'
{
sectype,
0, 0, 0, $4);
}
- statement_list_opt
+ statement_list_opt
'}' { ldlex_popstate (); ldlex_expression (); }
memspec_opt memspec_at_opt phdr_opt fill_opt
{
{ ldlex_expression (); }
opt_exp_without_type opt_nocrossrefs opt_at
{ ldlex_popstate (); ldlex_script (); }
- '{'
+ '{'
{
lang_enter_overlay ($3);
}
{
"PT_NULL", "PT_LOAD", "PT_DYNAMIC",
"PT_INTERP", "PT_NOTE", "PT_SHLIB",
- "PT_PHDR"
+ "PT_PHDR", "PT_TLS"
};
s = $1->name.name;
$$ = exp_intop (i);
break;
}
+ if (i == sizeof phdr_types / sizeof phdr_types[0])
+ {
+ if (strcmp (s, "PT_GNU_EH_FRAME") == 0)
+ $$ = exp_intop (0x6474e550);
+ else
+ {
+ einfo (_("\
+%X%P:%S: unknown phdr type `%s' (try integer literal)\n"),
+ s);
+ $$ = exp_intop (0);
+ }
+ }
}
}
;
%%
void
-yyerror(arg)
+yyerror(arg)
const char *arg;
-{
+{
if (ldfile_assumed_script)
einfo (_("%P:%s: file format not recognized; treating as linker script\n"),
ldfile_input_filename);