Commit | Line | Data |
---|---|---|
5a6f7e2d ILT |
1 | // main.cc -- gold main function. |
2 | ||
6cb15b7f ILT |
3 | // Copyright 2006, 2007 Free Software Foundation, Inc. |
4 | // Written by Ian Lance Taylor <iant@google.com>. | |
5 | ||
6 | // This file is part of gold. | |
7 | ||
8 | // This program is free software; you can redistribute it and/or modify | |
9 | // it under the terms of the GNU General Public License as published by | |
10 | // the Free Software Foundation; either version 3 of the License, or | |
11 | // (at your option) any later version. | |
12 | ||
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | ||
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
21 | // MA 02110-1301, USA. | |
22 | ||
5a6f7e2d ILT |
23 | #include "gold.h" |
24 | ||
25 | #include "options.h" | |
7e1edb90 | 26 | #include "parameters.h" |
5a6f7e2d ILT |
27 | #include "dirsearch.h" |
28 | #include "workqueue.h" | |
29 | #include "object.h" | |
30 | #include "symtab.h" | |
31 | #include "layout.h" | |
32 | ||
33 | using namespace gold; | |
34 | ||
35 | int | |
36 | main(int argc, char** argv) | |
37 | { | |
38 | #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) | |
39 | setlocale (LC_MESSAGES, ""); | |
40 | #endif | |
41 | #if defined (HAVE_SETLOCALE) | |
42 | setlocale (LC_CTYPE, ""); | |
43 | #endif | |
44 | bindtextdomain (PACKAGE, LOCALEDIR); | |
45 | textdomain (PACKAGE); | |
46 | ||
47 | program_name = argv[0]; | |
48 | ||
49 | // Handle the command line options. | |
50 | Command_line command_line; | |
51 | command_line.process(argc - 1, argv + 1); | |
7e1edb90 | 52 | initialize_parameters(&command_line.options()); |
5a6f7e2d ILT |
53 | |
54 | // The work queue. | |
55 | Workqueue workqueue(command_line.options()); | |
56 | ||
57 | // The list of input objects. | |
58 | Input_objects input_objects; | |
59 | ||
60 | // The symbol table. | |
61 | Symbol_table symtab; | |
62 | ||
63 | // The layout object. | |
64 | Layout layout(command_line.options()); | |
65 | ||
66 | // Get the search path from the -L options. | |
67 | Dirsearch search_path; | |
ad2d6943 | 68 | search_path.initialize(&workqueue, &command_line.options().search_path()); |
5a6f7e2d ILT |
69 | |
70 | // Queue up the first set of tasks. | |
71 | queue_initial_tasks(command_line.options(), search_path, | |
72 | command_line, &workqueue, &input_objects, | |
73 | &symtab, &layout); | |
74 | ||
75 | // Run the main task processing loop. | |
76 | workqueue.process(); | |
77 | ||
78 | gold_exit(true); | |
79 | } |