On Thu, Jan 07, 2016 at 10:55:33PM +1300, Dylan McKay wrote: > Hello there, > > I am generating AVR executables with my own compiler, but linking them with > AVR-GCC. > > Here is an example of a C file, which avr-as compiles fine. I made sure to > first use my compiler to generate assembly from this file, and then > assemble this using my compiler and gcc so that they are both using the > same assembly source file. > > void foo();int bar = 2;int abc = 2; > int jmp __attribute__((section(".vectors"))) = 0x940C;void (*ptr)() > __attribute__((section(".vectors"))) = (&foo); > void milan() { }void foo(){}void inter() { } > int qwerty = 2; > > The .vectors section is generated fine. The correct jmp instruction is > placed. Both compilers generate R_AVR_16 relocations for this. > > GCC however generates this (avr-objdump output): > > RELOCATION RECORDS FOR [.vectors]: > OFFSET TYPE VALUE > 00000004 R_AVR_16 .text+0x00000004 > > Note that .text+0x00000004 does point to foo in the object file. > > Whereas my compiler generates this: > > RELOCATION RECORDS FOR [.vectors]: > OFFSET TYPE VALUE > 00000002 R_AVR_16 foo > > The problem is that GCC???s hardcoded section+offset works, but my symbol > does not. avr-ld correctly relocates GCC code to foo in the executable, but > relocates my code to _etext+0x2. > > Am I doing something wrong, or is not just not properly supported? > ???
Hmm, I remember seeing code in gas turning symbol relocs into sectionstart+offset ones. Give me a day to dig that up. Regards Senthil _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list