003 File Manager
Current Path:
/usr/src/contrib/llvm-project/lld/lib/ReaderWriter/MachO
usr
/
src
/
contrib
/
llvm-project
/
lld
/
lib
/
ReaderWriter
/
MachO
/
📁
..
📄
ArchHandler.cpp
(4.36 KB)
📄
ArchHandler.h
(12.86 KB)
📄
ArchHandler_arm.cpp
(54.53 KB)
📄
ArchHandler_arm64.cpp
(33.86 KB)
📄
ArchHandler_x86.cpp
(24.04 KB)
📄
ArchHandler_x86_64.cpp
(33.45 KB)
📄
Atoms.h
(5.45 KB)
📄
CompactUnwindPass.cpp
(21.9 KB)
📄
DebugInfo.h
(2.52 KB)
📄
ExecutableAtoms.h
(4.69 KB)
📄
File.h
(17.28 KB)
📄
FlatNamespaceFile.h
(1.87 KB)
📄
GOTPass.cpp
(6.58 KB)
📄
LayoutPass.cpp
(18.19 KB)
📄
LayoutPass.h
(4.19 KB)
📄
MachOLinkingContext.cpp
(33.61 KB)
📄
MachONormalizedFile.h
(11.47 KB)
📄
MachONormalizedFileBinaryReader.cpp
(22.82 KB)
📄
MachONormalizedFileBinaryUtils.h
(6.93 KB)
📄
MachONormalizedFileBinaryWriter.cpp
(56.33 KB)
📄
MachONormalizedFileFromAtoms.cpp
(61.05 KB)
📄
MachONormalizedFileToAtoms.cpp
(65.46 KB)
📄
MachONormalizedFileYAML.cpp
(31.45 KB)
📄
MachOPasses.h
(1.11 KB)
📄
ObjCPass.cpp
(3.54 KB)
📄
SectCreateFile.h
(3.01 KB)
📄
ShimPass.cpp
(4.59 KB)
📄
StubsPass.cpp
(12.03 KB)
📄
TLVPass.cpp
(4.02 KB)
📄
WriterMachO.cpp
(2.33 KB)
Editing: WriterMachO.cpp
//===- lib/ReaderWriter/MachO/WriterMachO.cpp -----------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "ExecutableAtoms.h" #include "MachONormalizedFile.h" #include "lld/Core/File.h" #include "lld/Core/Writer.h" #include "lld/ReaderWriter/MachOLinkingContext.h" #include "llvm/BinaryFormat/MachO.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileOutputBuffer.h" #include "llvm/Support/raw_ostream.h" #include <system_error> using lld::mach_o::normalized::NormalizedFile; namespace lld { namespace mach_o { class MachOWriter : public Writer { public: MachOWriter(const MachOLinkingContext &ctxt) : _ctx(ctxt) {} llvm::Error writeFile(const lld::File &file, StringRef path) override { // Construct empty normalized file from atoms. llvm::Expected<std::unique_ptr<NormalizedFile>> nFile = normalized::normalizedFromAtoms(file, _ctx); if (auto ec = nFile.takeError()) return ec; // For testing, write out yaml form of normalized file. if (_ctx.printAtoms()) { std::unique_ptr<Writer> yamlWriter = createWriterYAML(_ctx); if (auto ec = yamlWriter->writeFile(file, "-")) return ec; } // Write normalized file as mach-o binary. return writeBinary(*nFile->get(), path); } void createImplicitFiles(std::vector<std::unique_ptr<File>> &r) override { // When building main executables, add _main as required entry point. if (_ctx.outputTypeHasEntry()) r.emplace_back(new CEntryFile(_ctx)); // If this can link with dylibs, need helper function (dyld_stub_binder). if (_ctx.needsStubsPass()) r.emplace_back(new StubHelperFile(_ctx)); // Final linked images can access a symbol for their mach_header. if (_ctx.outputMachOType() != llvm::MachO::MH_OBJECT) r.emplace_back(new MachHeaderAliasFile(_ctx)); } private: const MachOLinkingContext &_ctx; }; } // namespace mach_o std::unique_ptr<Writer> createWriterMachO(const MachOLinkingContext &context) { return std::unique_ptr<Writer>(new lld::mach_o::MachOWriter(context)); } } // namespace lld
Upload File
Create Folder