ld relocate symbols(in small common section) to a unaligned address.(on mips r3000 target)

2005-09-07 Thread zhigang gong
Dears,
 
   I have a problem when building my ecos test pattern.  My platform is based on mips r3000. I use the latest gcc and binutils. The configuration is as belows:
 
gcc4:
 ../gcc-4.0-20050901/configure --target=mipsel-elf --prefix=/home/zhigang/gnutools --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-gxx-include-dir=/home/zhigang/gnutools/mipsel-elf/include --with-float=soft --prefix=/home/zhigang/gnutools --enable-languages=c,c++
Thread model: singlegcc version 4.0.2 20050901 (prerelease)
 
binutils-2.16.1:
../binutils-2.16.1/configure --target=mipsel-elf --prefix=/home/zhigang/gnutools
 
the build command as belows:
 
mipsel-elf-gcc -L/home/zhigang/0808/pattern_install/lib -Ttarget.ld -o /home/zhigang/0808/pattern_install/tests/kernel/current/tests/thread_gdb tests/thread_gdb.o -msoft-float -nostdlib -Wl,--gc-sections -Wl,-static -Wl,-Map,
ii.map
 
Here is the fragment of the map file.
 
 *(.scommon) .scommon   0x8090bc44    0x9 tests/thread_gdb.o    0x8090bc44    worker_cv    0x8090bc4c    worker_state .scommon   0x8090bc4d    0xc /home/zhigang/0808/pattern_install/lib/extras.o
    0x8090bc4d    piofree_handle  --Please see here, the address is not correct aligned    0x8090bc51    flag_int_reason  ---as above, the address is misaligned
 *fill* 0x8090bc59    0x3 00 .scommon   0x8090bc5c    0x4 /home/zhigang/0808/pattern_install/lib/libtarget.a(hal_mips_arch3000_hal_misc.o)    0x8090bc5c    cyg_hal_clock_period
 .scommon   0x8090bc60    0x4 /home/zhigang/0808/pattern_install/lib/libtarget.a(hal_mips_sphe1001_plf_misc.o)    0x8090bc60    regs0 .scommon   0x8090bc64    0x4 /home/zhigang/0808/pattern_install/lib/libtarget.a(hal_common_hal_misc.o)
    0x8090bc64    _cyg_hal_compiler_dummy
 
Here is the definition of the variable:
 
   typedef unsigned int cyg_handle_t;
   cyg_handle_t piofree_handle;
 
The fragment of the objfile containing the varible is here(generate by gas):
 

    $LFE47:    .size   ide_disk_set_config, .-ide_disk_set_config
    .comm   ide_disk_channel_0_disk_info,460,4
    .comm   piofree_intr,28,4   
.comm   piofree_handle,4,4    (the alignment is right)
    .comm   flag_int_reason,8,4(the alignment is right)
Here is the fragment of the ld script:
    __bss_start = .; 
    _fbss = .; 
    .sbss ALIGN (0x8) : { . = .; *(.dynsbss) *(.sbss) *(.sbss.*) *(.scommon) } > ram    .bss ALIGN (0x8) : { *(.dynbss) *(.bss) *(.bss.*) *(COMMON) } > ram __bss_end = .;
  As the input  files are too big , I don't attach them here. If somebody want to get them please let me know .I will send you all the input files(objfile), and you could re generate the bug.
 
  When i build it with gcc-3.4.4 and binutils-2.16.1, there are no any error. So I really can't determine it's a compiler bug or binutils's. Counld anybody give me some glue. 
 
 
___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Re: ld relocate symbols(in small common section) to a unaligned address.(on mips r3000 target)

2005-09-07 Thread Nick Clifton

Hi Zhigang,


/home/zhigang/0808/pattern_install/lib/extras.o
0x8090bc4d
piofree_handle  --Please see here, the 
address is not correct aligned



.comm   piofree_handle,4,4(the alignment is right)


This does indeed appear to be a bug in the linker.  Are you able to 
create a *small* test case which reproduces this problem ?  With that we 
could investigate it and try to fix it.


Oh - one other thing you could try is to download the current binutils 
sources from the mainline of the CVS repository and build a new linker. 
 Several rather subtle and nasty linker bugs have been fixed recently 
and your problem might be one of those fixed bugs.


Cheers
  Nick




___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Re: ld relocate symbols(in small common section) to a unaligned address.(on mips r3000 target)

2005-09-07 Thread zhigang gong
Hi Nick,

 Tanks for you reply so soonly. I had already download the
latest snapshot(binutils-050907), and the problem has not resolve
yet.I try to make the case smaller, but i failed. As when I make some
modification ,the problem will not exist any more. I have to send you
a little big test case(less than 1Mbytes tarball). Really appreciate
for your kindly help.

Here is the readme file of the test case tarball, which you will find
in it also.

LD version 2.16.1 or binutils-050907, configuration is
./configure --target=mipsel-elf

Now invoke the make in the current directory. There will generat three files.
symbol.list
 This file is the libextras.a's  symbol list,and you
can search "piofree_handle" in it.
 You will find the follow statements:
 86: 000428 OBJECT  GLOBAL
DEFAULT  COM piofree_intr
 87: 0004 4 OBJECT  GLOBAL
DEFAULT  COM piofree_handle
 88:  0 NOTYPE  GLOBAL
DEFAULT  UND cyg_interrupt_create
 It's clearly that the aligment of piofree_handle is 4
bytes aligned.

thread_gdb
 This file is the output elf image(excecuable).


thread_gdb.map
 This file is the output elf image's map file, and you
can search "piofree_handle"  too.
 You will get the follow statements:
 .scommon   0x8090bc44
   0x9 thread_gdb.o
 0x8090bc44worker_cv
 0x8090bc4c   
worker_state
 .scommon   0x8090bc4d
   0xc extras.o
 0x8090bc4d   
piofree_handle
 0x8090bc51   
flag_int_reason
 *fill* 0x8090bc59
   0x3 00
 Now you will find the problem is that the
piofree_handle is misaligned.When excute the image in my
 platform, there will raise unaligned access exception.

Best Regars,
Zhigang.

On 9/7/05, Nick Clifton <[EMAIL PROTECTED]> wrote:
> Hi Zhigang,
> 
> > /home/zhigang/0808/pattern_install/lib/extras.o
> > 0x8090bc4d
> > piofree_handle  --Please see here, the 
> > address is not correct aligned
> 
> > .comm   piofree_handle,4,4(the alignment is right)
> 
> This does indeed appear to be a bug in the linker.  Are you able to 
> create a *small* test case which reproduces this problem ?  With that we 
> could investigate it and try to fix it.
> 
> Oh - one other thing you could try is to download the current binutils 
> sources from the mainline of the CVS repository and build a new linker. 
>   Several rather subtle and nasty linker bugs have been fixed recently 
> and your problem might be one of those fixed bugs.
> 
> Cheers
>Nick
> 
> 
>


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils