http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48783
Summary: ARM: kernel compiled at -O2 has a unused reference to __aeabi_uldivmod Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: michael.h...@linaro.org Created attachment 24107 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24107 Preprocessed source When compiled, the attached code refers to the 64 bit unsigned divmod helper function '__aeabi_uldivmod' even though the function is never called. This causes a link error when cross-compiling an ARM Linux 2.6.38 kernel. To reproduce: * Make a arm-linux-gnueabi cross compiler configured with --with-mode=thumb --with-arch=armv7-a --with-tune=cortex-a9 --with-float=softfp --with-fpu=neon * Compile the attached code with 'arm-linux-gnueabi-gcc -O2 -S wm8974.i' * See a '.global __aeabi_uldivmod' in the header of wm8974_set_dai_pll Marking pll_factors() as noinline or putting asm("" : "+r"(source)); before the call to do_div() works around the problem.