On Mon, 11 Feb 2019, Wilco Dijkstra wrote: > > With Gold linker this is handled correctly. So it looks to me like a > > bug in BFD linker, where it ignores any addend (not just +1/-1) when > > resolving a relocation against a Thumb function. > > If the Gold linker doesn't fail that means Gold has a serious bug in the way > it handles Thumb relocations. Can you elaborate, does it do S+A+1 rather than > (S+A) | 1 as the ARM-ELF spec requires?
Apologies - it appears I might have mistyped something, as re-trying my tests shows that both linkers properly implement the required '(S+A) | 1'. I can't reproduce any linker bug I suspected. It seems odd to me that the spec requires '(S+A) | T' instead of the (imho more intuitive) '(S|T) + A', but apart from the missing diagnostic from the linkers, it seems they do as they must and GCC was at fault. (perhaps it's okay to allow addends with low bit zero though, instead of allowing only zero addends as your patch does?) Thanks for clearing this up! Alexander