RE: undefined reference to `memset'

From: Vinod Kashyap (vkashyap_at_amcc.com)
Date: 03/25/05

  • Next message: Graham Menhennitt: "Re: "ffs_mountroot: can't find rootvp" after cvsup and making worldfmen"
    To: obrien@freebsd.org
    Date: Fri, 25 Mar 2005 14:37:19 -0800
    
    
    

    > > Can you not submit it with the patch I sent?
    >
    > Submit the entire /usr/src/sys kernel source??
    >
    > > A "stand alone" foo.c will have to be a new module under a new
    > > directory (/sys/dev/foo), with its own Makefile, with changes to
    > > /sys/conf/files, and an entry in GENERIC.
    >
    > A module would still depend on files in /usr/share/mk,
    > /usr/src/sys/conf,
    > /usr/src/sys/modules, /usr/src/sys/dev/foo.
    >
    > NO! nothing other than a single file -- foo.c in my home
    > directory that
    > shows the problem is a "stand alone" example.

    Here is memset_issue.c (also attached). But note that you cannot
    reproduce the "undefined reference to `memset'" issue with this
    (that's what I have been trying to explain). You could also use
    the earlier posting from Sean McNeil.

    #include <stdio.h>

    main()
    {
            char a[100] = {0};
            char *ap;

            ap = &(a[0]);
            printf("a[0] = %d\n", a[0]);
    }

    With the patch that I sent earlier applied to /sys/dev/twa/twa.c,
    'nm twa.o' shows this when twa is built as a stand alone module:
    00000000000003f0 t memset

    'nm twa.o' shows this when twa is built as part of the kernel:
                     U memset

    And now, moving to the important thing... in kern.pre.mk, I changed
    COPTFLAGS from -O2 to -O for amd64 (just like i386), and the problem
    is gone!!

    
    
    

    _______________________________________________
    freebsd-stable@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-stable
    To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"



  • Next message: Graham Menhennitt: "Re: "ffs_mountroot: can't find rootvp" after cvsup and making worldfmen"