Buserror when built on FreeBSD 10, not on FreeBSD 8

Pieter de Goeje pieter at degoeje.nl
Fri Feb 6 13:52:27 UTC 2015


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




More information about the freebsd-stable mailing list