2007-06-04 Olivier Hainque <hainque@adacore.com>
[binutils.git] / gold / main.cc
blobea65c2da27e10b50ba7adeed46c8ea581e360090
1 // main.cc -- gold main function.
3 #include "gold.h"
5 #include "options.h"
6 #include "dirsearch.h"
7 #include "workqueue.h"
8 #include "object.h"
9 #include "symtab.h"
10 #include "layout.h"
12 using namespace gold;
14 int
15 main(int argc, char** argv)
17 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
18 setlocale (LC_MESSAGES, "");
19 #endif
20 #if defined (HAVE_SETLOCALE)
21 setlocale (LC_CTYPE, "");
22 #endif
23 bindtextdomain (PACKAGE, LOCALEDIR);
24 textdomain (PACKAGE);
26 program_name = argv[0];
28 // Handle the command line options.
29 Command_line command_line;
30 command_line.process(argc - 1, argv + 1);
32 // The work queue.
33 Workqueue workqueue(command_line.options());
35 // The list of input objects.
36 Input_objects input_objects;
38 // The symbol table.
39 Symbol_table symtab;
41 // The layout object.
42 Layout layout(command_line.options());
44 // Get the search path from the -L options.
45 Dirsearch search_path;
46 search_path.add(&workqueue, command_line.options().search_path());
48 // Queue up the first set of tasks.
49 queue_initial_tasks(command_line.options(), search_path,
50 command_line, &workqueue, &input_objects,
51 &symtab, &layout);
53 // Run the main task processing loop.
54 workqueue.process();
56 gold_exit(true);