]> git.tdb.fi Git - builder.git/blob - source/gnulinker.h
713b978064747ab570b15f9cbc764ddaa149b014
[builder.git] / source / gnulinker.h
1 #ifndef GNULINKER_H_
2 #define GNULINKER_H_
3
4 #include "tool.h"
5
6 class Binary;
7
8 /**
9 The GNU linker.  Turns ObjectFiles into Executables and SharedLibraries.  To
10 create a shared library, specify "shared" as the second argument to
11 create_target.
12
13 Uses either gcc or g++ depending on what was used to compile the object files.
14 */
15 class GnuLinker: public Tool
16 {
17 private:
18         class Linker: public SubTool
19         {
20         private:
21                 std::string compiler_tag;
22
23         public:
24                 Linker(GnuLinker &, const std::string &);
25
26                 std::string create_build_signature(const BuildInfo &) const override;
27         private:
28                 void do_prepare() override;
29
30         public:
31                 static Task *_run(const Binary &);
32         };
33
34         Linker *default_linker = 0;
35         Linker *cxx_linker = 0;
36
37 public:
38         GnuLinker(Builder &, const Architecture &);
39         ~GnuLinker();
40
41         Target *create_target(const std::vector<Target *> &, const std::string &) override;
42         Target *create_install(Target &) const override;
43 protected:
44         void do_prepare() override;
45 };
46
47 #endif