bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/13899] New: [avr]: Wrong relaxation of R_AVR_16_PM with gs()


From: gjl at gcc dot gnu.org
Subject: [Bug ld/13899] New: [avr]: Wrong relaxation of R_AVR_16_PM with gs()
Date: Sat, 24 Mar 2012 05:24:24 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=13899

             Bug #: 13899
           Summary: [avr]: Wrong relaxation of R_AVR_16_PM with gs()
           Product: binutils
           Version: 2.23 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden
                CC: address@hidden
    Classification: Unclassified
            Target: avr


Created attachment 6301
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6301
bug-relax.zip: Files to reproduce

The linker computes wrong values for gs() initializers like from text.s:

.global    menuitem_text
    .section    .progmem.data,"a",@progbits
    .type    menuitem_text, @object
    .size    menuitem_text, 14
menuitem_text:
    .word    gs(onPixel_text)
    .word    gs(onRedraw_text)
    .word    gs(onKey_text)
    .word    gs(onEnter_text)

I tried to work out a small example, but with no avail.
So I post the whole project.

Steps to reproduce:

1) Unpack the attached zip file. It inflates to ./bug-relax/

2) cd ./bug-relax

3) There are assembler sources in the directory and a small Makefile. Run
   make obj all

4) This generates two files bug.elf and bug.lst
   bug.lst is diff'ed against good.lst generated with avr-ld 2.21

All in all, the "make obj all" will print something like

avr-as -mmcu=atmega168 frac8.ss -o frac8-asm.o
avr-as -mmcu=atmega168 parith-16.ss -o parith-16-asm.o
...
avr-ld -m avr5 -Tdata 0x800100 crtm168.o -v -o bug.elf --relax ...
GNU ld (GNU Binutils) 2.22.52.20120322

diff -u1 good.lst bug.lst

-good.elf:     file format elf32-avr
+bug.elf:     file format elf32-avr

@@ -81,3 +81,3 @@
 0000008e <menuitem_text>:
-      8e:    78 06 23 06 af 05 18 06 19 01 28 04 4f 01
+      8e:    7c 06 24 06 af 05 18 06 19 01 28 04 4f 01

@@ -163,3 +163,3 @@
 00000299 <menuitem_asteroids>:
-     299:    61 0c 6a 0d 1a 0b de 0a 8f 02 08 02 e8 02
+     299:    70 0c 7f 0d 1b 0b de 0a 8f 02 08 02 e8 02

@@ -217,3 +217,3 @@
 000003ae <menuitem_snake>:
-     3ae:    92 11 7d 10 24 0f 58 0f 6d 03 52 02 bc 03
+     3ae:    92 11 7f 10 24 0f 58 0f 6d 03 52 02 bc 03

@@ -263,3 +263,3 @@
 00000491 <menuitem_schoner>:
-     491:    9a 14 e3 13 18 14 09 14 02 01 00 08 9f 04
+     491:    9b 14 e3 13 18 14 09 14 02 01 00 08 9f 04


In text.s: menuitem_text the first enty is
   .word    gs(onPixel_text)

This function is located at word address 0x0678:
   00000cf0 <onPixel_text>

But bug.lst has 0x67c as printed in the diff above.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

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