https://sourceware.org/bugzilla/show_bug.cgi?id=25861
--- Comment #3 from jcmvbkbc at gcc dot gnu.org --- It occurs because our treatment of XTENSA_DIFF16 relocation is inconsistent. Assembler is free to use this relocation with both positive and negative values up to 16 bit wide, linker always treats is as signed 16-bit value, i.e. it only has 15 bits of value. In the failing build the assembler has .loc directive that updates current address from 0 to 0x8bb7. It writes positive value 0x8bb7 there, linker treats it as 0xffffffffffff8bb7, then it adds this value to the subtracted symbol address (which is 0) and uses 0xffffffffffff8bb7 as an address of the diminished symbol. There's no check that the address is within the section limits (that would have stopped it right there), so it proceeds with relaxation adjustment, and finds where this address moves after relaxation. Relaxation removes more than 32K from the section, so relaxed address is 0xfffffffffffe714b, which doesn't fit into 16 bits, that's where build error is reported. In reality the address 0x8bb7 was turned to 0x1db, which is perfectly fine. So XTENSA_DIFF relocations don't supply enough information to deal with both unsigned and signed 16-bit values. Proposed fix is to deprecate XTENSA_DIFF signed relocations and not generate them any more in the assembler. Instead introduce XTENSA_PDIFF relocations for positive differences (subtracted symbol precedes diminished symbol) and XTENSA_NDIFF for negative differences (subtracted symbol follows diminished symbol). The difference value itself is treated as unsigned in both cases. The linker will continue to support XTENSA_DIFF as it did before and in addition will support XTENSA_PDIFF and XTENSA_NDIFF with new semantic. -- You are receiving this mail because: You are on the CC list for the bug.