mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 14:56:10 +00:00

In Clang/LLVM we are moving towards a new binary format to store many embedded object files to create a fatbinary. This patch adds support for dumping these embedded images in the `llvm-objdump` tool. This will allow users to query information about what is stored inside the binary. This has very similar functionality to the `cuobjdump` tool for thoe familiar with the Nvidia utilities. The proposed use is as follows: ``` $ clang input.c -fopenmp --offload-arch=sm_70 --offload-arch=sm_52 -c $ llvm-objdump -O input.o input.o: file format elf64-x86-64 OFFLOADIND IMAGE [0]: kind cubin arch sm_52 triple nvptx64-nvidia-cuda producer openmp OFFLOADIND IMAGE [1]: kind cubin arch sm_70 triple nvptx64-nvidia-cuda producer openmp ``` This will be expanded further once we start embedding more information into these offloading images. Right now we are planning on adding flags and entries for debug level, optimization, LTO usage, target features, among others. This patch only supports printing these sections, later we will want to support dumping files the user may be interested in via another flag. I am unsure if this should go here in `llvm-objdump` or `llvm-objcopy`. Reviewed By: MaskRay, tra, jhenderson, JonChesterfield Differential Revision: https://reviews.llvm.org/D126904
23 lines
698 B
C++
23 lines
698 B
C++
//===-- OffloadDump.h -------------------------------------------*- C++ -*-===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TOOLS_LLVM_OBJDUMP_OFFLOADDUMP_H
|
|
#define LLVM_TOOLS_LLVM_OBJDUMP_OFFLOADDUMP_H
|
|
|
|
#include "llvm/Object/ObjectFile.h"
|
|
#include "llvm/Object/OffloadBinary.h"
|
|
|
|
namespace llvm {
|
|
|
|
void dumpOffloadSections(const object::OffloadBinary &OB);
|
|
void dumpOffloadBinary(const object::ObjectFile &O);
|
|
|
|
} // namespace llvm
|
|
|
|
#endif
|