summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-08-26 12:42:30 (GMT)
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-08-26 12:42:30 (GMT)
commit87f4d861229fbf75ac1d3ebe146c723487ecdb73 (patch)
treec985c943a43b0f7449c22e6070e58d7bbf96dbb9 /src
parent2b52ef1cdc12153308c82af4395f76779e1b40ee (diff)
downloadpatchelf-87f4d861229fbf75ac1d3ebe146c723487ecdb73.zip
patchelf-87f4d861229fbf75ac1d3ebe146c723487ecdb73.tar.gz
patchelf-87f4d861229fbf75ac1d3ebe146c723487ecdb73.tar.bz2
* Fix patching a little-endian binary on a big-endian machine. This
fixes the no-rpath test on powerpc-linux.
Diffstat (limited to 'src')
-rw-r--r--src/patchelf.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 09a52fe..e34c93f 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -157,7 +157,7 @@ private:
template<class I>
I wri(I & t, unsigned long long i)
{
- t = rdi(i);
+ t = rdi((I) i);
return i;
}
};
@@ -389,11 +389,11 @@ void ElfFile<ElfFileParamNames>::shiftFile(unsigned int extraPages, Elf_Addr sta
/* Update the offsets in the program headers. */
for (int i = 0; i < rdi(hdr->e_phnum); ++i) {
wri(phdrs[i].p_offset, rdi(phdrs[i].p_offset) + shift);
- if (phdrs[i].p_align != 0 &&
- (phdrs[i].p_vaddr - phdrs[i].p_offset) % phdrs[i].p_align != 0) {
+ if (rdi(phdrs[i].p_align) != 0 &&
+ (rdi(phdrs[i].p_vaddr) - rdi(phdrs[i].p_offset)) % rdi(phdrs[i].p_align) != 0) {
debug("changing alignment of program header %d from %d to %d\n", i,
- phdrs[i].p_align, pageSize);
- phdrs[i].p_align = pageSize;
+ rdi(phdrs[i].p_align), pageSize);
+ wri(phdrs[i].p_align, pageSize);
}
}