From owner-freebsd-amd64@FreeBSD.ORG Thu Mar 24 05:22:03 2005 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4A8FB16A4CE; Thu, 24 Mar 2005 05:22:03 +0000 (GMT) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0EA3F43D2F; Thu, 24 Mar 2005 05:22:03 +0000 (GMT) (envelope-from peter@wemm.org) Received: from fw.wemm.org (canning.wemm.org [192.203.228.65]) by canning.wemm.org (Postfix) with ESMTP id E41212A8F3; Wed, 23 Mar 2005 21:22:02 -0800 (PST) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (overcee.wemm.org [10.0.0.3]) by fw.wemm.org (Postfix) with ESMTP id BC3C7E2B5; Wed, 23 Mar 2005 21:22:01 -0800 (PST) (envelope-from peter@wemm.org) Received: from overcee.wemm.org (localhost [127.0.0.1]) by overcee.wemm.org (8.13.1/8.13.1) with ESMTP id j2O5M26w019336; Wed, 23 Mar 2005 21:22:02 -0800 (PST) (envelope-from peter@wemm.org) Received: from localhost (localhost [[UNIX: localhost]]) by overcee.wemm.org (8.13.1/8.13.1/Submit) id j2O5M2pg019335; Wed, 23 Mar 2005 21:22:02 -0800 (PST) (envelope-from peter@wemm.org) X-Authentication-Warning: overcee.wemm.org: peter set sender to peter@wemm.org using -f From: Peter Wemm To: freebsd-amd64@freebsd.org Date: Wed, 23 Mar 2005 21:22:01 -0800 User-Agent: KMail/1.7.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200503232122.01937.peter@wemm.org> cc: freebsd-stable@freebsd.org Subject: Re: undefined reference to `memset' X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2005 05:22:03 -0000 On Wednesday 23 March 2005 01:48 pm, 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); > ----- > > Adding CFLAGS+=-fbuiltin, or CFLAGS+=-fno-builtin to > /sys/conf/Makefile.amd64 does not help. > > Anyone knows what's happening? Something fishy is going on. I've tried this on both 5.x and 6.0 and both systems created a bss object called 'x', not something that called memset. For example: peter@fb5-amd64[9:17pm]/home/src/sys/modules/twe-21# nm obj/twe.ko | grep x U busdma_lock_mutex U sysctl_ctx_free U sysctl_ctx_init 0000000000000080 b x peter@fb5-amd64[9:17pm]/home/src/sys/modules/twe-22# nm obj/twe.ko | grep memset peter@fb5-amd64[9:17pm]/home/src/sys/modules/twe-23# I wondered if it might be because of something like -O2 (don't do that) or no -O at all, but I couldn't make it happen even then. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5