From owner-freebsd-toolchain@FreeBSD.ORG Sun Feb 20 04:11:07 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 7206D1065675; Sun, 20 Feb 2011 04:11:07 +0000 (UTC) Date: Sun, 20 Feb 2011 04:11:07 +0000 From: Alexander Best To: Roman Divacky Message-ID: <20110220041107.GA80143@freebsd.org> References: <20110219010136.GA92824@freebsd.org> <20110219115112.GA65227@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110219115112.GA65227@freebsd.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: [RFC] code changes/removal in boot2.c and ufsread.c so clang can compile boot2 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Feb 2011 04:11:07 -0000 On Sat Feb 19 11, Roman Divacky wrote: > On Sat, Feb 19, 2011 at 01:01:36AM +0000, 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. > > no, just copying it to /boot is not enough. you have to run bsdlabel -B to > actually install it > > > the patchset (against a recent HEAD) can be found here: > > http://people.freebsd.org/~arundel/patches/boot2.c.diff2 > > the patch is wrong - you cant remove a.out support as "loader" still uses that > > I like the int -> unsigned parts of the patch and also the memsize() removal > may be interesting. here's an updated patchset: http://people.freebsd.org/~arundel/patches/boot2.c.diff3 maybe we could somehow get rid of the last printf() in ufsread.c: while ((n = fsread(*ino, buf, DEV_BSIZE)) > 0) for (s = buf; s < buf + DEV_BSIZE;) { d = (void *)s; if (ls) printf("%s ", d->d_name); else if (!strcmp(name, d->d_name)) { *ino = d->d_ino; return d->d_type; } s += d->d_reclen; } if (n != -1 && ls) printf("\n"); return 0; this would us gain another 26 bytes. cheers. alex > > roman -- a13x