This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: VMA format in linker map file on 64-bit host for 32-bit target.
- From: Sergey Organov <sorganov at gmail dot com>
- To: binutils at sourceware dot org
- Date: Tue, 17 Nov 2015 18:18:27 +0300
- Subject: Re: VMA format in linker map file on 64-bit host for 32-bit target.
- Authentication-results: sourceware.org; auth=none
- References: <n2cire$brs$1 at ger dot gmane dot org> <564B1309 dot 9000901 at redhat dot com>
Nick Clifton <nickc@redhat.com> writes:
> Hi Sergey,
>
>> I've build binutils-2.25.1 on x86_64 for --target=sparc-elf, and in the
>> map file for the target linker prints all the VMA addresses as 64-bit
>> (16-chars hexadecimals), that is inconvenient. Is there any configure or
>> invocation switch that controls this, or the only way is to build
>> binutils on 32-bit host?
>
> Sorry - the size of the VMA printing is controlled by the size of the
> host. Have you tried this:
>
> CC="gcc -m32" CXX="g++ -m32" ABI="32" setarch i686 \
> <binutils-source)/configure \
> --target=sparc-elf
Now I did, and it does the trick, thanks!
Without this I've had to patch the sources like this (not a proper patch, I know,
as it breaks 64-bit targets):
Modified bfd/bfd-in.h
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 1607872..b837289 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -144,8 +144,8 @@ typedef BFD_HOST_U_64_BIT symvalue;
#endif
#ifndef fprintf_vma
-#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
-#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
+#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", ((x) & ((1UL << 32) - 1)))
+#define fprintf_vma(f,x) fprintf (f, "%08" BFD_VMA_FMT "x", ((x) & ((1UL << 32) - 1)))
#endif
#else /* not BFD64 */
-- Sergey.