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.
26 #include "parameters.h"
27 #include "dirsearch.h"
28 #include "workqueue.h"
36 main(int argc, char** argv)
38 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
39 setlocale (LC_MESSAGES, "");
41 #if defined (HAVE_SETLOCALE)
42 setlocale (LC_CTYPE, "");
44 bindtextdomain (PACKAGE, LOCALEDIR);
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());
55 Workqueue workqueue(command_line.options());
57 // The list of input objects.
58 Input_objects input_objects;
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,
75 // Run the main task processing loop.