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/string_piece.h"
22 : #include "base/time.h"
23 : #include "base/files/file_path.h"
24 : #include "syzygy/common/application.h"
25 :
26 : namespace relink {
27 :
28 : // This class implements the command-line relink utility.
29 : class RelinkApp : public common::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 : fuzz_(false),
44 E : old_decomposer_(false) {
45 E : }
46 :
47 : // @name Implementation of the AppImplBase interface.
48 : // @{
49 : bool ParseCommandLine(const CommandLine* command_line);
50 : bool SetUp();
51 : int Run();
52 : // @}
53 :
54 : protected:
55 : // @name Utility members.
56 : // @{
57 : bool Usage(const CommandLine* command_line,
58 : const base::StringPiece& message) const;
59 : // @}
60 :
61 : // @name Command-line parameters.
62 : // @{
63 : base::FilePath input_image_path_;
64 : base::FilePath input_pdb_path_;
65 : base::FilePath output_image_path_;
66 : base::FilePath output_pdb_path_;
67 : base::FilePath order_file_path_;
68 : uint32 seed_;
69 : size_t padding_;
70 : size_t code_alignment_;
71 : bool no_augment_pdb_;
72 : bool compress_pdb_;
73 : bool no_strip_strings_;
74 : bool output_metadata_;
75 : bool overwrite_;
76 : bool basic_blocks_;
77 : bool exclude_bb_padding_;
78 : bool fuzz_;
79 : bool old_decomposer_;
80 : // @}
81 :
82 : private:
83 : DISALLOW_COPY_AND_ASSIGN(RelinkApp);
84 : };
85 :
86 : } // namespace relink
87 :
88 : #endif // SYZYGY_RELINK_RELINK_APP_H_
|