summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <van.freenix@gmail.com>2013-07-18 11:05:02 +0800
committerPeng Fan <van.freenix@gmail.com>2013-07-21 11:32:06 +0800
commita2b1d16bd059010bb92e9164e693cb97c61dcc01 (patch)
tree2ce97fb396409c98a02a7b91a076dc48a24e5506
parent6c66d9a847afb8b7ae4d27d8d97558ff0f352af3 (diff)
Add support for relocations which reference local symbols
Signed-off-by: Peng Fan <van.freenix@gmail.com>
-rw-r--r--rld-files.cpp3
-rw-r--r--rld-files.h1
-rw-r--r--rld-rap.cpp21
3 files changed, 15 insertions, 10 deletions
diff --git a/rld-files.cpp b/rld-files.cpp
index 9887e48..45a10bd 100644
--- a/rld-files.cpp
+++ b/rld-files.cpp
@@ -910,7 +910,8 @@ namespace rld
symname (er.symbol ().name ()),
symtype (er.symbol ().type ()),
symsect (er.symbol ().section_index ()),
- symvalue (er.symbol ().value ())
+ symvalue (er.symbol ().value ()),
+ symbinding (er.symbol ().binding ())
{
}
diff --git a/rld-files.h b/rld-files.h
index 31ea764..019357e 100644
--- a/rld-files.h
+++ b/rld-files.h
@@ -625,6 +625,7 @@ namespace rld
const uint32_t symtype; //< The type of symbol.
const int symsect; //< The symbol's section symbol.
const uint32_t symvalue; //< The symbol's value.
+ const uint32_t symbinding;//< The symbol's binding.
/**
* Construct from an ELF relocation record.
diff --git a/rld-rap.cpp b/rld-rap.cpp
index ab57b3e..2b805cf 100644
--- a/rld-rap.cpp
+++ b/rld-rap.cpp
@@ -59,13 +59,14 @@ namespace rld
*/
struct relocation
{
- uint32_t offset; //< The offset in the section to apply the fixup.
- uint32_t info; //< The ELF info record.
- uint32_t addend; //< The ELF constant addend.
- std::string symname; //< The symbol name if there is one.
- uint32_t symtype; //< The type of symbol.
- int symsect; //< The symbol's RAP section.
- uint32_t symvalue; //< The symbol's default value.
+ uint32_t offset; //< The offset in the section to apply the fixup.
+ uint32_t info; //< The ELF info record.
+ uint32_t addend; //< The ELF constant addend.
+ std::string symname; //< The symbol name if there is one.
+ uint32_t symtype; //< The type of symbol.
+ int symsect; //< The symbol's RAP section.
+ uint32_t symvalue; //< The symbol's default value.
+ uint32_t symbinding;//< The symbol's binding.
/**
* Construct the relocation using the file relocation, the offset of the
@@ -430,7 +431,8 @@ namespace rld
symname (reloc.symname),
symtype (reloc.symtype),
symsect (reloc.symsect),
- symvalue (reloc.symvalue)
+ symvalue (reloc.symvalue),
+ symbinding (reloc.symbinding)
{
}
@@ -673,6 +675,7 @@ namespace rld
<< " reloc.addend=" << freloc.addend
<< " reloc.symtype=" << freloc.symtype
<< " reloc.symsect=" << freloc.symsect
+ << " reloc.symbinding=" << freloc.symbinding
<< std::endl;
sec.relocs.push_back (relocation (freloc, offset));
@@ -1268,7 +1271,7 @@ namespace rld
offset = sec.offset + reloc.offset;
- if (reloc.symtype == STT_SECTION)
+ if ((reloc.symtype == STT_SECTION) || (reloc.symbinding == STB_LOCAL))
{
int rap_symsect = obj.find (reloc.symsect);