Add global parameters.
[external/binutils.git] / gold / main.cc
1 // main.cc -- gold main function.
2
3 #include "gold.h"
4
5 #include "options.h"
6 #include "parameters.h"
7 #include "dirsearch.h"
8 #include "workqueue.h"
9 #include "object.h"
10 #include "symtab.h"
11 #include "layout.h"
12
13 using namespace gold;
14
15 int
16 main(int argc, char** argv)
17 {
18 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
19   setlocale (LC_MESSAGES, "");
20 #endif
21 #if defined (HAVE_SETLOCALE)
22   setlocale (LC_CTYPE, "");
23 #endif
24   bindtextdomain (PACKAGE, LOCALEDIR);
25   textdomain (PACKAGE);
26
27   program_name = argv[0];
28
29   // Handle the command line options.
30   Command_line command_line;
31   command_line.process(argc - 1, argv + 1);
32   initialize_parameters(&command_line.options());
33
34   // The work queue.
35   Workqueue workqueue(command_line.options());
36
37   // The list of input objects.
38   Input_objects input_objects;
39
40   // The symbol table.
41   Symbol_table symtab;
42
43   // The layout object.
44   Layout layout(command_line.options());
45
46   // Get the search path from the -L options.
47   Dirsearch search_path;
48   search_path.add(&workqueue, command_line.options().search_path());
49
50   // Queue up the first set of tasks.
51   queue_initial_tasks(command_line.options(), search_path,
52                       command_line, &workqueue, &input_objects,
53                       &symtab, &layout);
54
55   // Run the main task processing loop.
56   workqueue.process();
57
58   gold_exit(true);
59 }