sys/x86/isa/clock.c:189: undefined reference to `cyclic_clock_func'

J. Hellenthal jhell at DataIX.net
Tue Mar 8 15:19:53 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On Tue, 8 Mar 2011 04:18, jhell@ wrote:
> On Tue, 8 Mar 2011 03:29, jhell@ wrote:
>> 
>> Hello Stable@,
>> 
>> Compiling a kernel on stable/8 with DTrace support is failing with the 
>> above
>> subject line upon linking kernel.debug.
>> 
>> The text leading up to this is:
>> ...
>> ctfconvert -L VERSION -g vers.o
>> linking kernel.debug
>> clock.o(.text+0x84c): In function `clkintr':
>> /usr/src/sys/x86/isa/clock.c:189: undefined reference to 
>> `cyclic_clock_func'
>> 
>> And upon inspection of clock.c:
>> #ifdef KDTRACE_HOOKS
>> #include <sys/dtrace_bsd.h>
>> #endif
>> 
>> And in clkintr():
>> #ifdef KDTRACE_HOOKS
>>        /*
>>         * If the DTrace hooks are configured and a callback function
>>         * has been registered, then call it to process the high speed
>>         * timers.
>>         */
>>        int cpu = PCPU_GET(cpuid);
>>        if (cyclic_clock_func[cpu] != NULL)
>>                (*cyclic_clock_func[cpu])(frame);
>> #endif
>> 
>> 
>> It seems for some odd reason that <sys/dtrace_bsd.h> is being forgotten 
>> when
>> it comes time for linking ? What is going on here ?
>> 
>> Id like to just remove the ifdef's for KDTRACE_HOOKS just to get the build 
>> to
>> finish but in the case that I want to build another kernel without dtrace I
>> would have to add them back. Anyone have a better fitting solution to this 
>> ?
>> 
>> Would it be just as good to re-ifdef this to ?WITH_CTF? instead.
>> 
>> Anyway... this is latest code from stable/8 on i386. And yes options
>> KDTRACE_HOOKS is in the kernel config.
>> 
>> And the command that caused all this:
>> ( make kernel WITH_CTF=1 )
>> 
>
> In light of this I decided to just remove the effected section of clock.c
> and move forward as this part of the kernel with DTrace is not what I am
> looking into.
>
> Attached is a small patch that removes it in case someone else comes
> across the same thing and needs a quick workaround.
>

To my best belief the cause is this i386 build is being done without 
"device apic" that includes I/O APIC (local_apic.c) which defines in a 
ifdef KDTRACE_HOOKS ( cyclic_clock_func_t cyclic_clock_func[MAXCPU]; ). 
Since the lack of I/O APIC being used, sys/x86/isa/clock.c needs its own 
definition of the same cyclic_clock_func, so I have added this in the same 
way that its implemented in local_apic.c to clock.c and the build succeeds 
and is usable.

Would it be best to just move cyclic_clock_func definition to dtrace_bsd.h 
instead ? and remove the definition in local_apic.c ?

Additional references: ( Thanks to rwatson@ )
http://fxr.watson.org/fxr/ident?v=FREEBSD8&i=cyclic_clock_func

Attached is the patch that solved this here but its just adding another 
definition that could probably be avoided by adding it somewhere else.

- -- 

  Regards,

  J. Hellenthal
  (0x89D8547E)
  JJH48-ARIN

-----BEGIN PGP SIGNATURE-----
Comment: THIS SOFTWARE AND/OR CONTENTS IS PROVIDED BY THE AUTHOR ``AS IS'' AND
Comment: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Comment: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
Comment: PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
Comment: DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Comment: DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Comment: OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Comment: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
Comment: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
Comment: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Comment: POSSIBILITY OF SUCH DAMAGE.

iQEcBAEBAgAGBQJNdkkMAAoJEJBXh4mJ2FR+8j4H/3qcymOBXvbMj2fqILJA/2xx
Xj+Og+INWT+3NAM95Ljeq375lLeV0h3FzXUKrHB+z/bQlY8NYdBdZHOtEUWl1ZvV
5W5RGAncSJq1cBU+EMOoGprvmwWaNIYIHJUUHSpSrJbhwdW53unP285ts4bqvk0I
eirtOitgmaiyOzBpJAIfDBBWU7RgQWCc/IFsm6GAU90JmjATy65kEeBtba6fNVcV
SlHqu5OmtuVN6eHEq/rf3Ai8jGktwvuS9Flgf4rM+u/tZTA1nC9cfo97Rbtek9TH
lQ/yZe9U7Wz4OFSdidMoY1nJN3CYisp3Kq+gqabsd3XDkJQQiXcBIIh61hnnjog=
=tC6l
-----END PGP SIGNATURE-----
-------------- next part --------------
changeset:   952:5eb7de8dcdc0
branch:      DataIX
tag:         tip
user:        J. Hellenthal <jhell at DataIX.net>
date:        Tue Mar 08 08:20:28 2011 -0500
summary:     cyclic_clock_func_t cyclic_clock_func[MAXCPU]; definition.

diff -r e1c8a20eb4b2 -r 5eb7de8dcdc0 sys/x86/isa/clock.c
--- a/sys/x86/isa/clock.c	Tue Mar 08 08:16:59 2011 -0500
+++ b/sys/x86/isa/clock.c	Tue Mar 08 08:20:28 2011 -0500
@@ -82,6 +82,7 @@
 
 #ifdef KDTRACE_HOOKS
 #include <sys/dtrace_bsd.h>
+cyclic_clock_func_t	cyclic_clock_func[MAXCPU];
 #endif
 
 #define	TIMER_DIV(x) ((i8254_freq + (x) / 2) / (x))



More information about the freebsd-stable mailing list