Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Aug 2004 11:14:51 +1000
From:      Tim Robbins <tjr@freebsd.org>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        FreeBSD Current List <current@freebsd.org>
Subject:   Re: Other unit-at-a-time issues (Re: HEADS UP! boot2 problems)
Message-ID:  <20040807011451.GA51119@cat.robbins.dropbear.id.au>
In-Reply-To: <200408062059.i76KxTBW026143@apollo.backplane.com>
References:  <4109B4EF.605@samsco.org> <20040730152119.GA43119@freefall.freebsd.org> <200408062059.i76KxTBW026143@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 06, 2004 at 01:59:29PM -0700, Matthew Dillon wrote:
>     I tracked down one problem with the unit-at-a-time code.... it's not
>     compatible with -mrtd.  Bad code is produced, specifically a missing
>     pop in a call.
> 
>     After removing -mrtd the DFly boot code progressed a bit farther before
>     crashing, but unfortunately it still crashed.  -fno-unit-at-a-time is 
>     still required to produce a good 'boot2' boot block even when -mrtd is
>     removed.
> 
>     I was able to determine that the issue is solely with boot2... the
>     /boot/loader built with the (default) unit-at-a-time feature appear
>     to work just fine.
> 
>     I have not tracked down the additional bad assembly being produced,
>     but it is not an impossible task.  The boot2 objdump is not
>     actually all that big, but the functions are reordered and I didn't
>     want to spend all day tracking down the remaining bugs.
> 
>     --
> 
>     I would appreciate it if someone in FreeBSD land would submit this bug
>     to the GCC folks.

Bad things happen if unit-at-a-time optimization causes memcpy() to use a
non-standard calling convention, since gcc -Os generates calls to memcpy()
for struct assignments (I believe there is only one of these in boot2, in
fsread()). Try making memcpy() non-static, using __attribute__((__used__)),
or __attribute__((__stdcall__)) (assuming you re-enable -mrtd). Any of these
will thwart the calling convention change.


Tim



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