1 //===-- ELFSymbols.h - ELF Symbol look-up functionality ---------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // ELF routines for obtaining a symbol from an Elf file without loading it.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_ELF_COMMON_ELF_SYMBOLS_H
14 #define LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_ELF_COMMON_ELF_SYMBOLS_H
16 #include "llvm/Object/ELF.h"
17 #include "llvm/Object/ELFObjectFile.h"
19 /// Returns the symbol associated with the \p Name in the \p ELFObj. It will
20 /// first search for the hash sections to identify symbols from the hash table.
21 /// If that fails it will fall back to a linear search in the case of an
22 /// executable file without a hash table.
23 llvm::Expected
<const typename
llvm::object::ELF64LE::Sym
*>
24 getELFSymbol(const llvm::object::ELFObjectFile
<llvm::object::ELF64LE
> &ELFObj
,
25 llvm::StringRef Name
);