Seems to be the same issue as
https://sourceware.org/bugzilla/show_bug.cgi?id=13402.

On Wed, Oct 27, 2021 at 1:25 AM Karakó Tibor <karako.ti...@freemail.hu>
wrote:

> Hi,
>
> I ran into a weird situation regarding whether I compile and link the
> code in one go or in two phases.
>
> main.c:
>
> int main() {
>      asm("out 0x14, r24");
>          while (1) {
>          asm("out 0x16, r24");
>      }
> }
>
> When I run:
>
> avr-gcc -O main.c -o main_one.hex -mmcu=attiny2313 -Wl,--oformat,ihex
>
> I get a different result compared to:
>
> avr-gcc -O main.c -o main_two.elf -mmcu=attiny2313
> avr-ld -o main_two.elf.hex --oformat ihex main_two.elf
>
> $ avr-objdump -j .sec1 -d -m avr main_two.elf.hex
>
>   38:   fe cf           rjmp    .-4             ;  0x36
>
> It calculates the jump correctly.
>
> But the former one seems to introduce a 2-off bug when calculating the
> rjmps' offset:
>
> $ avr-objdump -j .sec1 -d -m avr main_one.hex
>
>    38:   ff cf           rjmp    .-2             ;  0x38
>
> The same goes for every rjmp.
>
> Is this a legit bug, or I am missing something?
>
>
> gcc-avr(1:5.4.0+Atmel3.6.2-1)
>
> binutils-avr(2.26.20160125+Atmel3.6.2-2)
>
>
> Br,
>
> Tibor
>
>
>

Reply via email to