summaryrefslogtreecommitdiff
path: root/src/format/elf
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-07-12 22:26:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-07-12 22:26:49 (GMT)
commit7e1c5ac72a317d39952843239023c0fa506f2322 (patch)
tree206b4f7ca4165c22b796d90e3343f677296b0857 /src/format/elf
parent254254db8c09eb4b4f8523e73551c13ec281d194 (diff)
Cleaned the code handling binary symbols.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@548 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/elf')
-rw-r--r--src/format/elf/helper_arm.c18
-rw-r--r--src/format/elf/helper_x86.c14
-rw-r--r--src/format/elf/strings.c2
-rw-r--r--src/format/elf/symbols.c4
4 files changed, 19 insertions, 19 deletions
diff --git a/src/format/elf/helper_arm.c b/src/format/elf/helper_arm.c
index efc8a3d..c77df55 100644
--- a/src/format/elf/helper_arm.c
+++ b/src/format/elf/helper_arm.c
@@ -118,7 +118,7 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx,
g_binary_routine_set_range(routine, &range);
- symbol = g_binary_symbol_new(STP_ROUTINE, NULL, ~0);
+ symbol = g_binary_symbol_new(STP_ROUTINE);
g_binary_symbol_attach_routine(symbol, routine);
g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
@@ -131,7 +131,7 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx,
((unsigned int)ELF_SHDR(format, (*relxxx), sh_addr) + ELF_REL(format, reloc, r_offset)));
*/
- //symbol = g_binary_symbol_new(STP_FUNCTION, name, ELF_REL(format, reloc, r_offset));
+ //symbol = g_binary_symbol_new(STP_FUNCTION));
//g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
break;
@@ -269,7 +269,7 @@ bool load_elf_x86_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx,
name = "unknown";
}
- symbol = g_binary_symbol_new(STP_FUNCTION, name, ELF_REL(format, reloc, r_offset));
+ symbol = g_binary_symbol_new(STP_FUNCTION);
g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
break;
@@ -430,19 +430,19 @@ void translate_exe_elf_relocations(GElfFormat *format, GArchInstruction **instru
symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &symbols_count);
for (j = 0; j < symbols_count; j++)
- if (g_binary_symbol_get_address(symbols[j]) == address)
+ if (0 /* FIXME g_binary_symbol_get_address(symbols[j]) == address*/)
{
/* Nom final */
- new_len = strlen(g_binary_symbol_to_string(symbols[j])) + 4 + 1;
+ new_len = strlen(g_binary_symbol_get_label(symbols[j])) + 4 + 1;
new_name = calloc(new_len, sizeof(char));
- snprintf(new_name, new_len, "%s@plt", g_binary_symbol_to_string(symbols[j]));
+ snprintf(new_name, new_len, "%s@plt", g_binary_symbol_get_label(symbols[j]));
g_arch_instruction_get_location(instructions[i], NULL, NULL, &address);
/* Routine */
- routine = try_to_demangle_routine(g_binary_symbol_to_string(symbols[j]));
+ routine = try_to_demangle_routine(g_binary_symbol_get_label(symbols[j]));
///g_binary_routine_set_address(routine, address);
@@ -450,7 +450,7 @@ void translate_exe_elf_relocations(GElfFormat *format, GArchInstruction **instru
/* Symbole uniquement */
- symbol = g_binary_symbol_new(STP_FUNCTION, new_name, address);
+ symbol = g_binary_symbol_new(STP_FUNCTION);
g_binary_symbol_attach_routine(symbol, routine);
@@ -558,7 +558,7 @@ void translate_dyn_elf_relocations(GElfFormat *format, GArchInstruction **instru
/* Symbole uniquement */
- symbol = g_binary_symbol_new(STP_FUNCTION, new_name, address);
+ symbol = g_binary_symbol_new(STP_FUNCTION);
g_binary_symbol_attach_routine(symbol, routine);
diff --git a/src/format/elf/helper_x86.c b/src/format/elf/helper_x86.c
index 742d1c3..deb1ead 100644
--- a/src/format/elf/helper_x86.c
+++ b/src/format/elf/helper_x86.c
@@ -121,7 +121,7 @@ bool load_elf_x86_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx,
name = "unknown";
}
- symbol = g_binary_symbol_new(STP_FUNCTION, name, ELF_REL(format, reloc, r_offset));
+ symbol = g_binary_symbol_new(STP_FUNCTION);
g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
break;
@@ -282,19 +282,19 @@ void translate_exe_elf_relocations(GElfFormat *format, GArchInstruction **instru
symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &symbols_count);
for (j = 0; j < symbols_count; j++)
- if (g_binary_symbol_get_address(symbols[j]) == address)
+ if (0 /* FIXME g_binary_symbol_get_address(symbols[j]) == address*/)
{
/* Nom final */
- new_len = strlen(g_binary_symbol_to_string(symbols[j])) + 4 + 1;
+ new_len = strlen(g_binary_symbol_get_label(symbols[j])) + 4 + 1;
new_name = calloc(new_len, sizeof(char));
- snprintf(new_name, new_len, "%s@plt", g_binary_symbol_to_string(symbols[j]));
+ snprintf(new_name, new_len, "%s@plt", g_binary_symbol_get_label(symbols[j]));
g_arch_instruction_get_location(instructions[i], NULL, NULL, &address);
/* Routine */
- routine = try_to_demangle_routine(g_binary_symbol_to_string(symbols[j]));
+ routine = try_to_demangle_routine(g_binary_symbol_get_label(symbols[j]));
///g_binary_routine_set_address(routine, address);
@@ -302,7 +302,7 @@ void translate_exe_elf_relocations(GElfFormat *format, GArchInstruction **instru
/* Symbole uniquement */
- symbol = g_binary_symbol_new(STP_FUNCTION, new_name, address);
+ symbol = g_binary_symbol_new(STP_FUNCTION);
g_binary_symbol_attach_routine(symbol, routine);
@@ -410,7 +410,7 @@ void translate_dyn_elf_relocations(GElfFormat *format, GArchInstruction **instru
/* Symbole uniquement */
- symbol = g_binary_symbol_new(STP_FUNCTION, new_name, address);
+ symbol = g_binary_symbol_new(STP_FUNCTION);
g_binary_symbol_attach_routine(symbol, routine);
diff --git a/src/format/elf/strings.c b/src/format/elf/strings.c
index c11d53b..6832f5b 100644
--- a/src/format/elf/strings.c
+++ b/src/format/elf/strings.c
@@ -209,7 +209,7 @@ bool parse_elf_string_data(GElfFormat *format, off_t start, off_t size, vmpa_t a
label = create_string_label(G_BIN_FORMAT(format), &pos, &data[i], end - i);
- g_binary_symbol_set_label(symbol, label);
+ g_binary_symbol_set_alt_label(symbol, label);
free(label);
diff --git a/src/format/elf/symbols.c b/src/format/elf/symbols.c
index 655eda1..1fa3d0e 100644
--- a/src/format/elf/symbols.c
+++ b/src/format/elf/symbols.c
@@ -201,7 +201,7 @@ static void register_elf_entry_point(GElfFormat *format, virt_t vaddr, phys_t le
g_binary_routine_set_range(routine, &range);
- symbol = g_binary_symbol_new(STP_ENTRY_POINT, "XXX", ~0);
+ symbol = g_binary_symbol_new(STP_ENTRY_POINT);
g_binary_symbol_attach_routine(symbol, routine);
_g_binary_format_add_symbol(base, symbol, false);
@@ -622,7 +622,7 @@ static bool load_elf_internal_symbols(GElfFormat *format)
/* Symbole uniquement */
- symbol = g_binary_symbol_new(STP_ROUTINE, name, ~0);
+ symbol = g_binary_symbol_new(STP_ROUTINE);
g_binary_symbol_attach_routine(symbol, routine);
break;