HPCToolkit
RelocateCubin.cpp File Reference
#include <assert.h>
#include <string.h>
#include "ElfHelper.hpp"
#include "RelocateCubin.hpp"
Include dependency graph for RelocateCubin.cpp:

Go to the source code of this file.

Macros

#define DEBUG_LINE_SECTION_NAME   ".debug_line"
 
#define DEBUG_INFO_SECTION_NAME   ".debug_info"
 
#define CASESTR(n)   case n: return #n
 
#define section_index(n)   (n-1)
 
#define DEBUG_CUBIN_RELOCATION   0
 
#define R_NV_32   0x01
 
#define R_NV_64   0x02
 

Typedefs

typedef std::vector< Elf_Scn * > Elf_SectionVector
 
typedef std::vector< Elf64_Addr > Elf_SymbolVector
 

Functions

static size_t sectionOffset (Elf_SectionVector *sections, unsigned sindex)
 
static void applyRelocation (void *addr, unsigned rel_type, uint64_t rel_value)
 
static void applyRELrelocation (char *line_map, Elf_SymbolVector *symbol_values, GElf_Rel *rel)
 
static void applyRELArelocation (char *debug_info, Elf_SymbolVector *symbol_values, GElf_Rela *rela)
 
static void applyLineMapRelocations (Elf_SymbolVector *symbol_values, char *line_map, int n_relocations, Elf_Data *relocations_data)
 
static void relocateLineMap (char *cubin_ptr, Elf *elf, Elf_SectionVector *sections, Elf_SymbolVector *symbol_values)
 
static void applyDebugInfoRelocations (Elf_SymbolVector *symbol_values, char *debug_info, int n_relocations, Elf_Data *relocations_data)
 
static void relocateDebugInfo (char *cubin_ptr, Elf *elf, Elf_SectionVector *sections, Elf_SymbolVector *symbol_values)
 
static Elf_SymbolVectorrelocateSymbolsHelper (Elf *elf, GElf_Ehdr *ehdr, GElf_Shdr *shdr, Elf_SectionVector *sections, Elf_Scn *scn)
 
static Elf_SymbolVectorrelocateSymbols (Elf *elf, Elf_SectionVector *sections)
 
static void relocateProgramDataSegments (Elf *elf, Elf_SectionVector *sections)
 
bool relocateCubin (char *cubin_ptr, Elf *cubin_elf)
 

Macro Definition Documentation

◆ CASESTR

#define CASESTR (   n)    case n: return #n

Definition at line 92 of file RelocateCubin.cpp.

◆ DEBUG_CUBIN_RELOCATION

#define DEBUG_CUBIN_RELOCATION   0

Definition at line 95 of file RelocateCubin.cpp.

◆ DEBUG_INFO_SECTION_NAME

#define DEBUG_INFO_SECTION_NAME   ".debug_info"

Definition at line 90 of file RelocateCubin.cpp.

◆ DEBUG_LINE_SECTION_NAME

#define DEBUG_LINE_SECTION_NAME   ".debug_line"

Definition at line 88 of file RelocateCubin.cpp.

◆ R_NV_32

#define R_NV_32   0x01

Definition at line 103 of file RelocateCubin.cpp.

◆ R_NV_64

#define R_NV_64   0x02

Definition at line 104 of file RelocateCubin.cpp.

◆ section_index

#define section_index (   n)    (n-1)

Definition at line 93 of file RelocateCubin.cpp.

Typedef Documentation

◆ Elf_SectionVector

typedef std::vector<Elf_Scn *> Elf_SectionVector

Definition at line 112 of file RelocateCubin.cpp.

◆ Elf_SymbolVector

typedef std::vector<Elf64_Addr> Elf_SymbolVector

Definition at line 113 of file RelocateCubin.cpp.

Function Documentation

◆ applyDebugInfoRelocations()

static void applyDebugInfoRelocations ( Elf_SymbolVector symbol_values,
char *  debug_info,
int  n_relocations,
Elf_Data *  relocations_data 
)
static

Definition at line 328 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyLineMapRelocations()

static void applyLineMapRelocations ( Elf_SymbolVector symbol_values,
char *  line_map,
int  n_relocations,
Elf_Data *  relocations_data 
)
static

Definition at line 226 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyRELArelocation()

static void applyRELArelocation ( char *  debug_info,
Elf_SymbolVector symbol_values,
GElf_Rela *  rela 
)
static

Definition at line 200 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyRelocation()

static void applyRelocation ( void *  addr,
unsigned  rel_type,
uint64_t  rel_value 
)
static

Definition at line 158 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyRELrelocation()

static void applyRELrelocation ( char *  line_map,
Elf_SymbolVector symbol_values,
GElf_Rel *  rel 
)
static

Definition at line 174 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ relocateCubin()

bool relocateCubin ( char *  cubin_ptr,
Elf *  cubin_elf 
)

Definition at line 552 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ relocateDebugInfo()

static void relocateDebugInfo ( char *  cubin_ptr,
Elf *  elf,
Elf_SectionVector sections,
Elf_SymbolVector symbol_values 
)
static

Definition at line 350 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ relocateLineMap()

static void relocateLineMap ( char *  cubin_ptr,
Elf *  elf,
Elf_SectionVector sections,
Elf_SymbolVector symbol_values 
)
static

Definition at line 248 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ relocateProgramDataSegments()

static void relocateProgramDataSegments ( Elf *  elf,
Elf_SectionVector sections 
)
static

Definition at line 518 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ relocateSymbols()

static Elf_SymbolVector* relocateSymbols ( Elf *  elf,
Elf_SectionVector sections 
)
static

Definition at line 485 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ relocateSymbolsHelper()

static Elf_SymbolVector* relocateSymbolsHelper ( Elf *  elf,
GElf_Ehdr *  ehdr,
GElf_Shdr *  shdr,
Elf_SectionVector sections,
Elf_Scn *  scn 
)
static

Definition at line 430 of file RelocateCubin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sectionOffset()

static size_t sectionOffset ( Elf_SectionVector sections,
unsigned  sindex 
)
static

Definition at line 123 of file RelocateCubin.cpp.

Here is the caller graph for this function: