Add licensing text to every source file.
[binutils.git] / gold / main.cc
blobe1135e987412c2bbabb7459c77863be3346c963f
1 // main.cc -- gold main function.
3 // Copyright 2006, 2007 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
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.
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.
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.
23 #include "gold.h"
25 #include "options.h"
26 #include "parameters.h"
27 #include "dirsearch.h"
28 #include "workqueue.h"
29 #include "object.h"
30 #include "symtab.h"
31 #include "layout.h"
33 using namespace gold;
35 int
36 main(int argc, char** argv)
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);
47 program_name = argv[0];
49 // Handle the command line options.
50 Command_line command_line;
51 command_line.process(argc - 1, argv + 1);
52 initialize_parameters(&command_line.options());
54 // The work queue.
55 Workqueue workqueue(command_line.options());
57 // The list of input objects.
58 Input_objects input_objects;
60 // The symbol table.
61 Symbol_table symtab;
63 // The layout object.
64 Layout layout(command_line.options());
66 // Get the search path from the -L options.
67 Dirsearch search_path;
68 search_path.add(&workqueue, command_line.options().search_path());
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);
75 // Run the main task processing loop.
76 workqueue.process();
78 gold_exit(true);