Skip to content

Commit

Permalink
elf: Rename strbuildid() to elf_strbuildid()
Browse files Browse the repository at this point in the history
Signed-off-by: Rong Tao <[email protected]>
  • Loading branch information
Rtoax committed Jul 31, 2024
1 parent 24d2e67 commit d027c59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/elf/elf_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ bool is_ftrace_entry(char *func);
/* ELF Note api */
int handle_notes(struct elf_file *elf, GElf_Shdr *shdr, Elf_Scn *scn);
int print_elf_build_id(FILE *fp, uint8_t *build_id, size_t descsz);
const char *strbuildid(uint8_t *bid, size_t descsz, char *buf, size_t buf_len);
const char *elf_strbuildid(uint8_t *bid, size_t descsz, char *buf,
size_t buf_len);

/* ELF Rela api */
int handle_relocs(struct elf_file *elf, GElf_Shdr *shdr, Elf_Scn *scn);
Expand Down
8 changes: 4 additions & 4 deletions src/elf/note.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#endif



static const void *convert(Elf *core, Elf_Type type, uint_fast16_t count,
void *value, const void *data, size_t size)
{
Expand Down Expand Up @@ -226,7 +225,8 @@ static void __unused handle_file_note(struct elf_file *elf, GElf_Word descsz,
}
}

const char *strbuildid(uint8_t *bid, size_t descsz, char *buf, size_t buf_len)
const char *elf_strbuildid(uint8_t *bid, size_t descsz, char *buf,
size_t buf_len)
{
char *p_buf = buf;
int i;
Expand All @@ -246,7 +246,7 @@ const char *strbuildid(uint8_t *bid, size_t descsz, char *buf, size_t buf_len)
int print_elf_build_id(FILE *fp, uint8_t *build_id, size_t descsz)
{
char buf[128];
const char *bid = strbuildid(build_id, descsz, buf, 128);
const char *bid = elf_strbuildid(build_id, descsz, buf, 128);
fprintf(fp, "%s\n", bid);
return 0;
}
Expand Down Expand Up @@ -315,7 +315,7 @@ int handle_notes(struct elf_file *elf, GElf_Shdr *shdr, Elf_Scn *scn)
(offset = gelf_getnote(data, offset, &nhdr, &name_offset,
&desc_offset)) > 0) {
const char *name = nhdr.n_namesz == 0 ? "" : data->d_buf + name_offset;
const char __unused *desc = data->d_buf + desc_offset;
const char *desc = data->d_buf + desc_offset;

/**
* GNU Build Attributes are weird, they store most of their data
Expand Down
3 changes: 2 additions & 1 deletion src/patch/patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ int setup_load_info(struct load_info *info)
bid = (void *)nhdr + sizeof(*nhdr) + nhdr->n_namesz;
strlen_bid = nhdr->n_descsz * 2 + 1;
info->str_build_id = malloc(strlen_bid);
strbuildid(bid, nhdr->n_descsz, info->str_build_id, strlen_bid);
elf_strbuildid(bid, nhdr->n_descsz, info->str_build_id,
strlen_bid);
break;
/* .note.gnu.property */
case NT_GNU_PROPERTY_TYPE_0:
Expand Down

0 comments on commit d027c59

Please sign in to comment.