Skip to content

Commit

Permalink
CMakeLists.txt: Good link_libraries() depends
Browse files Browse the repository at this point in the history
Signed-off-by: Rong Tao <[email protected]>
  • Loading branch information
Rtoax committed Jun 12, 2024
1 parent 003e627 commit 38f95d5
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 50 deletions.
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ find_library(ELF elf /usr/lib64)
find_library(RT rt /usr/lib64)

link_libraries(${ELF} ${RT}
ulpatch_arch
ulpatch_utils
ulpatch_elf
ulpatch_patch
ulpatch_utils
)
add_definitions(-MD -Wall -Werror -D_GNU_SOURCE -Wuninitialized -Wreturn-type -pg)

Expand Down
1 change: 0 additions & 1 deletion src/elf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ find_library(ELF elf /usr/lib64)

link_libraries(${ELF}
ulpatch_utils
ulpatch_patch
)

add_definitions(-MD -Wall -Werror -D_GNU_SOURCE -Wuninitialized -Wreturn-type)
Expand Down
1 change: 1 addition & 0 deletions src/elf/elf_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ int fprint_symbol(FILE *fp, struct symbol *s, int firstline);
*/
int print_sym(const GElf_Sym *sym, const char *symname, const char *vername);
int is_undef_symbol(const GElf_Sym *sym);
bool is_ftrace_entry(char *func);

/* ELF Note api */
int handle_notes(struct elf_file *elf, GElf_Shdr *shdr, Elf_Scn *scn);
Expand Down
24 changes: 24 additions & 0 deletions src/elf/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,30 @@ int print_sym(const GElf_Sym *sym, const char *symname, const char *vername)
return 0;
}

const static char *___ftrace_entry_funcs[] = {
"__cyg_profile_func_enter",
"__fentry__",
"mcount",
"_mcount",
"__gnu_mcount_nc",
};

/* If compile with -pg, there might be hava mcount() */
bool is_ftrace_entry(char *func)
{
int i;
bool ret = false;

for (i = 0; i < ARRAY_SIZE(___ftrace_entry_funcs); i++) {
if (!strcmp(___ftrace_entry_funcs[i], func)) {
ret = true;
break;
}
}

return ret;
}

int is_undef_symbol(const GElf_Sym *sym)
{
return sym->st_shndx == SHN_UNDEF || sym->st_shndx >= SHN_LORESERVE;
Expand Down
1 change: 0 additions & 1 deletion src/patch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ link_libraries(${ELF}
add_definitions(-MD -Wall -Werror -D_GNU_SOURCE -Wuninitialized -Wreturn-type)

add_library(ulpatch_patch STATIC
ftrace.c
patch.c
)

Expand Down
44 changes: 0 additions & 44 deletions src/patch/ftrace.c

This file was deleted.

2 changes: 0 additions & 2 deletions src/patch/patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ struct jmp_table_entry {

struct task_struct;

bool is_ftrace_entry(char *func);

extern void _ftrace_mcount(void);
extern void _ftrace_mcount_return(void);

Expand Down

0 comments on commit 38f95d5

Please sign in to comment.