1 /** 2 * Copyright (c) 2021-2024 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 layout {}; 35 uint64_t patch {}; 36 uint64_t write {}; 37 uint64_t total {}; 38 } elapsed; 39 size_t itemsCount {}; 40 size_t classCount {}; 41 size_t codeCount {}; 42 size_t debugCount {}; 43 44 size_t deduplicatedForeigners {}; 45 } stats; 46 }; 47 48 std::ostream &operator<<(std::ostream &o, const Result::Stats &s); 49 50 struct Config { 51 bool stripDebugInfo = false; 52 std::set<std::string> partial {std::string(panda_file::ItemContainer::GetGlobalClassName())}; 53 std::set<std::string> remainsPartial {}; 54 }; 55 56 Config DefaultConfig(); 57 58 Result Link(const Config &conf, const std::string &output, const std::vector<std::string> &input); 59 } // namespace ark::static_linker 60 61 #endif 62