From peter@yahoo-inc.com  Wed Jul 12 20:03:29 2000
Return-Path: <peter@yahoo-inc.com>
Received: from mrout1.yahoo.com (mrout1.yahoo.com [208.48.125.95])
	by hub.freebsd.org (Postfix) with ESMTP id C536B37C0B5
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Jul 2000 20:03:28 -0700 (PDT)
	(envelope-from peter@yahoo-inc.com)
Received: from yahoo-inc.com (daintree.yahoo.com [205.216.162.172])
	by mrout1.yahoo.com (8.10.0/8.10.0/y.out) with ESMTP id e6D33M495290
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Jul 2000 20:03:22 -0700 (PDT)
Received: (from peter@localhost)
	by yahoo-inc.com (8.9.3/8.9.3) id UAA17171;
	Wed, 12 Jul 2000 20:03:22 -0700 (PDT)
	(envelope-from peter)
Message-Id: <200007130303.UAA17171@yahoo-inc.com>
Date: Wed, 12 Jul 2000 20:03:22 -0700 (PDT)
From: peter@yahoo-inc.com
Reply-To: peter@yahoo-inc.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: ld does not detect all undefined symbols!
X-Send-Pr-Version: 3.2

>Number:         19882
>Category:       gnu
>Synopsis:       ld does not detect all undefined symbols!
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    obrien
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 12 20:10:01 PDT 2000
>Closed-Date:    
>Last-Modified:  Sun Sep 12 02:12:49 GMT 2004
>Originator:     Peter Wemm
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Not
>Environment:

	Any post 3.0-RELEASE system with a recent binutils.

>Description:

	Certain gas-generated external references to undefined symbols
	are not noticed by ld.  For example:

	andl    $~AST_RESCHED,_astpending

	If AST_RESCHED is undefined (remove the #include <machine/ipl.h>
	in i386/i386/swtch.s to cause this), then the kernel ends up with:

	$ nm kernel | grep AST_
		 U AST_RESCHED


>How-To-Repeat:

	Remove #include <machine/ipl.h> from i386/i386/swtch.s, build a
	kernel.  It will compile and end up with an undefined symbol.
	This was an actual problem in RELENG_4 from May 16th through
	July 12th.  ld(8) did not mention it.  The new binutils has
	a --no-undefined flag, but even that does not detect the undefined
	symbol.

>Fix:

	Unknown.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->obrien 
Responsible-Changed-By: peter 
Responsible-Changed-When: Wed Jul 12 20:23:16 PDT 2000 
Responsible-Changed-Why:  
Bintuils related 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19882 

From: Alexey Neyman <alex.neyman@auriga.ru>
To: freebsd-gnats-submit@FreeBSD.org, peter@yahoo-inc.com
Cc: kan@freebsd.org
Subject: Re: gnu/19882: ld does not detect all undefined symbols!
Date: Fri, 20 Jun 2003 10:15:13 +0400

 [I've CC'ed kan@ as he's also working on GCC/binutils]
 
 I just tried to reproduce it. As the suggested how-to-repeat procedure
 is no longer available, I tried to #undef out PAGE_MASK in i386/locore.s.
 While the kernel failed to build, the error message is somewhat
 confusing:
 
 linking kernel.debug
 ld: locore.o: bad symbol index: 1190440
 locore.o: could not read symbols: File format not recognized
 *** Error code 1
 
 bash-2.05b$ nm /usr/obj/usr/src/sys/V2/locore.o | grep PAGE_MASK
          U PAGE_MASK
 bash-2.05b$
 
 Without this #undef, the kernel builds just fine:
 
 linking kernel.debug
    text    data     bss     dec     hex filename
 2863749  310081  422996 3596826  36e21a kernel.debug
 objcopy --strip-debug kernel.debug kernel
 
 Could the behavior described by the originator happen if the [seemingly]
 junk in symbol index in locore.s has some more meaningful value?
 
 Regards,
 Alexey.
>Unformatted:
