Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Feb 2015 19:24:13 +0100
From:      Eivind Evensen <eivinde@terraplane.org>
To:        Pieter de Goeje <pieter@degoeje.nl>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Buserror when built on FreeBSD 10, not on FreeBSD 8
Message-ID:  <20150207182413.GA34637@klump.hjerdalen.lokalnett>
In-Reply-To: <54D4C4FC.5000803@degoeje.nl>
References:  <20150205133653.GA16112@klump.hjerdalen.lokalnett> <54D4C4FC.5000803@degoeje.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 06, 2015 at 02:43:24PM +0100, Pieter de Goeje wrote:
> Eivind Evensen schreef op 2015-02-05 om 14:36:
> >Hello.
> >
> >After upgrading from FreeBSD 8 to 10, I have a problem I don't
> >understand, hopefully somebody here knows what is happening.
> >
> >I have a project that uses both assembly and c. I started getting
> >bus errors after building on FreeBSD 10. I had, and may still have
> >some objects around from FreeBSD 8 and if I link those, on 10, they work.
> >I don't have any installations running 8 any longer though.
> >This is on amd64 platform.
> 
> The problem is that the stack is not aligned to 16 bytes. Changing to 
> the code to this:
> 
> asmcode:
>   sub rsp, 8
>   call cagain
>   add rsp, 8
>   ret
> 
> Fixes the problem. It's probably better to just push/pop rbp as that is 
> only one byte per instruction,
> which will also align the stack for obvious reasons.
> 
> I believe that gcc on FreeBSD 8 wasn't as strict as clang is on 10 now.

Thanks, this is very interesting. Apparently my thought that when I didn't
need the stack for anything myself, I shouldn't have to do anything to it
was wrong.

I appreciate the help.

-- 
Eivind



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