diff options
author | Shih-wei Liao <sliao@google.com> | 2011-11-16 19:08:30 -0800 |
---|---|---|
committer | Shih-wei Liao <sliao@google.com> | 2011-11-16 19:31:49 -0800 |
commit | 43db194a094f3ee594bfab5e322961fa30da59c9 (patch) | |
tree | 3af2e26f1ac172d64e9afeabdb91a127405341fb | |
parent | 7cea0a041b87afe2c5ad5f26e6a89494d0819bd1 (diff) | |
download | linkloader-43db194a094f3ee594bfab5e322961fa30da59c9.tar.gz |
Fix linker bug where addend != 0 for High16 and Low16.
Change-Id: I74b3b87741952b0b441bd440630b4e92b2a9c0a1
-rw-r--r-- | include/impl/ELFObject.hxx | 8 | ||||
-rw-r--r-- | lib/MemChunk.cpp | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/include/impl/ELFObject.hxx b/include/impl/ELFObject.hxx index b1b51e4..bde835b 100644 --- a/include/impl/ELFObject.hxx +++ b/include/impl/ELFObject.hxx @@ -379,12 +379,16 @@ relocateMIPS(void *(*find_sym)(void *context, char const *name), case R_MIPS_HI16: A = A & 0xFFFF; - *inst |= (((S + A + 0x8000) >> 16) & 0xFFFF); + // FIXME: We just support addend = 0. + rsl_assert(A == 0 && "R_MIPS_HI16 addend is not 0."); + *inst |= (((S + 0x8000) >> 16) & 0xFFFF); break; case R_MIPS_LO16: A = A & 0xFFFF; - *inst |= ((S + A) & 0xFFFF); + // FIXME: We just support addend = 0. + rsl_assert(A == 0 && "R_MIPS_LO16 addend is not 0."); + *inst |= (S & 0xFFFF); break; case R_MIPS_26: diff --git a/lib/MemChunk.cpp b/lib/MemChunk.cpp index 5c9a873..5a5cdbe 100644 --- a/lib/MemChunk.cpp +++ b/lib/MemChunk.cpp @@ -31,6 +31,8 @@ // define it as zero, so that it won't manipulate the flags. #endif +#define USE_FIXED_ADDR_MEM_CHUNK 1 + #if USE_FIXED_ADDR_MEM_CHUNK static uintptr_t StartAddr = 0x7e000000UL; #endif |