Date: Tue, 22 Feb 2011 18:30:16 +0000 From: Alexander Best <arundel@freebsd.org> To: Warner Losh <imp@bsdimp.com> Cc: freebsd-toolchain@freebsd.org Subject: Re: [RFC] code changes/removal in boot2.c and ufsread.c so clang can compile boot2 Message-ID: <20110222183015.GA37986@freebsd.org> In-Reply-To: <4D63FCC1.4040108@bsdimp.com> References: <20110219010136.GA92824@freebsd.org> <4D63FCC1.4040108@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue Feb 22 11, Warner Losh wrote: > On 02/18/2011 18:01, Alexander Best wrote: > >hi everybody, > > > >r218745 triggered quite a discussion about dead code in boot2.c. i talked > >to > >roman (rdivacky@) and we were trying to improve the situation so that boot2 > >would build with clang 2.8 (base) and the latest development version of > >clang (trunk). a lot of the ideas came from Bruce (bde@). > > > >i'd really appreciate, if somebody could have a look at this patchset. for > >me > >it strips down the boot2 code so clang is able to compile it just fine. > >please > >bear in mind that this has to work with boot2 supporting UFS1 *and* UFS2. > >so > >please be sure not to override BOOT2_UFS in your src.conf or some place > >else. > > > >you should be able to test the (hopefully sucessfully) compiled boot2 > >binary > >by copying it to /boot. please be sure to keep a backup of your existing > >boot2 > >file in case something breaks. > > > >the patchset (against a recent HEAD) can be found here: > >http://people.freebsd.org/~arundel/patches/boot2.c.diff2 > > > >cheers. > >alex > > > > Here's some comments: > > @@ -88,7 +97,7 @@ static ino_t lookup(const char *); > static ssize_t fsread(ino_t, void *, size_t); > > static int ls, dsk_meta; > -static uint32_t fs_off; > +static uint32_t fs_off = 0; > > static __inline int > fsfind(const char *name, ino_t * ino) > @@ -98,7 +107,6 @@ fsfind(const char *name, ino_t * ino) > char *s; > ssize_t n; > > - fs_off = 0; > while ((n = fsread(*ino, buf, DEV_BSIZE))> 0) > for (s = buf; s< buf + DEV_BSIZE;) { > d = (void *)s; > > How does the first part of this diff change things? bss gets the > uninitialized and the data initialized to 0. > > but we also have this later: > > @@ -238,7 +245,6 @@ fsread(ino_t inode, void *buf, size_t nbyte) > > #endif > inomap = inode; > - fs_off = 0; > blkmap = indmap = 0; > } > s = buf; > > > - if (N_GETMAGIC(hdr.ex) == ZMAGIC) > - fmt = 0; > - else if (IS_ELF(hdr.eh)) > + if (IS_ELF(eh)) > fmt = 1; > > > Doesn't this remove a.out support? indeed i removed that part from the newest patch: http://people.freebsd.org/~arundel/patches/boot2.c.diff3 > > Warner -- a13x
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110222183015.GA37986>