|
From: Kouhei S. <nul...@cl...> - 2013-11-17 09:51:43
|
Kouhei Sutou 2013-11-17 18:51:25 +0900 (Sun, 17 Nov 2013) New Revision: d7147c2d15917474dc1c43cd42516b158f6b2930 https://github.com/clear-code/cutter/commit/d7147c2d15917474dc1c43cd42516b158f6b2930 Message: loader elf: fix a bug that wrong information is used in the recent commit The commit is da6741e994e5ac38010a3ecb433cfa007ee22d9a. We need type information from info by ELFXX_ST_BIND() like bind information. Modified files: cutter/cut-elf-loader.c Modified: cutter/cut-elf-loader.c (+4 -2) =================================================================== --- cutter/cut-elf-loader.c 2013-11-17 18:44:46 +0900 (e49fa41) +++ cutter/cut-elf-loader.c 2013-11-17 18:51:25 +0900 (19dce47) @@ -373,7 +373,7 @@ cut_elf_loader_collect_symbols (CutELFLoader *loader) Elf32_Sym *symbol_32; Elf64_Sym *symbol_64; uint32_t name_index; - unsigned char info, bind; + unsigned char info, type, bind; uint16_t section_header_index; gsize offset; @@ -382,17 +382,19 @@ cut_elf_loader_collect_symbols (CutELFLoader *loader) symbol_32 = (Elf32_Sym *)(priv->content + offset); name_index = symbol_32->st_name; info = symbol_32->st_info; + type = ELF32_ST_TYPE(info); bind = ELF32_ST_BIND(info); section_header_index = symbol_32->st_shndx; } else { symbol_64 = (Elf64_Sym *)(priv->content + offset); name_index = symbol_64->st_name; info = symbol_64->st_info; + type = ELF64_ST_TYPE(info); bind = ELF64_ST_BIND(info); section_header_index = symbol_64->st_shndx; } - if ((info == STT_FUNC) && + if ((type == STT_FUNC) && (bind == STB_GLOBAL) && (section_header_index == text_section_header_index)) { const gchar *name; |