Linux Perf
genelf.c File Reference
#include <sys/types.h>
#include <stdio.h>
#include <getopt.h>
#include <stddef.h>
#include <libelf.h>
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>
#include <limits.h>
#include <fcntl.h>
#include <err.h>
#include "perf.h"
#include "genelf.h"
#include "../util/jitdump.h"
Include dependency graph for genelf.c:

Go to the source code of this file.

Classes

struct  Elf_Note
 
struct  options
 
struct  buildid_note
 

Macros

#define NT_GNU_BUILD_ID   3
 
#define JVMTI
 
#define BUILD_ID_URANDOM   /* different uuid for each run */
 

Functions

static void gen_build_id (struct buildid_note *note, unsigned long load_addr __maybe_unused, const void *code __maybe_unused, size_t csize __maybe_unused)
 
static int jit_add_eh_frame_info (Elf *e, void *unwinding, uint64_t unwinding_header_size, uint64_t unwinding_size, uint64_t base_offset)
 
int jit_write_elf (int fd, uint64_t load_addr, const char *sym, const void *code, int csize, void *debug __maybe_unused, int nr_debug_entries __maybe_unused, void *unwinding, uint64_t unwinding_header_size, uint64_t unwinding_size)
 

Variables

static char shd_string_table []
 
static struct buildid_note bnote
 
static Elf_Sym symtab []
 

Macro Definition Documentation

◆ BUILD_ID_URANDOM

#define BUILD_ID_URANDOM   /* different uuid for each run */

Definition at line 36 of file genelf.c.

◆ JVMTI

#define JVMTI

Definition at line 34 of file genelf.c.

◆ NT_GNU_BUILD_ID

#define NT_GNU_BUILD_ID   3

Definition at line 31 of file genelf.c.

Function Documentation

◆ gen_build_id()

static void gen_build_id ( struct buildid_note note,
unsigned long load_addr  __maybe_unused,
const void *code  __maybe_unused,
size_t csize  __maybe_unused 
)
static

Definition at line 106 of file genelf.c.

Here is the call graph for this function:

◆ jit_add_eh_frame_info()

static int jit_add_eh_frame_info ( Elf *  e,
void *  unwinding,
uint64_t  unwinding_header_size,
uint64_t  unwinding_size,
uint64_t  base_offset 
)
static

Definition at line 159 of file genelf.c.

◆ jit_write_elf()

int jit_write_elf ( int  fd,
uint64_t  load_addr,
const char *  sym,
const void *  code,
int  csize,
void *debug  __maybe_unused,
int nr_debug_entries  __maybe_unused,
void *  unwinding,
uint64_t  unwinding_header_size,
uint64_t  unwinding_size 
)

Definition at line 246 of file genelf.c.

Here is the call graph for this function:

Variable Documentation

◆ bnote

struct buildid_note bnote
static

◆ shd_string_table

char shd_string_table[]
static
Initial value:
= {
0,
'.', 't', 'e', 'x', 't', 0,
'.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', 0,
'.', 's', 'y', 'm', 't', 'a', 'b', 0,
'.', 's', 't', 'r', 't', 'a', 'b', 0,
'.', 'n', 'o', 't', 'e', '.', 'g', 'n', 'u', '.', 'b', 'u', 'i', 'l', 'd', '-', 'i', 'd', 0,
'.', 'd', 'e', 'b', 'u', 'g', '_', 'l', 'i', 'n', 'e', 0,
'.', 'd', 'e', 'b', 'u', 'g', '_', 'i', 'n', 'f', 'o', 0,
'.', 'd', 'e', 'b', 'u', 'g', '_', 'a', 'b', 'b', 'r', 'e', 'v', 0,
'.', 'e', 'h', '_', 'f', 'r', 'a', 'm', 'e', '_', 'h', 'd', 'r', 0,
'.', 'e', 'h', '_', 'f', 'r', 'a', 'm', 'e', 0,
}

Definition at line 66 of file genelf.c.

◆ symtab

Elf_Sym symtab[]
static
Initial value:
={
{ .st_name = 0,
.st_info = ELF_ST_TYPE(STT_NOTYPE),
.st_shndx = 0,
.st_value = 0x0,
.st_other = ELF_ST_VIS(STV_DEFAULT),
.st_size = 0,
},
{ .st_name = 1,
.st_info = ELF_ST_BIND(STB_LOCAL) | ELF_ST_TYPE(STT_FUNC),
.st_shndx = 1,
.st_value = 0,
.st_other = ELF_ST_VIS(STV_DEFAULT),
.st_size = 0,
}
}
#define ELF_ST_VIS(a)
Definition: genelf.h:50
#define ELF_ST_TYPE(a)
Definition: genelf.h:48
#define ELF_ST_BIND(a)
Definition: genelf.h:49

Definition at line 86 of file genelf.c.