-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelf.c
More file actions
35 lines (27 loc) · 645 Bytes
/
elf.c
File metadata and controls
35 lines (27 loc) · 645 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* (C) 2014 Mura Li <mura_li@castech.com.tw>
*/
#include <linux/kernel.h>
#include <linux/elf.h>
#include "include/global.h"
void *find_phdr_addr(struct elf32_phdr *phdr, unsigned long size, unsigned long id)
{
unsigned long i;
for (i = 0; i < size; i++) {
if (phdr[i].p_type == id)
return &phdr[i];
}
return NULL;
}
struct dynamic *find_dynamic_entry(struct dynamic *dyn, unsigned long size, unsigned long tag)
{
unsigned long i;
assert(dyn, !=, NULL);
for (i = 0; i < size/sizeof(struct dynamic); i++) {
if (dyn[i].d_tag == tag)
return &dyn[i];
if (dyn[i].d_tag == DT_NULL)
return NULL;
}
return NULL;
}