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

next in thread | previous in thread | raw e-mail | index | archive | help
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.

- Pieter





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