| 1 | //===- SymbolicFile.cpp - Interface that only provides symbols ------------===// |
|---|---|
| 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 | // This file defines a file format independent SymbolicFile class. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "llvm/Object/SymbolicFile.h" |
| 14 | |
| 15 | using namespace llvm; |
| 16 | using namespace object; |
| 17 | |
| 18 | SymbolicFile::SymbolicFile(unsigned int Type, MemoryBufferRef Source) |
| 19 | : Binary(Type, Source) {} |
| 20 | |
| 21 | SymbolicFile::~SymbolicFile() = default; |
| 22 | |
| 23 | bool SymbolicFile::isSymbolicFile(file_magic Type, const LLVMContext *Context) { |
| 24 | switch (Type) { |
| 25 | case file_magic::bitcode: |
| 26 | return Context != nullptr; |
| 27 | case file_magic::elf: |
| 28 | case file_magic::elf_executable: |
| 29 | case file_magic::elf_shared_object: |
| 30 | case file_magic::elf_core: |
| 31 | case file_magic::goff_object: |
| 32 | case file_magic::macho_executable: |
| 33 | case file_magic::macho_fixed_virtual_memory_shared_lib: |
| 34 | case file_magic::macho_core: |
| 35 | case file_magic::macho_preload_executable: |
| 36 | case file_magic::macho_dynamically_linked_shared_lib: |
| 37 | case file_magic::macho_dynamic_linker: |
| 38 | case file_magic::macho_bundle: |
| 39 | case file_magic::macho_dynamically_linked_shared_lib_stub: |
| 40 | case file_magic::macho_dsym_companion: |
| 41 | case file_magic::macho_kext_bundle: |
| 42 | case file_magic::macho_file_set: |
| 43 | case file_magic::pecoff_executable: |
| 44 | case file_magic::xcoff_object_32: |
| 45 | case file_magic::xcoff_object_64: |
| 46 | case file_magic::wasm_object: |
| 47 | case file_magic::coff_import_library: |
| 48 | case file_magic::elf_relocatable: |
| 49 | case file_magic::macho_object: |
| 50 | case file_magic::coff_object: |
| 51 | case file_magic::dxcontainer_object: |
| 52 | return true; |
| 53 | default: |
| 54 | return false; |
| 55 | } |
| 56 | } |
| 57 |