https://sourceware.org/bugzilla/show_bug.cgi?id=28686
Nick Clifton <nickc at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-12-16 Assignee|unassigned at sourceware dot org |nickc at redhat dot com CC| |nickc at redhat dot com Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 --- Comment #1 from Nick Clifton <nickc at redhat dot com> --- Hi Joerg, The root cause for this problem is the assembler. When it assembles the test file it created a relocation for the LDI instruction which references the .text section: % objdump -dr main.o [...] 4b2: f0 e0 ldi r31, 0x00 ; 0 4b2: R_AVR_HI8_LDI .text+0x500 So when the relaxation happens the code adjusts the relocation eventually ending up with .text+0x2ab which then translates into a value of 2 (the top 8 bits of the addition) for LDI instruction. This error of course is that the relocation should not be against an offset from the .text section, but rather against the matrix symbol itself. Since this symbol stays aligned, it does not move as far back as the .text+offset value. I am currently testing a local patch which stops the assembler from trying to optimize away symbol names in relocations if it knows that linker relaxation is going to occur. With this patch applied the object file looks like: % objdump -dr main.o [...] 4b2: f0 e0 ldi r31, 0x00 ; 0 4b2: R_AVR_HI8_LDI matrix And when finally linked the correct value - 3 - is used by the LDI instruction. -- You are receiving this mail because: You are on the CC list for the bug.