• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
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 
16 #ifndef PANDA_LINKER_H
17 #define PANDA_LINKER_H
18 
19 #include <string>
20 #include <vector>
21 #include <set>
22 #include "libpandafile/file_item_container.h"
23 
24 namespace ark::static_linker {
25 
26 struct Result {
27     std::vector<std::string> errors;
28 
29     struct Stats {
30         struct Times {
31             uint64_t read {};
32             uint64_t merge {};
33             uint64_t parse {};
34             uint64_t trydelete {};
35             uint64_t layout {};
36             uint64_t patch {};
37             uint64_t write {};
38             uint64_t total {};
39         } elapsed;
40         size_t itemsCount {};
41         size_t classCount {};
42         size_t codeCount {};
43         size_t debugCount {};
44 
45         size_t deduplicatedForeigners {};
46     } stats;
47 };
48 
49 std::ostream &operator<<(std::ostream &o, const Result::Stats &s);
50 
51 struct Config {
52     bool stripDebugInfo = false;
53     std::set<std::string> partial {std::string(panda_file::ItemContainer::GetGlobalClassName())};
54     std::set<std::string> remainsPartial {};
55     std::set<std::string> entryNames {};
56     bool allFileIsEntry = false;
57 };
58 
59 Config DefaultConfig();
60 
61 Result Link(const Config &conf, const std::string &output, const std::vector<std::string> &input);
62 }  // namespace ark::static_linker
63 
64 #endif
65