+
+keyword_as_name: BASE { $$ = "BASE"; }
+ | CODE { $$ = "CODE"; }
+ | CONSTANTU { $$ = "CONSTANT"; }
+ | CONSTANTL { $$ = "constant"; }
+ | DATAU { $$ = "DATA"; }
+ | DATAL { $$ = "data"; }
+ | DESCRIPTION { $$ = "DESCRIPTION"; }
+ | DIRECTIVE { $$ = "DIRECTIVE"; }
+ | EXECUTE { $$ = "EXECUTE"; }
+ | EXPORTS { $$ = "EXPORTS"; }
+ | HEAPSIZE { $$ = "HEAPSIZE"; }
+ | IMPORTS { $$ = "IMPORTS"; }
+/* Disable LIBRARY keyword as valid symbol-name. This is necessary
+ for libtool, which places this command after EXPORTS command.
+ This behavior is illegal by specification, but sadly required by
+ by compatibility reasons.
+ See PR binutils/13710
+ | LIBRARY { $$ = "LIBRARY"; } */
+ | NAME { $$ = "NAME"; }
+ | NONAMEU { $$ = "NONAME"; }
+ | NONAMEL { $$ = "noname"; }
+ | PRIVATEU { $$ = "PRIVATE"; }
+ | PRIVATEL { $$ = "private"; }
+ | READ { $$ = "READ"; }
+ | SHARED { $$ = "SHARED"; }
+ | STACKSIZE_K { $$ = "STACKSIZE"; }
+ | VERSIONK { $$ = "VERSION"; }
+ | WRITE { $$ = "WRITE"; }
+ ;
+
+opt_name2: ID { $$ = $1; }
+ | '.' keyword_as_name
+ {
+ char *name = xmalloc (strlen ($2) + 2);
+ sprintf (name, ".%s", $2);
+ $$ = name;
+ }
+ | '.' opt_name2
+ {
+ char *name = def_pool_alloc (strlen ($2) + 2);
+ sprintf (name, ".%s", $2);
+ $$ = name;
+ }
+ | keyword_as_name '.' opt_name2
+ {
+ char *name = def_pool_alloc (strlen ($1) + 1 + strlen ($3) + 1);
+ sprintf (name, "%s.%s", $1, $3);
+ $$ = name;
+ }
+ | ID '.' opt_name2
+ {
+ char *name = def_pool_alloc (strlen ($1) + 1 + strlen ($3) + 1);
+ sprintf (name, "%s.%s", $1, $3);
+ $$ = name;
+ }