This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: VMA format in linker map file on 64-bit host for 32-bit target.

Nick Clifton <> 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;
 #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)))
 #else /* not BFD64  */

-- Sergey.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]