Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around lack of stdalign.h on OpenBSD #294

Closed
briansmith opened this issue Sep 6, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@briansmith
Copy link
Owner

commented Sep 6, 2016

As reported in #287, compilation fails with OpenBSD's GCC 4.8 because it lacks stdalign.h:

--- stderr
In file included from crypto/aes/aes.c:55:0:
crypto/aes/../internal.h:136:22: fatal error: stdalign.h: No such file or directory
 #include <stdalign.h>
                      ^
compilation terminated.
gmake: *** [mk/bottom_of_makefile.mk:37: /home/oherrala/rust/ring/target/debug/build/ring-3175a83ad649b58d/out/obj/crypto/aes/aes.o] Error 1
In file included from crypto/bn/internal.h:135:0,
                 from crypto/bn/add.c:64:
crypto/bn/../internal.h:136:22: fatal error: stdalign.h: No such file or directory
 #include <stdalign.h>
                      ^
gmake: *** Waiting for unfinished jobs....
compilation terminated.

In crypto/internal.h:

#if defined(_MSC_VER)
#pragma warning(push, 3)
#include <intrin.h>
#pragma warning(pop)
#if !defined(__cplusplus)
#define alignas(x) __declspec(align(x))
#define alignof __alignof
#endif
#elif !defined(__clang__) && defined(__GNUC__) && __GNUC__ == 4 && \
      __GNUC_MINOR__ <= 6
#define alignas(x) __attribute__((aligned (x)))
#define alignof __alignof__
#else
#include <stdalign.h>
#endif

It seems like we need to extend the support added for GCC 4.6 to handle the OpenBSD case. Ideally __has_include would be used, but that only works in GCC 5.1 and later. So, maybe the solution is to just add an OpenBSD-specific thing to the #elif.

@briansmith

This comment has been minimized.

Copy link
Owner Author

commented Apr 15, 2017

Closing this based on https://www.phoronix.com/scan.php?page=news_item&px=OpenBSD-Adds-LLVM-To-Base, in particular “OpenBSD currently makes use of GCC 4.2.1, the latest series of the GNU Compiler Collection being under the GPLv2”. We don't support such ancient versions of GCC, so people should just use Clang on OpenBSD. LMK if this is problematic.

@briansmith briansmith closed this Apr 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.