1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-23 20:15:19 -07:00

randombytes_internal_random.c: move clang target attribute down
Some checks failed
CI / tcc (push) Has been cancelled
CI / zig (push) Has been cancelled
CI / regular (push) Has been cancelled
CI / check-globals (push) Has been cancelled
CI / other-comp (push) Has been cancelled
CI / other-arch (push) Has been cancelled
CI / android (push) Has been cancelled
CodeQL scan / CodeQL-Build (push) Has been cancelled
.NET Package / run-test-binaries-os-versions (debian:10) (push) Has been cancelled
.NET Package / build-windows-msvc (push) Has been cancelled
.NET Package / build-others (push) Has been cancelled
.NET Package / build-apple (push) Has been cancelled
.NET Package / pack (push) Has been cancelled
.NET Package / build-test-binaries (push) Has been cancelled
.NET Package / run-test-binaries-os-versions (centos:8) (push) Has been cancelled
.NET Package / run-test-binaries-cross-plat (arm, /usr/arm-linux-gnueabihf/lib) (push) Has been cancelled
.NET Package / run-test-binaries-cross-plat (arm64, /usr/aarch64-linux-gnu/lib) (push) Has been cancelled
.NET Package / run-test-binaries-cross-plat (x64, /usr/lib) (push) Has been cancelled

Specifically, move it after the system includes.

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

Fixes #1413
This commit is contained in:
Frank Denis 2024-09-26 21:55:38 +02:00
parent 5b2c1c640a
commit 3c6da4b8c2

View File

@ -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"
@ -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;