bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/20789] New: [avr] Relaxation does not correctly adjust DIFF relo


From: saaadhu at sourceware dot org
Subject: [Bug ld/20789] New: [avr] Relaxation does not correctly adjust DIFF reloc with negative value
Date: Mon, 07 Nov 2016 12:22:31 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20789

            Bug ID: 20789
           Summary: [avr] Relaxation does not correctly adjust DIFF reloc
                    with negative value
           Product: binutils
           Version: 2.28 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: saaadhu at sourceware dot org
  Target Milestone: ---

Addend adjustment for DIFF relocs does not occur if the difference expression
is negative. As seen below, the difference is set correctly to -4 at assembly
time. At link time, relaxation resizes the JMP to RJMP, but the difference in
the linked ELF still stays at -4.

$ cat test.s
.L1:
         JMP .L1
.L2:
.section .rodata.b,"a",@progbits
b:
  .word .L1-(.L2)
$ avr-as test.s -o test.o -mmcu=avr51 -mlink-relax
$ avr-objdump -s test.o

test.o:     file format elf32-avr

Contents of section .text:
 0000 0c940000                             ....            
Contents of section .rodata.b:
 0000 fcff                                 ..              
$ avr-ld test.o -mavr51 --relax
$ avr-objdump -s a.out

a.out:     file format elf32-avr

Contents of section .text:
 0000 ffcf                                 ..              
Contents of section .data:
 800100 fcff                                 ..              

Swapping the operands in the label difference (making the expression value
positive) works.

$ cat test.s
.L1:
         JMP .L1
.L2:
.section .rodata.b,"a",@progbits
b:
  .word .L2-(.L1)
                       ..              
$ avr-as test.s -o test.o -mmcu=avr51 -mlink-relax
$ avr-objdump -s test.o

test.o:     file format elf32-avr

Contents of section .text:
 0000 0c940000                             ....            
Contents of section .rodata.b:
 0000 0400                                 ..              
$ avr-ld test.o -mavr51 --relax
$ avr-objdump -s a.out

a.out:     file format elf32-avr

Contents of section .text:
 0000 ffcf                                 ..              
Contents of section .data:
 800100 0200                                 ..

-- 
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]