bug-binutils
[Top][All Lists]
Advanced

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

binutils 2.16.1: objcopy broken on solaris x86?


From: Andrew Morrow
Subject: binutils 2.16.1: objcopy broken on solaris x86?
Date: Fri, 22 Jul 2005 14:50:35 -0400

I'm working on Solaris 10 on an opteron machine, with 64-bit support
enabled. Using binutils-2.16.1, objcopy changes the alignment fields
in the elf program header of a shared library to inappropriate values
for the platform.

The shared library used to test was generated with gcc-4.0.1,
configured to use the gnu assembler and the solaris linker (as
suggested in the config notes at:
http://gcc.gnu.org/install/specific.html#ix86-x-solaris210).

objcopy libfizzle32.so libfizzle32.so.copied 
objdump -x libfizzle32.so > libfizzle32.so.dump
objdump -x libfizzle32.so.copied  > libfizzle32.so.copied.dump
diff libfizzle32.so.dump libfizzle32.so.copied.dump 
2,3c2,3
< libfizzle32.so:     file format elf32-i386
< libfizzle32.so
---
> libfizzle32.so.copied:     file format elf32-i386
> libfizzle32.so.copied
9c9
<     LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**16
---
>     LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
11c11
<     LOAD off    0x00000564 vaddr 0x00010564 paddr 0x00000000 align 2**16
---
>     LOAD off    0x00000564 vaddr 0x00010564 paddr 0x00010564 align 2**12
13,14c13,14
<  DYNAMIC off    0x00000588 vaddr 0x00010588 paddr 0x00000000 align 2**0
<          filesz 0x000000b0 memsz 0x00000000 flags rwx
---
>  DYNAMIC off    0x00000588 vaddr 0x00010588 paddr 0x00010588 align 2**2
>          filesz 0x000000b0 memsz 0x000000b0 flags rwx

The same happens for a 64 bit target:

diff libfizzle64.so.dump libfizzle64.so.copied.dump 
2,3c2,3
< libfizzle64.so:     file format elf64-x86-64
< libfizzle64.so
---
> libfizzle64.so.copied:     file format elf64-x86-64
> libfizzle64.so.copied
9c9
<     LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr
0x0000000000000000 align 2**16
---
>     LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 
> 0x0000000000000000 align 2**4
11c11
<     LOAD off    0x00000000000007f8 vaddr 0x00000000000107f8 paddr
0x0000000000000000 align 2**16
---
>     LOAD off    0x00000000000007f8 vaddr 0x00000000000107f8 paddr 
> 0x00000000000107f8 align 2**5
13,15c13,15
<  DYNAMIC off    0x0000000000000840 vaddr 0x0000000000010840 paddr
0x0000000000000000 align 2**0
<          filesz 0x0000000000000160 memsz 0x0000000000000000 flags rw-
< 0x6464e550 off    0x0000000000000120 vaddr 0x0000000000000120 paddr
0x0000000000000000 align 2**3
---
>  DYNAMIC off    0x0000000000000840 vaddr 0x0000000000010840 paddr 
> 0x0000000000010840 align 2**3
>          filesz 0x0000000000000160 memsz 0x0000000000000160 flags rw-
> 0x6464e550 off    0x0000000000000120 vaddr 0x0000000000000120 paddr 
> 0x0000000000000120 align 2**3

According to the solaris linker and library guide

http://docs.sun.com/app/docs/doc/817-1984/6mhm7pl2a?a=view#chapter6-34713

p_align should be 2**16 for 32 bit segments, and 2**20 for 64 bit
segments. There seems to be a little inconsistency here, because on
x86-64, the solaris linker generates p_align as 2**16, but the solaris
documentation suggests it should be 2**20. Either way, the p_align
values after objcopy do not meet the requirements.

I also tried this on Solaris on SPARC, but objcopy correctly handled
the alignment for both 32 bit targets and 64 bit targets, so this
seems to be x86 specific.

I have also verified that this probem exists in the 07/22 binutils snapshot.

Thanks,
Andrew




reply via email to

[Prev in Thread] Current Thread [Next in Thread]