summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDidier Brachet2012-08-24 10:38:40 (EDT)
committerEugene Tarassov2012-08-29 12:14:29 (EDT)
commit87e16430ddf152b25c868e2c81b71fcfd7f6c7e9 (patch)
treed4baeaa62620692201165a862fc124c5fcdb1d3d
parentc8208c22bb74fa62c7388d1b5621f704f8f4740c (diff)
downloadorg.eclipse.tcf.agent-87e16430ddf152b25c868e2c81b71fcfd7f6c7e9.zip
org.eclipse.tcf.agent-87e16430ddf152b25c868e2c81b71fcfd7f6c7e9.tar.gz
org.eclipse.tcf.agent-87e16430ddf152b25c868e2c81b71fcfd7f6c7e9.tar.bz2
Bug 387815 - Fixed ARM THUMB mode support in ELF symbol reader
-rw-r--r--agent/tcf/services/tcf_elf.c15
-rw-r--r--agent/tcf/services/tcf_elf.h4
2 files changed, 19 insertions, 0 deletions
diff --git a/agent/tcf/services/tcf_elf.c b/agent/tcf/services/tcf_elf.c
index 59ffa81..ce11ef3 100644
--- a/agent/tcf/services/tcf_elf.c
+++ b/agent/tcf/services/tcf_elf.c
@@ -1389,6 +1389,13 @@ void unpack_elf_symbol_info(ELF_Section * sym_sec, U4_T index, ELF_SymbolInfo *
info->value = s.st_value;
info->size = s.st_size;
}
+
+ if (file->machine == EM_ARM) {
+ if (info->type == STT_FUNC || info->type == STT_ARM_TFUNC) {
+ info->value = info->value & ~ (U8_T)1;
+ info->type = STT_FUNC;
+ }
+ }
}
static void create_symbol_names_hash(ELF_Section * tbl) {
@@ -1441,12 +1448,14 @@ static void create_symbol_addr_search_index(ELF_Section * sec) {
while (n < tbl->sym_count) {
int add = 0;
U8_T addr = 0;
+ U1_T type = 0;
if (elf64) {
Elf64_Sym s = ((Elf64_Sym *)tbl->data)[n];
if (swap) SWAP(s.st_shndx);
if (s.st_shndx == sec->index) {
if (swap) SWAP(s.st_value);
addr = s.st_value;
+ type = ELF64_ST_TYPE(s.st_info);
if (rel) addr += sec->addr;
add = 1;
}
@@ -1457,12 +1466,18 @@ static void create_symbol_addr_search_index(ELF_Section * sec) {
if (s.st_shndx == sec->index) {
if (swap) SWAP(s.st_value);
addr = s.st_value;
+ type = ELF32_ST_TYPE(s.st_info);
if (rel) addr += sec->addr;
add = 1;
}
}
if (add) {
ELF_SecSymbol * s = NULL;
+ if (file->machine == EM_ARM) {
+ if (type == STT_FUNC || type == STT_ARM_TFUNC) {
+ addr = addr & ~(U8_T)1;
+ }
+ }
if (sec->sym_addr_cnt >= sec->sym_addr_max) {
sec->sym_addr_max = sec->sym_addr_max * 3 / 2;
sec->sym_addr_table = (ELF_SecSymbol *)loc_realloc(sec->sym_addr_table, sec->sym_addr_max * sizeof(ELF_SecSymbol));
diff --git a/agent/tcf/services/tcf_elf.h b/agent/tcf/services/tcf_elf.h
index 8eb5c47..31fcb06 100644
--- a/agent/tcf/services/tcf_elf.h
+++ b/agent/tcf/services/tcf_elf.h
@@ -117,6 +117,10 @@
#define STT_FUNC 2
#define STT_SECTION 3
#define STT_FILE 4
+#define STT_LOPROC 13
+#define STT_HIPROC 15
+#define STT_ARM_TFUNC STT_LOPROC
+
#define PT_NULL 0
#define PT_LOAD 1