[RFC] code changes/removal in boot2.c and ufsread.c so clang
can compile boot2
Alexander Best
arundel at freebsd.org
Tue Feb 22 18:30:16 UTC 2011
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
More information about the freebsd-toolchain
mailing list