From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mimir.eigenstate.org ([206.124.132.107]) by ewsd; Tue May 12 11:09:13 EDT 2020 Received: from abbatoir.fios-router.home (pool-162-83-132-245.nycmny.fios.verizon.net [162.83.132.245]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id ce4029b2 (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO); Tue, 12 May 2020 08:08:57 -0700 (PDT) Message-ID: <4B65C95D9EB2FB2BF18754CBF0C978B7@eigenstate.org> To: qwx@sciops.net, 9front@9front.org Subject: Re: [9front] 5l breakage on zynq Date: Tue, 12 May 2020 08:08:56 -0700 From: ori@eigenstate.org In-Reply-To: <8F1A64ADC8E4F80F6A3D24542B087636@wopr.sciops.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: content-addressed generic method HTML polling full-stack locator > > ; hg revert -r 7667 /sys/src/cmd/^(5a 5c 5l cc 6c 6a 6l) > > ... and rebuilding compilers/loaders and libc/libbio. > > Any idea what broke? > > Thanks, > Yeah -- I think I see it: 1106 s = (Sym*)hunk; 1107 nhunk -= sizeof(Sym); 1108 hunk += sizeof(Sym); 1109 >1110 s->name = malloc(l); This assumes that hunk is aligned, but the change to malloc in the commit you flagged may leave it unaligned: void* alloc(long n) { void *p; while((uintptr)hunk & 7) { hunk++; nhunk--; } while(nhunk < n) gethunk(); p = hunk; nhunk -= n; hunk += n; return p; } Here, we always align the hunk on entry, but we ma leave hunk unaligned on exit, if n is not a multiple of 8. Then, when it's used directly, 's' is misaligned. Try this patch, which aligns 'n' to a multiple of 8 before we allocate: diff -r 965e0f59464d sys/src/cmd/cc/compat --- a/sys/src/cmd/cc/compat Sun May 10 22:51:40 2020 +0200 +++ b/sys/src/cmd/cc/compat Tue May 12 08:02:58 2020 -0700 @@ -107,6 +107,7 @@ { void *p; + n = (n + 7) & (~7); while((uintptr)hunk & 7) { hunk++; nhunk--;