CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
86 lines
3.8 KiB
C++
86 lines
3.8 KiB
C++
//===- ObjectYAML.cpp - YAML utilities for object files -------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines a wrapper class for handling tagged YAML input
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/ObjectYAML/ObjectYAML.h"
|
|
#include "llvm/ADT/Twine.h"
|
|
#include "llvm/Support/YAMLParser.h"
|
|
#include "llvm/Support/YAMLTraits.h"
|
|
#include <string>
|
|
|
|
using namespace llvm;
|
|
using namespace yaml;
|
|
|
|
void MappingTraits<YamlObjectFile>::mapping(IO &IO,
|
|
YamlObjectFile &ObjectFile) {
|
|
if (IO.outputting()) {
|
|
if (ObjectFile.Elf)
|
|
MappingTraits<ELFYAML::Object>::mapping(IO, *ObjectFile.Elf);
|
|
if (ObjectFile.Coff)
|
|
MappingTraits<COFFYAML::Object>::mapping(IO, *ObjectFile.Coff);
|
|
if (ObjectFile.Goff)
|
|
MappingTraits<GOFFYAML::Object>::mapping(IO, *ObjectFile.Goff);
|
|
if (ObjectFile.MachO)
|
|
MappingTraits<MachOYAML::Object>::mapping(IO, *ObjectFile.MachO);
|
|
if (ObjectFile.FatMachO)
|
|
MappingTraits<MachOYAML::UniversalBinary>::mapping(IO,
|
|
*ObjectFile.FatMachO);
|
|
} else {
|
|
Input &In = (Input &)IO;
|
|
if (IO.mapTag("!Arch")) {
|
|
ObjectFile.Arch.reset(new ArchYAML::Archive());
|
|
MappingTraits<ArchYAML::Archive>::mapping(IO, *ObjectFile.Arch);
|
|
std::string Err =
|
|
MappingTraits<ArchYAML::Archive>::validate(IO, *ObjectFile.Arch);
|
|
if (!Err.empty())
|
|
IO.setError(Err);
|
|
} else if (IO.mapTag("!ELF")) {
|
|
ObjectFile.Elf.reset(new ELFYAML::Object());
|
|
MappingTraits<ELFYAML::Object>::mapping(IO, *ObjectFile.Elf);
|
|
} else if (IO.mapTag("!COFF")) {
|
|
ObjectFile.Coff.reset(new COFFYAML::Object());
|
|
MappingTraits<COFFYAML::Object>::mapping(IO, *ObjectFile.Coff);
|
|
} else if (IO.mapTag("!GOFF")) {
|
|
ObjectFile.Goff.reset(new GOFFYAML::Object());
|
|
MappingTraits<GOFFYAML::Object>::mapping(IO, *ObjectFile.Goff);
|
|
} else if (IO.mapTag("!mach-o")) {
|
|
ObjectFile.MachO.reset(new MachOYAML::Object());
|
|
MappingTraits<MachOYAML::Object>::mapping(IO, *ObjectFile.MachO);
|
|
} else if (IO.mapTag("!fat-mach-o")) {
|
|
ObjectFile.FatMachO.reset(new MachOYAML::UniversalBinary());
|
|
MappingTraits<MachOYAML::UniversalBinary>::mapping(IO,
|
|
*ObjectFile.FatMachO);
|
|
} else if (IO.mapTag("!minidump")) {
|
|
ObjectFile.Minidump.reset(new MinidumpYAML::Object());
|
|
MappingTraits<MinidumpYAML::Object>::mapping(IO, *ObjectFile.Minidump);
|
|
} else if (IO.mapTag("!Offload")) {
|
|
ObjectFile.Offload.reset(new OffloadYAML::Binary());
|
|
MappingTraits<OffloadYAML::Binary>::mapping(IO, *ObjectFile.Offload);
|
|
} else if (IO.mapTag("!WASM")) {
|
|
ObjectFile.Wasm.reset(new WasmYAML::Object());
|
|
MappingTraits<WasmYAML::Object>::mapping(IO, *ObjectFile.Wasm);
|
|
} else if (IO.mapTag("!XCOFF")) {
|
|
ObjectFile.Xcoff.reset(new XCOFFYAML::Object());
|
|
MappingTraits<XCOFFYAML::Object>::mapping(IO, *ObjectFile.Xcoff);
|
|
} else if (IO.mapTag("!dxcontainer")) {
|
|
ObjectFile.DXContainer.reset(new DXContainerYAML::Object());
|
|
MappingTraits<DXContainerYAML::Object>::mapping(IO,
|
|
*ObjectFile.DXContainer);
|
|
} else if (const Node *N = In.getCurrentNode()) {
|
|
if (N->getRawTag().empty())
|
|
IO.setError("YAML Object File missing document type tag!");
|
|
else
|
|
IO.setError("YAML Object File unsupported document type tag '" +
|
|
N->getRawTag() + "'!");
|
|
}
|
|
}
|
|
}
|