On Tue, 12 Nov 2013, Nicolas Pitre wrote: > On Tue, 12 Nov 2013, Måns Rullgård wrote: > > > It might be possible to extract this information from relocation tables. > > True, but only for individual .o files. Once the linker puts them > together the information is lost, and trying to infer what the linker > has done is insane. > > Filtering the compiler output to annotate idiv calls before it is > assembled would probably be a better solution.
Another solution is to patch the call site from within __aeabi_idiv at run time using lr. That wouldn't work in the presence of tail call optimization though. Again this might not be worth it and patching __aeabi_idiv instead might be a good enough compromize. Nicolas