1 //===- ELFConfig.h ----------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_TOOLS_OBJCOPY_ELFCONFIG_H 10 #define LLVM_TOOLS_OBJCOPY_ELFCONFIG_H 11 12 #include "llvm/ADT/Optional.h" 13 #include "llvm/ADT/StringRef.h" 14 #include "llvm/Object/ELFTypes.h" 15 #include "llvm/Support/Error.h" 16 #include <vector> 17 18 namespace llvm { 19 namespace objcopy { 20 struct CopyConfig; 21 22 namespace elf { 23 24 struct NewSymbolInfo { 25 StringRef SymbolName; 26 StringRef SectionName; 27 uint64_t Value = 0; 28 uint8_t Type = ELF::STT_NOTYPE; 29 uint8_t Bind = ELF::STB_GLOBAL; 30 uint8_t Visibility = ELF::STV_DEFAULT; 31 }; 32 33 struct ELFCopyConfig { 34 Optional<uint8_t> NewSymbolVisibility; 35 std::vector<NewSymbolInfo> SymbolsToAdd; 36 }; 37 38 Expected<ELFCopyConfig> parseConfig(const CopyConfig &Config); 39 40 } // namespace elf 41 } // namespace objcopy 42 } // namespace llvm 43 44 #endif 45