Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:56

0001 //===- ELFObjHandler.h ------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===-----------------------------------------------------------------------===/
0008 /// \file
0009 /// This supports reading and writing of elf dynamic shared objects.
0010 ///
0011 //===-----------------------------------------------------------------------===/
0012 
0013 #ifndef LLVM_INTERFACESTUB_ELFOBJHANDLER_H
0014 #define LLVM_INTERFACESTUB_ELFOBJHANDLER_H
0015 
0016 #include "llvm/ADT/StringRef.h"
0017 #include "llvm/Support/Error.h"
0018 #include "llvm/Support/MemoryBufferRef.h"
0019 #include <memory>
0020 
0021 namespace llvm {
0022 
0023 namespace ifs {
0024 struct IFSStub;
0025 
0026 /// Attempt to read a binary ELF file from a MemoryBuffer.
0027 Expected<std::unique_ptr<IFSStub>> readELFFile(MemoryBufferRef Buf);
0028 
0029 /// Attempt to write a binary ELF stub.
0030 /// This function determines appropriate ELFType using the passed ELFTarget and
0031 /// then writes a binary ELF stub to a specified file path.
0032 ///
0033 /// @param FilePath File path for writing the ELF binary.
0034 /// @param Stub Source ELFStub to generate a binary ELF stub from.
0035 /// @param WriteIfChanged Whether or not to preserve timestamp if
0036 ///        the output stays the same.
0037 Error writeBinaryStub(StringRef FilePath, const IFSStub &Stub,
0038                       bool WriteIfChanged = false);
0039 
0040 } // end namespace ifs
0041 } // end namespace llvm
0042 
0043 #endif // LLVM_INTERFACESTUB_ELFOBJHANDLER_H