[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#922280: Wrong name of dynamic linker is in binaries cross-compiled by arm-gcc.



Package: gcc-arm-linux-gnueabi
Version: 6.3.0-4 

The name of dynamic linker of binaries cross-compiled by arm-gcc is 
`/lib/ld-linux.so.3`.

```
# # on an amd64 machine
# echo "int main(){ return 0; }" > test.c
# arm-linux-gnueabi-gcc test.c -o test
# env LC_ALL=C arm-linux-gnueabi-readelf -l test

Elf file type is DYN (Shared object file)
Entry point 0x464
There are 9 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX          0x0006cc 0x000006cc 0x000006cc 0x00008 0x00008 R   0x4
  PHDR           0x000034 0x00000034 0x00000034 0x00120 0x00120 R E 0x4
  INTERP         0x000154 0x00000154 0x00000154 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.3]
  LOAD           0x000000 0x00000000 0x00000000 0x006d8 0x006d8 R E 0x10000
  LOAD           0x000f04 0x00010f04 0x00010f04 0x00140 0x00144 RW  0x10000
  DYNAMIC        0x000f10 0x00010f10 0x00010f10 0x000f0 0x000f0 RW  0x4
  NOTE           0x000168 0x00000168 0x00000168 0x00044 0x00044 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x10
  GNU_RELRO      0x000f04 0x00010f04 0x00010f04 0x000fc 0x000fc R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     .ARM.exidx 
   01     
   02     .interp 
   03     .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .ARM.exidx .eh_frame 
   04     .init_array .fini_array .jcr .dynamic .got .data .bss 
   05     .dynamic 
   06     .note.ABI-tag .note.gnu.build-id 
   07     
   08     .init_array .fini_array .jcr .dynamic 
```

However, in debian-armhf, the dynamic linker should be 
`/lib/ld-linux-armhf.so.3`.

```
# # on an armhf machine
# readelf -l /bin/true 

Elf file type is DYN (Shared object file)
Entry point 0x109d
There are 9 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX          0x004060 0x00004060 0x00004060 0x00008 0x00008 R   0x4
  PHDR           0x000034 0x00000034 0x00000034 0x00120 0x00120 R E 0x4
  INTERP         0x000154 0x00000154 0x00000154 0x00019 0x00019 R   0x1
      [Requesting program interpreter: /lib/ld-linux-armhf.so.3]
  LOAD           0x000000 0x00000000 0x00000000 0x0406c 0x0406c R E 0x10000
  LOAD           0x004ed0 0x00014ed0 0x00014ed0 0x002d8 0x0041c RW  0x10000
  DYNAMIC        0x004f08 0x00014f08 0x00014f08 0x000f8 0x000f8 RW  0x4
  NOTE           0x000170 0x00000170 0x00000170 0x00044 0x00044 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x10
  GNU_RELRO      0x004ed0 0x00014ed0 0x00014ed0 0x00130 0x00130 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     .ARM.exidx 
   01     
   02     .interp 
   03     .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .ARM.exidx .eh_frame 
   04     .init_array .fini_array .jcr .data.rel.ro .dynamic .got .data .bss 
   05     .dynamic 
   06     .note.ABI-tag .note.gnu.build-id 
   07     
   08     .init_array .fini_array .jcr .data.rel.ro .dynamic 
```

When I copy the cross-compiled binary to an armhf machine, the 
executable cannot get executed.

```
# ./test 
/lib/ld-linux.so.3: No such file or directory
```

I wonder whether it is a bug or left on purpose.


Reply to: