1 : // Copyright 2012 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Defines the RelinkApp class, which implements the command-line relink tool.
16 :
17 : #ifndef SYZYGY_RELINK_RELINK_APP_H_
18 : #define SYZYGY_RELINK_RELINK_APP_H_
19 :
20 : #include "base/command_line.h"
21 : #include "base/files/file_path.h"
22 : #include "base/strings/string_piece.h"
23 : #include "base/time/time.h"
24 : #include "syzygy/application/application.h"
25 :
26 : namespace relink {
27 :
28 : // This class implements the command-line relink utility.
29 : class RelinkApp : public application::AppImplBase {
30 : public:
31 : RelinkApp()
32 : : AppImplBase("Relinker"),
33 : seed_(0),
34 : padding_(0),
35 : code_alignment_(1),
36 : no_augment_pdb_(false),
37 : compress_pdb_(false),
38 : no_strip_strings_(false),
39 : output_metadata_(false),
40 : overwrite_(false),
41 : basic_blocks_(false),
42 : exclude_bb_padding_(false),
43 E : fuzz_(false) {
44 E : }
45 :
46 : // @name Implementation of the AppImplBase interface.
47 : // @{
48 : bool ParseCommandLine(const base::CommandLine* command_line);
49 : bool SetUp();
50 : int Run();
51 : // @}
52 :
53 : protected:
54 : // @name Utility members.
55 : // @{
56 : bool Usage(const base::CommandLine* command_line,
57 : const base::StringPiece& message) const;
58 : // @}
59 :
60 : // @name Command-line parameters.
61 : // @{
62 : base::FilePath input_image_path_;
63 : base::FilePath input_pdb_path_;
64 : base::FilePath output_image_path_;
65 : base::FilePath output_pdb_path_;
66 : base::FilePath order_file_path_;
67 : uint32 seed_;
68 : size_t padding_;
69 : size_t code_alignment_;
70 : bool no_augment_pdb_;
71 : bool compress_pdb_;
72 : bool no_strip_strings_;
73 : bool output_metadata_;
74 : bool overwrite_;
75 : bool basic_blocks_;
76 : bool exclude_bb_padding_;
77 : bool fuzz_;
78 : // @}
79 :
80 : private:
81 : DISALLOW_COPY_AND_ASSIGN(RelinkApp);
82 : };
83 :
84 : } // namespace relink
85 :
86 : #endif // SYZYGY_RELINK_RELINK_APP_H_
|