Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Mar 1998 15:04:08 -0800
From:      John Polstra <jdp@polstra.com>
To:        ken@plutotech.com
Cc:        dyson@FreeBSD.ORG, current@FreeBSD.ORG
Subject:   Re: problems stripping kernels
Message-ID:  <199803102304.PAA21639@austin.polstra.com>
In-Reply-To: <199803102018.NAA16119@panzer.plutotech.com>
References:  <199803102018.NAA16119@panzer.plutotech.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <199803102018.NAA16119@panzer.plutotech.com>,
Kenneth D. Merry <ken@plutotech.com> wrote:

> 	I've noticed a problem stripping kernels since John's changes on
> Saturday went in.  (and it wasn't fixed by version 1.46 of ufs_readwrite.c
> yesterday)
> 
> 	Basically, I config my kernels with -g, and then use strip -d to
> strip off the debugging symbols (after saving a copy of the kernel with
> debugging symbols, of course).  The problem is that kernels I strip on a
> machine using a kernel built after Saturday's changes don't boot.  They
> just hang forever with the little spinning cursor.  Kernels stripped on the
> same machine running a kernel from before Saturday's changes work just
> fine.

I can confirm this.

> 	From what I can tell, there are three bytes different between the
> two kernels:
> 
> $ ls -la kernel*
> -rwxr-xr-x  1 ken  wheel  1409956 Mar 10 09:50 kernel*
> -rwx------  1 ken  wheel  1409956 Mar 10 09:53 kernel.debug*
> $ cmp -l kernel kernel.debug
>     17 140  20
>     18 266 133
>     19  67   1

Those are in the a.out header in the field that says how many bytes
of symbol table are present.  I noticed that in the failing case,
the header of the stripped kernel still says it has the same number
of bytes of symbols as the header of the unstripped kernel it was
made from.  In other words, this statement at strip.c:241 isn't
taking effect:

        /* Fill in new symbol table size. */
        ep->a_syms = (nsym - symbase) * sizeof(NLIST);

Here, ep points to an image of the file that was mmapped at line 189:

        /* Map the file. */
        if ((ep = (EXEC *)mmap(NULL, (size_t)sb.st_size,
            PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)0)) == (EXEC *)MAP_FAILED) {
--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803102304.PAA21639>