Get universal binary working for clang on Linux

A few changes were necessary, mainly because clang LTO works a bit differently than GCC

Doesn't yet work on Windows

small Makefile cleanups

closes https://github.com/official-stockfish/Stockfish/pull/6764

No functional change
This commit is contained in:
anematode
2026-04-26 09:31:30 +02:00
committed by Joost VandeVondele
parent 86853a60ce
commit 8f181af8fb
3 changed files with 35 additions and 23 deletions
+11 -19
View File
@@ -54,32 +54,24 @@ INCBIN(EmbeddedNNUESmall, EvalFileDefaultNameSmall);
extern const unsigned char gEmbeddedNNUEBigData[] WEAK_SYM = {
#embed EvalFileDefaultNameBig
};
extern const unsigned int gEmbeddedNNUEBigSize WEAK_SYM = sizeof(gEmbeddedNNUEBigData);
extern const unsigned char* const gEmbeddedNNUEBigEnd WEAK_SYM =
gEmbeddedNNUEBigData + gEmbeddedNNUEBigSize;
extern const unsigned char gEmbeddedNNUESmallData[] WEAK_SYM = {
extern const unsigned int gEmbeddedNNUEBigSize WEAK_SYM = sizeof(gEmbeddedNNUEBigData);
extern const unsigned char gEmbeddedNNUESmallData[] WEAK_SYM = {
#embed EvalFileDefaultNameSmall
};
extern const unsigned int gEmbeddedNNUESmallSize WEAK_SYM = sizeof(gEmbeddedNNUESmallData);
extern const unsigned char* const gEmbeddedNNUESmallEnd WEAK_SYM =
gEmbeddedNNUESmallData + gEmbeddedNNUESmallSize;
extern const unsigned int gEmbeddedNNUESmallSize WEAK_SYM = sizeof(gEmbeddedNNUESmallData);
#else
const unsigned char gEmbeddedNNUEBigData[1] = {0x0};
const unsigned char* const gEmbeddedNNUEBigEnd = &gEmbeddedNNUEBigData[1];
const unsigned int gEmbeddedNNUEBigSize = 1;
const unsigned char gEmbeddedNNUESmallData[1] = {0x0};
const unsigned char* const gEmbeddedNNUESmallEnd = &gEmbeddedNNUESmallData[1];
const unsigned int gEmbeddedNNUESmallSize = 1;
const unsigned char gEmbeddedNNUEBigData[1] = {0x0};
const unsigned int gEmbeddedNNUEBigSize = 1;
const unsigned char gEmbeddedNNUESmallData[1] = {0x0};
const unsigned int gEmbeddedNNUESmallSize = 1;
#endif
namespace {
struct EmbeddedNNUE {
EmbeddedNNUE(const unsigned char* embeddedData,
const unsigned char* embeddedEnd,
const unsigned int embeddedSize) :
EmbeddedNNUE(const unsigned char* embeddedData, const unsigned int embeddedSize) :
data(embeddedData),
end(embeddedEnd),
end(embeddedData + embeddedSize),
size(embeddedSize) {}
const unsigned char* data;
const unsigned char* end;
@@ -90,9 +82,9 @@ using namespace Stockfish::Eval::NNUE;
EmbeddedNNUE get_embedded(EmbeddedNNUEType type) {
if (type == EmbeddedNNUEType::BIG)
return EmbeddedNNUE(gEmbeddedNNUEBigData, gEmbeddedNNUEBigEnd, gEmbeddedNNUEBigSize);
return EmbeddedNNUE(gEmbeddedNNUEBigData, gEmbeddedNNUEBigSize);
else
return EmbeddedNNUE(gEmbeddedNNUESmallData, gEmbeddedNNUESmallEnd, gEmbeddedNNUESmallSize);
return EmbeddedNNUE(gEmbeddedNNUESmallData, gEmbeddedNNUESmallSize);
}
}