[Top][All Lists]

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

[Bug ld/2378] New: Incorrect opcode in __do_clear_bss if bss has more th

From: KenJackson at ieee dot org
Subject: [Bug ld/2378] New: Incorrect opcode in __do_clear_bss if bss has more than 15 bytes
Date: 21 Feb 2006 21:11:57 -0000

Sixteen or more bytes of uninitialized data will cause ld to generate an
incorrect opcode in __do_clear_bss in the startup for the avr target as
shown in this example.

Source file, a.S:
        .comm x,16,1
        .global __do_copy_data
        .global __do_clear_bss
        .global main
        cpi  r26,lo8(16)
        rjmp main

Compile script:
    FLAGS="-m avr4 -Tdata 0x800100 -L/usr/local/lib/gcc/avr/4.0.2/avr4"
    avr-as a.S -o a.o
    avr-ld $FLAGS -o a.hex /usr/local/avr/lib/avr4/crtm88.o --oformat=ihex \
        a.o  -lgcc -lc
    avr-ld $FLAGS -o a.elf /usr/local/avr/lib/avr4/crtm88.o  a.o  -lgcc -lc
    avr-objdump -dSCg a.elf > a.lst

Output a.lst, lines 68,69,77,78:
    00000060 <.do_clear_bss_start>:
      60:   a0 31           cpi r26, 0x10   ; 16
    0000006a <main>:
      6a:   a0 31           cpi r26, 0x10   ; 16

Output a.hex, lines 8,11:

The listing is correct for both cpi instructions, "a0 31", but the hex
file is wrong for the first, "B031", though it's correct for the second,
"A031".  And, indeed, test programs fail to execute on real hardware with
16 or more bytes of BSS, but _do_ execute with less.

The first cpi instruction is in function __do_clear_bss in source file
gcc-4.0.2/gcc/config/avr/libgcc.S.  But gcc itself doesn't seem be be
involved, other than supplying the code, which is assembled by avr-as (or
directly by avr-ld?).  It's not clear how the hex is generated or where 
the error occurs.

I'm using Mandriva Linux 2006 (2.6.12-12mdk) and compiled from source
binutils-2.16.1, gcc-4.0.2, and avr-libc-1.4.3.

$ avr-ld -V
GNU ld version 2.16.1
  Supported emulations:

Note: I thank everyone that works on binutils.

           Summary: Incorrect opcode in __do_clear_bss if bss has more than
                    15 bytes
           Product: binutils
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: KenJackson at ieee dot org
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: avr


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

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