This is the mail archive of the binutils@sourceware.org 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]

BFD: 64 link map addresses for 32 bit target


Hello everyone.

I have some strange link map output while building executable for 32 bit target and using binutils-2.27
*My test case is:*

~/test$ cat test.c
#include <stdio.h>

int main()
{
  printf("Hello world");
  return 0;
}

~/test$ arm-linux-gnueabi-gcc -o test test.c -static -B/path/to/ld/built/from/sources -Wl,-print-map > map

~/test$ arm-linux-gnueabi-gcc -v
.. --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi ..

~/test$ uname -a
 Linux 3.13.0-105-generic x86_64 x86_64 x86_64 GNU/Linux

~/test$ file test
test: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, for GNU/Linux 2.6.32

~/test$  arm-linux-gnueabi-gcc -v
.. --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi ..


1.*Link map output 64bit *a. Build binutils 2.27 from source with configure options

*$ *././configure --build=i586-linux-gnu --host=i586-linux-gnu --target=armv7l-linux-gnueabi/

and gcc configured with

/..--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu ../
 gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)

and 64 bit build environment.

b. Execute test case and open map file.

We will see addresses is 64 bit long:

Memory Configuration

 Name             Origin             Length             Attributes
 *default*        0x0000000000000000 0xffffffffffffffff

2.*Link map output 32bit*

a. Build binutils 2.27 from source with configure options

$ ../configure --build=i586-linux-gnu --host=i586-linux-gnu --target=armv7l-linux-gnueabi

and gcc configured with

--build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu**and 32 bit build environment**
b.Execute test case and open map file
We will see addresses is 32 bit long

Memory Configuration
Name             Origin             Length             Attributes
*default*        0x00000000         0xffffffff**


As i can see output format defined in file binutisl-2.27/bfd/bfd-in.h

 #define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x)
 #define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x)

 #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)

and depends on wordsize which configured in configure file and
depends on that three variables

case ${host64}-${target64}-${want64} in
   *true*)
   wordsize=64

Can someone please tell me is it normal behavior that output format depends
not only from binutils target.

Thanks.


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