33 #define _(t,f) n->f = clib_byte_swap_##t (n->f); 41 #define _(t,f) n->f = clib_byte_swap_##t (n->f); 89 #define _(f,i) case ELF_SECTION_##f: t = #f; break; 95 s =
format (s,
"unknown 0x%x", type);
109 return format (s,
"%=40s%=10s%=20s%=8s%=16s%=16s%=16s",
110 "Name",
"Index",
"Type",
"Size",
"Align",
"Address",
113 s =
format (s,
"%-40s%10d%=20U%8Lx%16d%16Lx %Lx-%Lx",
119 h->exec_address, h->file_offset, h->file_offset + h->file_size);
124 if (h->flags & ELF_SECTION_FLAG_##f) s = format (s, " %s", #f); 140 #define _(f,i) case ELF_SEGMENT_##f: t = #f; break; 146 s =
format (s,
"unknown 0x%x", type);
159 return format (s,
"%=16s%=16s%=16s%=16s",
160 "Type",
"Virt. Address",
"Phys. Address",
"Size");
162 s =
format (s,
"%=16U%16Lx%16Lx%16Lx%16Lx",
165 h->physical_address, h->memory_size, h->file_offset);
170 if (h->flags & ELF_SEGMENT_FLAG_##f) s = format (s, " %s", #f); 181 int bt = va_arg (*args,
int);
183 char *type_string = 0;
184 char *binding_string = 0;
186 switch ((b = ((bt >> 4) & 0xf)))
188 #define _(f,n) case n: binding_string = #f; break; 195 switch ((t = ((bt >> 0) & 0xf)))
197 #define _(f,n) case n: type_string = #f; break; 205 s =
format (s,
"%s", binding_string);
207 s =
format (s,
"binding 0x%x", b);
210 s =
format (s,
" %s", type_string);
212 s =
format (s,
" type 0x%x", t);
220 int visibility = va_arg (*args,
int);
225 #define _(f,n) case n: t = #f; break; 231 return format (s,
"%s", t);
233 return format (s,
"unknown 0x%x", visibility);
240 int si = va_arg (*args,
int);
254 #define _(f,n) case n: t = #f; break; 263 return format (s,
"%s", t);
265 return format (s,
"unknown 0x%x", si);
276 return format (s,
"%=32s%=16s%=16s%=16s%=16s%=16s",
277 "Symbol",
"Size",
"Value",
"Type",
"Visibility",
280 s =
format (s,
"%-32s%16Ld%16Lx%=16U%=16U%U",
282 sym->size, sym->value,
294 int type = va_arg (*args,
int);
299 #define _(f,i) [i] = #f, 301 case ELF_ARCH_X86_64:
303 static char *tab[] = {
318 s =
format (s,
"0x%02x", type);
335 return format (s,
"%=16s%=16s%=16s",
"Address",
"Type",
"Symbol");
340 s =
format (s,
"%16Lx%16U",
344 if (sym->section_index != 0)
357 s =
format (s,
" %c 0x%Lx", a > 0 ?
'+' :
'-', a > 0 ? a : -a);
370 #define _(f,n) case n: t = #f; break; 377 return format (s,
"%s", t);
379 return format (s,
"unknown 0x%x", type);
389 return format (s,
"%=40s%=16s",
"Type",
"Data");
394 case ELF_DYNAMIC_ENTRY_NEEDED_LIBRARY:
395 case ELF_DYNAMIC_ENTRY_RPATH:
396 case ELF_DYNAMIC_ENTRY_RUN_PATH:
400 case ELF_DYNAMIC_ENTRY_INIT_FUNCTION:
401 case ELF_DYNAMIC_ENTRY_FINI_FUNCTION:
402 case ELF_DYNAMIC_ENTRY_SYMBOL_HASH:
403 case ELF_DYNAMIC_ENTRY_GNU_HASH:
404 case ELF_DYNAMIC_ENTRY_STRING_TABLE:
405 case ELF_DYNAMIC_ENTRY_SYMBOL_TABLE:
406 case ELF_DYNAMIC_ENTRY_PLT_GOT:
407 case ELF_DYNAMIC_ENTRY_PLT_RELOCATION_ADDRESS:
408 case ELF_DYNAMIC_ENTRY_RELA_ADDRESS:
409 case ELF_DYNAMIC_ENTRY_VERSION_NEED:
410 case ELF_DYNAMIC_ENTRY_VERSYM:
417 s =
format (s,
"0x%Lx", e->data);
422 s =
format (s,
"0x%Lx", e->data);
432 int a = va_arg (*args,
int);
437 #define _(f,n) case n: t = #f; break; 441 return format (s,
"unknown 0x%x", a);
444 return format (s,
"%s", t);
450 int a = va_arg (*args,
int);
455 #define _(f,n) case n: t = #f; break; 459 return format (s,
"unknown 0x%x", a);
462 return format (s,
"%s", t);
468 int a = va_arg (*args,
int);
473 #define _(f) case ELF_##f: t = #f; break; 477 return format (s,
"unknown 0x%x", a);
480 return format (s,
"%s", t);
486 int a = va_arg (*args,
int);
489 if (a >= ELF_ARCH_SPECIFIC_LO && a <= ELF_ARCH_SPECIFIC_HI)
490 return format (s,
"arch-specific 0x%x", a - ELF_ARCH_SPECIFIC_LO);
492 if (a >= ELF_OS_SPECIFIC_LO && a <= ELF_OS_SPECIFIC_HI)
493 return format (s,
"os-specific 0x%x", a - ELF_OS_SPECIFIC_LO);
497 #define _(f,n) case n: t = #f; break; 501 return format (s,
"unknown 0x%x", a);
504 return format (s,
"%s", t);
510 int a = va_arg (*args,
int);
515 #define _(f) case ELF_##f: t = #f; break; 519 return format (s,
"unknown 0x%x", a);
522 return format (s,
"%s", t);
540 return ((
i64) s1->
header.virtual_address -
548 u32 verbose = va_arg (*args,
u32);
553 "File header: machine: %U, file type/class %U/%U, data-encoding: %U, abi: %U version %d\n",
561 s =
format (s,
" entry 0x%Lx, arch-flags 0x%x",
576 s =
format (s,
"\nSections %d at file offset 0x%Lx-0x%Lx:\n",
577 fh->section_header_count,
578 fh->section_header_file_offset,
579 fh->section_header_file_offset +
580 (
u64) fh->section_header_count * fh->section_header_size);
592 if (h->
header.type != ELF_SEGMENT_UNUSED && h->
header.type != ~0)
598 s =
format (s,
"\nSegments: %d at file offset 0x%Lx-0x%Lx:\n",
599 fh->segment_header_count,
600 fh->segment_header_file_offset,
601 (
u64) fh->segment_header_file_offset +
602 (
u64) fh->segment_header_count *
603 (
u64) fh->segment_header_size);
621 format (s,
"\nSymbols for section %s:\n",
641 s =
format (s,
"\nRelocations for section %s:\n",
656 s =
format (s,
"\nDynamic linker information:\n");
669 void *d = data + em->
file_header.segment_header_file_offset;
675 for (i = 0; i < n; i++)
682 #define _(t,f) em->segments[i].header.f = elf_swap_##t (em, h->f); 690 #define _(t,f) em->segments[i].header.f = elf_swap_##t (em, h->f); 703 void *d = data + fh->section_header_file_offset;
704 uword n = fh->section_header_count;
709 for (i = 0; i < n; i++)
718 #define _(t,f) em->sections[i].header.f = elf_swap_##t (em, h->f); 726 #define _(t,f) em->sections[i].header.f = elf_swap_##t (em, h->f); 732 if (s->
header.type != ELF_SECTION_NO_BITS)
760 if (s->
header.type == ELF_SECTION_DYNAMIC_SYMBOL_TABLE)
774 #define _(t,f) tab->symbols[i].f = elf_swap_##t (em, tab->symbols[i].f); 786 #define _(t,f) tab->symbols[i].f = elf_swap_##t (em, sym32[i].f); 804 if (sym64->name != 0)
813 uword has_addend = s->
header.type == ELF_SECTION_RELOCATION_ADD;
826 has_addend *
sizeof (rs->
addend[0]));
831 for (i = 0; i <
vec_len (r); i++)
852 has_addend *
sizeof (r32s->
addend[0]));
882 case ELF_SECTION_SYMBOL_TABLE:
883 case ELF_SECTION_DYNAMIC_SYMBOL_TABLE:
887 case ELF_SECTION_RELOCATION_ADD:
888 case ELF_SECTION_RELOCATION:
911 case ELF_DYNAMIC_ENTRY_INIT_FUNCTION:
912 case ELF_DYNAMIC_ENTRY_FINI_FUNCTION:
913 case ELF_DYNAMIC_ENTRY_SYMBOL_HASH:
914 case ELF_DYNAMIC_ENTRY_GNU_HASH:
915 case ELF_DYNAMIC_ENTRY_STRING_TABLE:
916 case ELF_DYNAMIC_ENTRY_SYMBOL_TABLE:
917 case ELF_DYNAMIC_ENTRY_PLT_GOT:
918 case ELF_DYNAMIC_ENTRY_PLT_RELOCATION_ADDRESS:
919 case ELF_DYNAMIC_ENTRY_RELA_ADDRESS:
920 case ELF_DYNAMIC_ENTRY_VERSION_NEED:
921 case ELF_DYNAMIC_ENTRY_VERSYM:
927 e->data = es->
header.exec_address;
964 for (i = 0; i <
vec_len (es); i++)
986 memset (em, 0,
sizeof (em[0]));
993 ELF_TWOS_COMPLEMENT_BIG_ENDIAN);
996 if (!(h->
magic[0] == 0x7f
1003 #define _(t,f) fh->f = elf_swap_##t (em, h64->f); 1011 #define _(t,f) fh->f = elf_swap_##t (em, h32->f); 1028 if (g->
header.memory_size == 0)
1031 g_lo = g->
header.virtual_address;
1032 g_hi = g_lo + g->
header.memory_size;
1036 s_lo = s->
header.exec_address;
1037 s_hi = s_lo + s->
header.file_size;
1039 if (s_lo >= g_lo && s_hi <= g_hi)
1070 for (i = 0; i <
vec_len (e); i++)
1085 for (i = 0; i <
vec_len (e); i++)
1098 uword *entries_swapped = 0;
1101 for (i = 0; i <
vec_len (vus); i++)
1112 if (n->
need.first_aux_offset != 0)
1114 ASSERT (n->
need.first_aux_offset % sizeof (n[0]) == 0);
1115 j = i + (n->
need.first_aux_offset /
sizeof (n[0]));
1124 if (a->
aux.next_offset == 0)
1127 j += (a->
aux.next_offset /
sizeof (a->
aux));
1167 #define _(t,f) s->f = elf_swap_##t (em, s->f); 1182 #define _(t,f) syms[i].f = elf_swap_##t (em, tab->symbols[i].f); 1201 if (g->
header.type == ELF_SEGMENT_INTERP)
1218 uword start_address,
1220 u32 * section_index_result)
1232 if (section_index_result)
1233 *section_index_result = s->
index;
1248 case ELF_SECTION_DYNAMIC:
1264 case ELF_DYNAMIC_ENTRY_STRING_TABLE:
1271 dynamic_string_table_section_index);
1274 case ELF_DYNAMIC_ENTRY_SYMBOL_TABLE:
1290 case ELF_DYNAMIC_ENTRY_VERSYM:
1297 versym_section_index);
1306 case ELF_DYNAMIC_ENTRY_VERSION_NEED:
1313 verneed_section_index);
1324 #include <sys/types.h> 1325 #include <sys/stat.h> 1332 struct stat fd_stat;
1333 uword mmap_length = 0;
1339 fd = open (file_name, 0);
1346 if (fstat (fd, &fd_stat) < 0)
1351 mmap_length = fd_stat.st_size;
1353 data = mmap (0, mmap_length, PROT_READ, MAP_SHARED, fd, 0);
1362 error =
elf_parse (em, data, mmap_length);
1371 munmap (data, mmap_length);
1381 munmap (data, mmap_length);
1403 l = strlen ((
char *) n);
1407 for (j = 0; j <= l; j++)
1425 __attribute__ ((unused));
1434 __attribute__ ((unused));
1438 memset (b, 0,
sizeof (b[0]));
1444 __attribute__ ((unused));
1456 u32 n_sections_with_changed_exec_address = 0;
1457 u32 *deferred_symbol_and_string_sections = 0;
1458 u32 n_deleted_sections = 0;
1471 if (s->
header.type == ~0)
1475 vec_add (st, name, strlen ((
char *) name) + 1);
1480 em->
file_header.section_header_string_table_index);
1518 case ELF_DYNAMIC_ENTRY_NEEDED_LIBRARY:
1519 case ELF_DYNAMIC_ENTRY_RPATH:
1520 case ELF_DYNAMIC_ENTRY_RUN_PATH:
1535 n->
need.file_name_offset =
1538 if (n->
need.first_aux_offset != 0)
1540 a = n + n->
need.first_aux_offset /
sizeof (n[0]);
1545 if (a->
aux.next_offset == 0)
1547 a += a->
aux.next_offset /
sizeof (a[0]);
1551 if (n->
need.next_offset == 0)
1554 n += n->
need.next_offset /
sizeof (n[0]);
1571 u64 exec_address = 0, file_offset = 0;
1572 u64 file_size, align_size;
1580 n_deleted_sections++;
1581 case ELF_SECTION_UNUSED:
1584 case ELF_SECTION_STRING_TABLE:
1585 case ELF_SECTION_SYMBOL_TABLE:
1588 em->
file_header.section_header_string_table_index))
1602 if (s->
header.file_offset == ~0)
1603 s->
header.file_offset = file_offset;
1606 if (s->
header.exec_address > exec_address)
1608 exec_address = s->
header.exec_address;
1609 file_offset = s->
header.file_offset;
1612 if (s->
header.flags & ELF_SECTION_FLAG_ALLOC)
1616 s->
header.exec_address = exec_address;
1619 if (s->
header.type == ELF_SECTION_NO_BITS)
1620 file_size = s->
header.file_size;
1629 else if (s[1].header.type == ELF_SECTION_NO_BITS)
1632 align = s[1].
header.align;
1634 if (s->
header.flags & ELF_SECTION_FLAG_ALLOC)
1637 align_size = v - exec_address;
1642 align_size = v - file_offset;
1646 s->
header.file_offset = file_offset;
1647 s->
header.file_size = file_size;
1650 if (s->
header.type != ELF_SECTION_NO_BITS)
1651 file_offset += align_size;
1652 exec_address += align_size;
1660 fh->section_header_file_offset = file_offset;
1661 fh->section_header_count =
vec_len (em->
sections) - n_deleted_sections;
1662 file_offset += (
u64) fh->section_header_count * fh->section_header_size;
1667 for (i = 0; i <
vec_len (deferred_symbol_and_string_sections); i++)
1671 deferred_symbol_and_string_sections[i]);
1673 s->
header.file_offset = file_offset;
1678 file_offset += align_size;
1680 vec_free (deferred_symbol_and_string_sections);
1698 u64 s_lo, s_hi, f_lo = 0;
1701 if (g->
header.memory_size == 0)
1709 s = vec_elt_at_index (em->sections, si);
1710 lo = s->header.exec_address;
1711 hi = lo + s->align_size;
1712 if (n_sections == 0)
1716 f_lo = s->header.file_offset;
1724 f_lo = s->header.file_offset;
1732 if (n_sections == 0)
1737 if (g->header.file_offset == 0 && g->header.type == ELF_SEGMENT_LOAD)
1739 s_lo = g->header.virtual_address;
1740 f_lo = g->header.file_offset;
1743 g->header.virtual_address = s_lo;
1744 g->header.physical_address = s_lo;
1745 g->header.file_offset = f_lo;
1746 g->header.memory_size = s_hi - s_lo;
1758 fd = open (file_name, O_CREAT | O_RDWR | O_TRUNC, 0755);
1762 f = fdopen (fd,
"w");
1773 if (fwrite (&h,
sizeof (h), 1, f) != 1)
1793 #define _(t,field) h.field = elf_swap_##t (em, h.field); 1797 if (fwrite (&h,
sizeof (h), 1, f) != 1)
1807 #define _(t,field) h32.field = elf_swap_##t (em, h.field); 1811 if (fwrite (&h32,
sizeof (h32), 1, f) != 1)
1827 if (s->
header.type == ~0)
1834 #define _(t,field) h.field = elf_swap_##t (em, h.field); 1838 if (fwrite (&h,
sizeof (h), 1, f) != 1)
1850 #define _(t,field) h32.field = elf_swap_##t (em, h.field); 1854 if (fwrite (&h32,
sizeof (h32), 1, f) != 1)
1871 if (s->
header.file_size == 0)
1874 if (fseek (f, s->
header.file_offset, SEEK_SET) < 0)
1881 if (s->
header.type == ELF_SECTION_NO_BITS)
1893 if (fseek (f, em->
file_header.section_header_file_offset, SEEK_SET) < 0)
1897 (0,
"fseek 0x%Lx", em->
file_header.section_header_file_offset);
1904 if (s->
header.type == ~0)
1911 #define _(t,field) h.field = elf_swap_##t (em, h.field); 1915 if (fwrite (&h,
sizeof (h), 1, f) != 1)
1927 #define _(t,field) h32.field = elf_swap_##t (em, h.field); 1931 if (fwrite (&h32,
sizeof (h32), 1, f) != 1)
1966 void *contents,
uword n_content_bytes)
1970 uword *p, is_new_section;
1990 em->
file_header.section_header_string_table_index);
1995 s->
header.file_offset = ~0;
1996 s->
header.file_size = n_content_bytes;
2001 vec_add (st, section_name, strlen (section_name));
2009 em->
file_header.section_header_count += is_new_section
2017 uword n_deleted = 0;
2027 em->
file_header.segment_header_count -= n_deleted;
static u8 * format_elf_file_type(u8 *s, va_list *args)
u8 * format_elf_main(u8 *s, va_list *args)
#define ELF_SYMBOL_SECTION_RESERVED_HI
static u8 * format_elf_symbol_section_name(u8 *s, va_list *args)
static void elf_main_free(elf_main_t *em)
static u32 elf_swap_u32(elf_main_t *em, u32 x)
elf64_segment_header_t header
#define vec_clone(NEW_V, OLD_V)
Clone a vector.
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
static u8 * elf_section_name(elf_main_t *em, elf_section_t *s)
u32 verneed_section_index
static u8 * format_elf_section_type(u8 *s, va_list *args)
static u8 * format_elf_segment_type(u8 *s, va_list *args)
#define foreach_elf32_section_header
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
#define foreach_elf64_section_header
uword elf_delete_segment_with_type(elf_main_t *em, elf_segment_type_t segment_type)
void elf_set_dynamic_entries(elf_main_t *em)
static void elf_parse_dynamic(elf_main_t *em)
static void elf_swap_first_header(elf_main_t *em, elf_first_header_t *h)
static u8 * format_elf_relocation(u8 *s, va_list *args)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static void elf_swap_verneed(elf_dynamic_version_need_t *n)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
#define hash_set_mem(h, key, value)
static u8 * format_elf_dynamic_entry(u8 *s, va_list *args)
#define clib_error_report(e)
#define foreach_elf_section_type
void elf_parse_symbols(elf_main_t *em)
#define vec_bytes(v)
Number of data bytes in vector.
u32 dynamic_section_index
static u64 elf_swap_u64(elf_main_t *em, u64 x)
#define FORMAT_ELF_MAIN_RELOCATIONS
#define foreach_elf64_file_header
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
#define foreach_elf_dynamic_version_need_aux_field
#define foreach_elf64_symbol_header
uword * section_index_bitmap
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void add_symbol_table(elf_main_t *em, elf_section_t *s)
#define foreach_elf32_segment_header
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
#define vec_end(v)
End (last data address) of vector.
#define foreach_elf_file_class
static u8 * format_elf_abi(u8 *s, va_list *args)
static void set_symbol_table(elf_main_t *em, u32 table_index)
elf_symbol_table_t * symbol_tables
static u8 * format_elf_data_encoding(u8 *s, va_list *args)
static uword pointer_to_uword(const void *p)
#define hash_create_string(elts, value_bytes)
#define foreach_elf_dynamic_version_need_field
elf_dynamic_version_need_aux_t aux
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
clib_error_t * elf_write_file(elf_main_t *em, char *file_name)
#define foreach_elf_symbol_visibility
static void add_relocation_table(elf_main_t *em, elf_section_t *s)
u8 * dynamic_string_table
static void elf_swap_verneed_aux(elf_dynamic_version_need_aux_t *n)
#define clib_error_return_unix(e, args...)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
#define foreach_elf_data_encoding
#define elf_relocation_next(r, type)
static u8 * format_elf_segment(u8 *s, va_list *args)
#define foreach_elf64_segment_header
static void byte_swap_verneed(elf_main_t *em, elf_dynamic_version_need_union_t *vus)
static u32 string_table_add_name_index(string_table_builder_t *b, u32 index)
#define foreach_elf32_file_header
static void elf_set_section_contents(elf_main_t *em, uword section_index, void *new_contents, uword n_content_bytes)
static void * elf_get_section_contents_with_starting_address(elf_main_t *em, uword start_address, uword elt_size, u32 *section_index_result)
elf_first_header_t first_header
#define vec_free(V)
Free vector's memory (no header).
#define foreach_elf32_symbol_header
clib_error_t * elf_read_file(elf_main_t *em, char *file_name)
elf_relocation_with_addend_t * relocations
#define clib_memcpy(a, b, c)
static u8 * format_elf_architecture(u8 *s, va_list *args)
static void set_dynamic_verneed(elf_main_t *em)
static void layout_sections(elf_main_t *em)
static void elf_main_init(elf_main_t *em)
static u8 * format_elf_dynamic_entry_type(u8 *s, va_list *args)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
static u64 round_pow2_u64(u64 x, u64 pow2)
static uword round_pow2(uword x, uword pow2)
static u8 * string_table_done(string_table_builder_t *b)
static int elf_segment_va_compare(void *a1, void *a2)
#define foreach_elf_x86_64_relocation_type
static void elf_parse_segments(elf_main_t *em, void *data)
clib_error_t * elf_delete_named_section(elf_main_t *em, char *section_name)
u32 dynamic_symbol_table_section_index
static u8 * format_elf_section(u8 *s, va_list *args)
static void string_table_init(string_table_builder_t *b, u8 *old_table)
static int elf_section_offset_compare(void *a1, void *a2)
static void * elf_get_section_contents(elf_main_t *em, uword section_index, uword elt_size)
elf64_dynamic_entry_t * dynamic_entries
static u32 string_table_add_name(string_table_builder_t *b, u8 *n)
Bitmaps built as vectors of machine words.
static void elf_parse_sections(elf_main_t *em, void *data)
#define clib_bitmap_free(v)
Free a bitmap.
elf_relocation_table_t * relocation_tables
static void add_dynamic_entries(elf_main_t *em, elf_section_t *s)
static u8 * format_elf_relocation_type(u8 *s, va_list *args)
elf_dynamic_version_need_t need
#define FORMAT_ELF_MAIN_SYMBOLS
#define foreach_elf_symbol_binding
#define CLIB_ARCH_IS_BIG_ENDIAN
u8 * format_elf_symbol(u8 *s, va_list *args)
#define FORMAT_ELF_MAIN_DYNAMIC
#define ELF_SYMBOL_SECTION_RESERVED_LO
#define foreach_elf_symbol_reserved_section_index
static u8 * elf_symbol_name(elf_symbol_table_t *t, elf64_symbol_t *sym)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * elf_parse(elf_main_t *em, void *data, uword data_bytes)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static u8 * format_elf_file_class(u8 *s, va_list *args)
uword * segment_index_bitmap
elf64_file_header_t file_header
elf_section_t * elf_get_section_by_start_address_no_check(elf_main_t *em, uword start_address)
#define hash_get_mem(h, key)
#define foreach_elf_symbol_type
u32 dynamic_symbol_table_index
elf64_section_header_t header
#define vec_foreach(var, vec)
Vector iterator.
elf_dynamic_version_need_union_t * verneed
static u8 * format_elf_symbol_visibility(u8 *s, va_list *args)
void elf_create_section_with_contents(elf_main_t *em, char *section_name, elf64_section_header_t *header, void *contents, uword n_content_bytes)
#define clib_error_return(e, args...)
clib_error_t * elf_get_section_by_name(elf_main_t *em, char *section_name, elf_section_t **result)
static u16 elf_swap_u16(elf_main_t *em, u16 x)
static u16 clib_byte_swap_u16(u16 x)
static u8 * format_elf_symbol_binding_and_type(u8 *s, va_list *args)
clib_error_t * elf_get_section_by_start_address(elf_main_t *em, uword start_address, elf_section_t **result)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
static char * elf_find_interpreter(elf_main_t *em, void *data)
uword * section_by_start_address
u32 dynamic_string_table_section_index