Skip to content

Commit

Permalink
randombytes_internal_random.c: move clang target attribute down
Browse files Browse the repository at this point in the history
Specifically, move it after the system includes.

This appears to address an issue with clang 18 when cross-compiling
to windows.

Fixes #1413
  • Loading branch information
jedisct1 committed Sep 26, 2024
1 parent 5b2c1c6 commit 3c6da4b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/libsodium/randombytes/internal/randombytes_internal_random.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@
#ifdef BLOCK_ON_DEV_RANDOM
# include <poll.h>
#endif
#ifdef HAVE_RDRAND
# ifdef __clang__
# pragma clang attribute push(__attribute__((target("rdrnd"))), apply_to = function)
# elif defined(__GNUC__)
# pragma GCC target("rdrnd")
# endif
# include <immintrin.h>
#endif

#include "core.h"
#include "crypto_core_hchacha20.h"
Expand Down Expand Up @@ -109,6 +101,15 @@ BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
# endif
#endif

#ifdef HAVE_RDRAND
# ifdef __clang__
# pragma clang attribute push(__attribute__((target("rdrnd"))), apply_to = function)
# elif defined(__GNUC__)
# pragma GCC target("rdrnd")
# endif
# include <immintrin.h>
#endif

typedef struct InternalRandomGlobal_ {
int initialized;
int random_data_source_fd;
Expand Down

0 comments on commit 3c6da4b

Please sign in to comment.