2011/4/27 Takashi Iwai tiwai@suse.de:
At Wed, 27 Apr 2011 16:24:44 +0800, Barry Song wrote:
2011/4/27 Takashi Iwai tiwai@suse.de:
At Wed, 27 Apr 2011 00:27:32 -0700, Barry Song wrote:
From: Barry Song 21cnbao@gmail.com
The newest compiliers can optimize pll calculation in several codecs into __aeabi__uldivmod which doesn't exist in kernel. Then the link will fail: ERROR: "__aeabi_uldivmod" [sound/soc/codecs/snd-soc-wm8974.ko] undefined! ERROR: "__aeabi_uldivmod" [sound/soc/codecs/snd-soc-wm8940.ko] undefined! ERROR: "__aeabi_uldivmod" [sound/soc/codecs/snd-soc-wm8510.ko] undefined! This patch prevent the optimizaton by insert ASM.
Don't do this in the low driver level. If any, we should fix do_div() instead.
do_div is just a macro, it has no problem by itself.
It has a problem by itself because it's a macro with a side-effect :)
Could we put an asm to do_div() itself? The asm statement can be defined depending on the compiler version.
only while working together with other more codes before do_div, gcc can make some codes merging and cause problems.
if do_div is a function, we'd just fix it.
Better to ask this in LKML, then.
I must have been delaying a little from gcc. Michael Hope has thought it as a gcc bug on 26 April,2011at:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48783
Marking pll_factors() as noinline or putting asm("" : "+r"(source)); before the call to do_div() works around the problem.
thanks,
Takashi