Implement SIZEOF_HEADERS, section constraints, other minor linker
[deliverable/binutils-gdb.git] / gold / script.cc
index 734349b891d7ed0bb6d89cfd2106032b9f93b40b..973c05ce6df9d5c7c351e5da4a24622802689b80 100644 (file)
@@ -393,7 +393,9 @@ Lex::can_start_name(char c, char c2)
       return this->mode_ == LINKER_SCRIPT && can_continue_name(&c2);
 
     case '*': case '[': 
-      return this->mode_ == VERSION_SCRIPT;
+      return (this->mode_ == VERSION_SCRIPT
+             || (this->mode_ == LINKER_SCRIPT
+                 && can_continue_name(&c2)));
 
     default:
       return false;
@@ -1607,6 +1609,7 @@ script_keyword_parsecodes[] =
   { "SHORT", SHORT },
   { "SIZEOF", SIZEOF },
   { "SIZEOF_HEADERS", SIZEOF_HEADERS },
+  { "SORT", SORT_BY_NAME },
   { "SORT_BY_ALIGNMENT", SORT_BY_ALIGNMENT },
   { "SORT_BY_NAME", SORT_BY_NAME },
   { "SPECIAL", SPECIAL },
@@ -2145,6 +2148,24 @@ script_parse_option(void* closurev, const char* option, size_t length)
     }
 }
 
+// Called by the bison parser to handle SEARCH_DIR.  This is handled
+// exactly like a -L option.
+
+extern "C" void
+script_add_search_dir(void* closurev, const char* option, size_t length)
+{
+  Parser_closure* closure = static_cast<Parser_closure*>(closurev);
+  if (closure->command_line() == NULL)
+    gold_warning(_("%s:%d:%d: ignoring SEARCH_DIR; SEARCH_DIR is only valid"
+                  " for scripts specified via -T/--script"),
+                closure->filename(), closure->lineno(), closure->charpos());
+  else
+    {
+      std::string s = "-L" + std::string(option, length);
+      script_parse_option(closurev, s.c_str(), s.size());
+    }
+}
+
 /* Called by the bison parser to push the lexer into expression
    mode.  */
 
This page took 0.026178 seconds and 4 git commands to generate.