source: rtems-tools/linkers/rld-cc.h @ 3f5e31f

4.104.115
Last change on this file since 3f5e31f was 8807135, checked in by Chris Johns <chrisj@…>, on 09/06/14 at 10:19:45

Refactor the CC flags. Fix the various linkers. The trace linker is compiling.

  • Property mode set to 100644
File size: 5.6 KB
Line 
1/*
2 * Copyright (c) 2011-2014, Chris Johns <chrisj@rtems.org>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16/**
17 * @file
18 *
19 * @ingroup rtems-ld
20 *
21 * @brief Various calls to CC.
22 *
23 */
24
25#if !defined (_RLD_CC_H_)
26#define _RLD_CC_H_
27
28#include <string>
29
30#include <rld-files.h>
31#include <rld-process.h>
32
33namespace rld
34{
35  namespace cc
36  {
37    /*
38     * The type of flags.
39     */
40    enum flag_type
41    {
42      ft_cppflags = 1 << 0,
43      ft_cflags   = 1 << 1,
44      ft_cxxflags = 1 << 2,
45      ft_ldflags  = 1 << 3
46    };
47
48    /*
49     * Flags groups.
50     */
51    enum flag_group
52    {
53      fg_warning_flags,
54      fg_include_flags,
55      fg_machine_flags,
56      fg_spec_flags
57    };
58
59    /**
60     * Strip the flags of -O and -g options.
61     *
62     * @param flags The flags a space delimited list to strip.
63     * @return const std::string The stripped flags.
64     */
65    const std::string strip_cflags (const std::string& flags);
66
67    /**
68     * Filter the flags. Provide the type of flags being passed, the flags as a
69     * space separated list, the architure, and a path. Provide strings
70     * containers for the different flag groups so they can be sorted and
71     * returned.
72     *
73     * @param flags The flags a space delimited list to strip.
74     * @param arch The architecure per the OS specific name.
75     * @param path A path to adjust based on the architecture.
76     * @param type The type of flags being passed.
77     * @param warnings Return warning flags in this string.
78     * @param includes Return include flags in this string.
79     * @param machines Return machine flags in this string.
80     * @param specs Return spec flags in this string.
81     * @return const std::string The filtered flags.
82     */
83    const std::string filter_flags (const std::string& flags,
84                                    const std::string& arch,
85                                    const std::string& path,
86                                    flag_type          type,
87                                    std::string&       warnings,
88                                    std::string&       includes,
89                                    std::string&       machines,
90                                    std::string&       specs);
91
92    /**
93     * Filter the cflags and update the warnings, includes, machines and specs
94     * if the type of flags is cflags. Provide the cflags as a space separated
95     * list, the architure, and a path.
96     *
97     * @param flags The flags a space delimited list to strip.
98     * @param arch The architecure per the OS specific name.
99     * @param path A path to adjust based on the architecture.
100     * @param type The type of flags being passed.
101     * @return const std::string The filtered flags.
102     */
103    const std::string filter_flags (const std::string& flags,
104                                    const std::string& arch,
105                                    const std::string& path,
106                                    flag_type          type);
107
108    /**
109     * Set CC. The exec-prefix is ignored if this is set.
110     */
111    void set_cc (const std::string& cc);
112
113    /**
114     * Get the CC.
115     */
116    const std::string get_cc ();
117
118    /**
119     * Is the CC set ?
120     */
121    bool is_cc_set ();
122
123    /**
124     * Set the exec-prefix. If CC is set the exec-prefix is ignored.
125     */
126    void set_exec_prefix (const std::string& exec_prefix);
127
128    /**
129     * Get the exec-prefix.
130     */
131    const std::string get_exec_prefix ();
132
133    /**
134     * Is exec-prefix set ?
135     */
136    bool is_exec_prefix_set ();
137
138    /**
139     * Set the flags with a specific arch and include path.
140     */
141    void set_flags (const std::string& flags,
142                    const std::string& arch,
143                    const std::string& path,
144                    flag_type          type);
145
146    /**
147     * Set the flags.
148     */
149    void set_flags (const std::string& flags, flag_type type);
150
151    /**
152     * Append the flags with a specific arch and include path.
153     */
154    void append_flags (const std::string& flags,
155                       const std::string& arch,
156                       const std::string& path,
157                       flag_type          type);
158
159    /**
160     * Append the flags.
161     */
162    void append_flags (const std::string& flags, flag_type type);
163
164    /**
165     * Get the flags.
166     */
167    const std::string get_flags (flag_type type);
168    const std::string get_flags (flag_group group);
169
170    /**
171     * Append the flags if set.
172     */
173    void append_flags (flag_type type, rld::process::arg_container& args);
174
175    /**
176     * Make a CC command from the set arguments.
177     */
178    void make_cc_command (rld::process::arg_container& args);
179
180    /**
181     * Get the standard libraries paths from the compiler.
182     */
183    void get_standard_libpaths (rld::path::paths& libpaths);
184
185    /**
186     * Get the standard libraries. Optionally add the C++ library.
187     */
188    void get_standard_libs (rld::path::paths& libs,
189                            rld::path::paths& libpaths,
190                            bool              cpp = false);
191
192  }
193}
194
195#endif
Note: See TracBrowser for help on using the repository browser.