undefined reference to `memset'

Vinod Kashyap vkashyap at amcc.com
Thu Mar 24 12:47:41 PST 2005


Ok, make sure you have 'device twa' in your kernel configuration
file, and apply these patches to /sys/dev/twa/twa.c.


This patch causes the problem:

--- twa.c.org	Wed Mar 23 11:13:49 2005
+++ twa.c	Thu Mar 24 12:42:23 2005
@@ -366,9 +366,12 @@
 	int8_t		fw_flashed = FALSE;
 	int8_t		fw_flash_failed = FALSE;
 #endif /* TWA_FLASH_FIRMWARE */
+	int8_t		tw_expt[100] = {0};
+	int8_t		*tw_expt_ptr;
 
 	twa_dbg_dprint_enter(3, sc);
 
+	tw_expt_ptr = &(tw_expt[0]);
 	/* Wait for the controller to become ready. */
 	if (twa_wait_status(sc, TWA_STATUS_MICROCONTROLLER_READY,
 					TWA_REQUEST_TIMEOUT_PERIOD)) {



This patch does not cause the problem:

--- twa.c.org	Wed Mar 23 11:13:49 2005
+++ twa.c	Thu Mar 24 12:36:10 2005
@@ -366,9 +366,13 @@
 	int8_t		fw_flashed = FALSE;
 	int8_t		fw_flash_failed = FALSE;
 #endif /* TWA_FLASH_FIRMWARE */
+	int8_t		tw_expt[100]/* = {0}*/;
+	int8_t		*tw_expt_ptr;
 
 	twa_dbg_dprint_enter(3, sc);
 
+	memset(tw_expt, 0, 100);
+	tw_expt_ptr = &(tw_expt[0]);
 	/* Wait for the controller to become ready. */
 	if (twa_wait_status(sc, TWA_STATUS_MICROCONTROLLER_READY,
 					TWA_REQUEST_TIMEOUT_PERIOD)) {


> -----Original Message-----
> From: David O'Brien [mailto:obrien at FreeBSD.ORG]
> Sent: Thursday, March 24, 2005 12:21 PM
> To: Vinod Kashyap
> Cc: freebsd-amd64 at freebsd.org
> Subject: Re: undefined reference to `memset'
> 
> 
> On Thu, Mar 24, 2005 at 06:05:17PM +1100, Peter Jeremy wrote:
> > On Wed, 2005-Mar-23 13:48:04 -0800, Vinod Kashyap wrote:
> > >If any kernel module has the following, or a similar line in it:
> > >-----
> > >char x[100] = {0};
> > >-----
> > >building of the GENERIC kernel on FreeBSD 5 -STABLE for amd64
> > >as of 03/19/05, fails with the following message at the 
> time of linking:
> > >"undefined reference to `memset'".
> > >
> > >The same problem is not seen on i386.
> > >
> > >The problem goes away if the above line is changed to:
> > >-----
> > >char x[100];
> > >memset(x, 0, 100);
> > >-----
> > 
> > Can you post a complete (compilable) example please.
> 
> Vinod can you please post a complete compilable example?
> It is impossible to get anything done about your issue without stand
> alone test code.
> 
> -- 
> -- David    (obrien at FreeBSD.org)
> 




More information about the freebsd-amd64 mailing list