AVR target uses the GAS gs() operator' On smaller devices it simply provides a word address. On large devices >64K words such as -mmcu=avr6 it creates trampoline jump table entry and return its location. This allows 16bit addressing to access 24bit space of large memory devices.
However, the gs() cannot be used within another operator - for example ldi r24,lo8(2+gs(test_func)) will give: test.s:44: Error: `)' required test.s:44: Error: garbage at end of line This currently (4.5 head) prevent avr-gcc using any simple pointer arithmetic. Depening on code and optimization, gcc may create constant or evaluated expression for pointers manipulations such as void (* x) (void); x = test_func; x= x + 2; which may be optimized into x = (test_func+2); which can be passed to gas as gs(test_func+2) or gs(test_func) with +2 done by assembler instructions However, there are two problems: First is that gs() returns word address - thus it should be gs(test_func+4). I can hack avr-gcc backend to take care of this and then at least pointer arithmetic work for smaller devices. The second unsolvable problem applies to large devices -mmcu=avr6 where trampolines are created by gs(). The above example will create trampoline entries to jump to(test_func+2) or (test_func) depending on optimization level. What we really need is to always create trampoline entry for test_func and then add 2. eg ldi r24,lo8(2+gs(test_func)) avr-gcc can be modified to create this format - unfortunately gas wont take it - preventing any pointer arithmetic from being used on avr6 device type. -- Summary: AVR gs() operator cant be used in simple expressions Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: gas AssignedTo: unassigned at sources dot redhat dot com ReportedBy: hutchinsonandy at gcc dot gnu dot org CC: bug-binutils at gnu dot org GCC target triplet: avr-*-* http://sourceware.org/bugzilla/show_bug.cgi?id=11102 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils