mirror of
https://github.com/dynup/kpatch
synced 2024-12-25 23:02:02 +00:00
kpatch-elf: add find_rela_by_offset()
Add find_rela_by_offset(), which, given a relocation section and offset, will return the rela struct with the matching offset.
This commit is contained in:
parent
42902d0fcc
commit
900d28fe75
@ -118,6 +118,18 @@ struct symbol *find_symbol_by_name(struct list_head *list, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct rela *find_rela_by_offset(struct section *relasec, unsigned int offset)
|
||||
{
|
||||
struct rela *rela;
|
||||
|
||||
list_for_each_entry(rela, &relasec->relas, list) {
|
||||
if (rela->offset == offset)
|
||||
return rela;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* returns the offset of the string in the string table */
|
||||
int offset_of_string(struct list_head *list, char *name)
|
||||
{
|
||||
|
@ -117,6 +117,7 @@ struct section *find_section_by_index(struct list_head *list, unsigned int index
|
||||
struct section *find_section_by_name(struct list_head *list, const char *name);
|
||||
struct symbol *find_symbol_by_index(struct list_head *list, size_t index);
|
||||
struct symbol *find_symbol_by_name(struct list_head *list, const char *name);
|
||||
struct rela *find_rela_by_offset(struct section *relasec, unsigned int offset);
|
||||
|
||||
#define ALLOC_LINK(_new, _list) \
|
||||
{ \
|
||||
|
Loading…
Reference in New Issue
Block a user