diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-01-13 07:56:34 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-01-13 07:56:34 +0000 |
commit | 2d491163b34056298e79652d18cdf45e3a49baef (patch) | |
tree | 718d952656ca932e923126b07497a7476a4b3c50 /sys-apps/file/files | |
parent | Version bump from upstream (Bug #109586) (diff) | |
download | gentoo-2-2d491163b34056298e79652d18cdf45e3a49baef.tar.gz gentoo-2-2d491163b34056298e79652d18cdf45e3a49baef.tar.bz2 gentoo-2-2d491163b34056298e79652d18cdf45e3a49baef.zip |
Fix 64bit elf detection when cross-compiling.
(Portage version: 2.1_pre3-r1)
Diffstat (limited to 'sys-apps/file/files')
-rw-r--r-- | sys-apps/file/files/file-4.16-fix-array-64bit.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/sys-apps/file/files/file-4.16-fix-array-64bit.patch b/sys-apps/file/files/file-4.16-fix-array-64bit.patch new file mode 100644 index 000000000000..ad14f25e35f0 --- /dev/null +++ b/sys-apps/file/files/file-4.16-fix-array-64bit.patch @@ -0,0 +1,65 @@ +--- src/readelf.h ++++ src/readelf.h +@@ -50,6 +50,7 @@ + typedef uint32_t Elf64_Off[2]; + typedef uint32_t Elf64_Xword[2]; + #else ++#undef USE_ARRAY_FOR_64BIT_TYPES + typedef uint64_t Elf64_Addr; + typedef uint64_t Elf64_Off; + typedef uint64_t Elf64_Xword; +--- src/readelf.c ++++ src/readelf.c +@@ -121,6 +121,14 @@ + return value; + } + ++#ifdef USE_ARRAY_FOR_64BIT_TYPES ++# define elf_getu64(swap, array) \ ++ ((swap ? ((uint64_t)getu32(swap, array[0])) << 32 : getu32(swap, array[0])) + \ ++ (swap ? getu32(swap, array[1]) : ((uint64_t)getu32(swap, array[1]) << 32))) ++#else ++# define elf_getu64(swap, value) getu64(swap, value) ++#endif ++ + #define xsh_addr (class == ELFCLASS32 \ + ? (void *) &sh32 \ + : (void *) &sh64) +@@ -913,11 +921,7 @@ + if (getu16(swap, elfhdr.e_type) == ET_CORE) { + #ifdef ELFCORE + if (dophn_core(ms, class, swap, fd, +-#ifdef USE_ARRAY_FOR_64BIT_TYPES +- (off_t)getu32(swap, elfhdr.e_phoff[1]), +-#else +- (off_t)getu64(swap, elfhdr.e_phoff), +-#endif ++ (off_t)elf_getu64(swap, elfhdr.e_phoff), + getu16(swap, elfhdr.e_phnum), + (size_t)getu16(swap, elfhdr.e_phentsize)) == -1) + return -1; +@@ -927,22 +931,14 @@ + } else { + if (getu16(swap, elfhdr.e_type) == ET_EXEC) { + if (dophn_exec(ms, class, swap, fd, +-#ifdef USE_ARRAY_FOR_64BIT_TYPES +- (off_t)getu32(swap, elfhdr.e_phoff[1]), +-#else +- (off_t)getu64(swap, elfhdr.e_phoff), +-#endif ++ (off_t)elf_getu64(swap, elfhdr.e_phoff), + getu16(swap, elfhdr.e_phnum), + (size_t)getu16(swap, elfhdr.e_phentsize)) + == -1) + return -1; + } + if (doshn(ms, class, swap, fd, +-#ifdef USE_ARRAY_FOR_64BIT_TYPES +- (off_t)getu32(swap, elfhdr.e_shoff[1]), +-#else +- (off_t)getu64(swap, elfhdr.e_shoff), +-#endif ++ (off_t)elf_getu64(swap, elfhdr.e_shoff), + getu16(swap, elfhdr.e_shnum), + (size_t)getu16(swap, elfhdr.e_shentsize)) == -1) + return -1; |